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

Commit 922ee7d

Browse files
committed
Simplified adding namespace to paths
1 parent 0a20215 commit 922ee7d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/generators/casino/install/install_generator.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def copy_config_files
2727
return unless options['config_files']
2828

2929
copy_file 'cas.yml', 'config/cas.yml'
30-
copy_file 'casino_and_overrides.scss', build_file_path('app/assets/stylesheets', '/casino_and_overrides.scss')
30+
copy_file 'casino_and_overrides.scss', "app/assets/stylesheets/#{namespace_name}/casino_and_overrides.scss".squeeze('/')
3131
end
3232

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

4747
private
48-
def build_file_path(root, path)
49-
engine_name = Rails::Generators.namespace.to_s.underscore
50-
engine_path = "/#{engine_name}" unless engine_name.blank?
51-
52-
[root, engine_path, path].compact.join
48+
def namespace_name
49+
Rails::Generators.namespace.to_s.underscore
5350
end
5451

5552
end

lib/generators/casino/migration_generator.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class MigrationGenerator < ::Rails::Generators::Base
1212
def install
1313
source_paths.each do |source_path|
1414
Dir["#{source_path}/*.rb"].each do |filename|
15-
puts "MIGRATION TEMPLATE: #{File.basename(filename)}"
1615
migration_template File.basename(filename), "db/migrate/#{File.basename(filename).sub(/^\d+_/, '')}"
1716
end
1817
end

0 commit comments

Comments
 (0)