lib/generators/bower_rails/initialize/initialize_generator.rb in bower-rails-0.10.0 vs lib/generators/bower_rails/initialize/initialize_generator.rb in bower-rails-0.11.0
- old
+ new
@@ -1,8 +1,10 @@
module BowerRails
module Generators
class InitializeGenerator < Rails::Generators::Base
+ INITIALIZE_FILE_PATH = 'config/initializers/bower_rails.rb'
+
desc 'Adds a boilerplate bower.json or Bowerfile to the root of Rails project and an empty initializer'
source_root File.expand_path('../templates', __FILE__)
argument :config_file, :type => :string, :default => 'bowerfile'
def create_config_file
@@ -14,16 +16,16 @@
raise ArgumentError, 'You can setup bower-rails only using bower.json or Bowerfile. Please provide `json` or `bowerfile` as an argument instead'
end
end
def copy_initializer_file
- copy_file 'bower_rails.rb', 'config/initializers/bower_rails.rb'
+ copy_file 'bower_rails.rb', INITIALIZE_FILE_PATH
end
def require_initializer_in_application_rb
if Rails.version < "4.0.0"
- environment { "require \"#{Rails.root}/config/initializers/bower_rails.rb\"" }
+ environment { "require Rails.root.join(\"#{INITIALIZE_FILE_PATH}\").to_s" }
end
end
end
end
-end
\ No newline at end of file
+end