Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Simplified adding namespace to paths
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvh committed Nov 15, 2015
1 parent 0a20215 commit 922ee7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 4 additions & 7 deletions lib/generators/casino/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def copy_config_files
return unless options['config_files']

copy_file 'cas.yml', 'config/cas.yml'
copy_file 'casino_and_overrides.scss', build_file_path('app/assets/stylesheets', '/casino_and_overrides.scss')
copy_file 'casino_and_overrides.scss', "app/assets/stylesheets/#{namespace_name}/casino_and_overrides.scss".squeeze('/')
end

def insert_assets_loader
insert_into_file build_file_path('app/assets/javascripts', '/application.js'), :after => %r{//= require +['"]?jquery_ujs['"]?} do
insert_into_file "app/assets/javascripts/#{namespace_name}/application.js".squeeze('/'), :after => %r{//= require +['"]?jquery_ujs['"]?} do
"\n//= require casino"
end
end
Expand All @@ -45,11 +45,8 @@ def show_readme
end

private
def build_file_path(root, path)
engine_name = Rails::Generators.namespace.to_s.underscore
engine_path = "/#{engine_name}" unless engine_name.blank?

[root, engine_path, path].compact.join
def namespace_name
Rails::Generators.namespace.to_s.underscore
end

end
Expand Down
1 change: 0 additions & 1 deletion lib/generators/casino/migration_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class MigrationGenerator < ::Rails::Generators::Base
def install
source_paths.each do |source_path|
Dir["#{source_path}/*.rb"].each do |filename|
puts "MIGRATION TEMPLATE: #{File.basename(filename)}"
migration_template File.basename(filename), "db/migrate/#{File.basename(filename).sub(/^\d+_/, '')}"
end
end
Expand Down

0 comments on commit 922ee7d

Please sign in to comment.