lib/generators/ember/bootstrap_generator.rb in ember-appkit-rails-0.3.2 vs lib/generators/ember/bootstrap_generator.rb in ember-appkit-rails-0.4.0

- old
+ new

@@ -27,18 +27,18 @@ def create_application_file template "application.js.erb", "#{config_path}/application.js" end def create_ember_adapter_file - template "adapter.js.erb", "#{config_path}/adapter.js.erb" + template "adapter.js.erb", "#{config_path}/adapters/application.js.es6.erb" end def create_ember_environment_files - template "environment.js", "#{config_path}/environment.js" - template "environments/development.js", "#{config_path}/environments/development.js" - template "environments/production.js", "#{config_path}/environments/production.js" - template "environments/test.js", "#{config_path}/environments/test.js" + copy_file "environment.js.erb", "#{config_path}/environment.js.erb" + copy_file "environments/development.js.erb", "#{config_path}/environments/development.js.erb" + copy_file "environments/production.js.erb", "#{config_path}/environments/production.js.erb" + copy_file "environments/test.js.erb", "#{config_path}/environments/test.js.erb" end def create_utils_csrf_file template "csrf.js", "#{config_path}/initializers/csrf.js" end @@ -50,10 +50,18 @@ def remove_jbuilder remove_jbuilder_from_gemfile end + def add_greedy_rails_route + insert_into_file 'config/routes.rb', before: /^end$/ do + "\n" + + " # Uncomment when using 'history' as the location in Ember's router\n" + + " # get '*foo', :to => 'landing#index'\n" + end + end + def add_custom_paths if app_path != configuration.paths.app insert_into_file 'config/application.rb', before: /\s\send\nend/ do " config.ember.appkit.paths.app = '#{app_path}'\n" end @@ -77,10 +85,10 @@ def remove_gem_from_gemfile(gem) path = Pathname.new(destination_root).join('Gemfile') return unless path.exist? - gsub_file path, /(?:#.+$\n)?gem '#{gem}.*'\n\n/, '' + gsub_file path, /(?:#.+$\n)?gem ['|"]#{gem}.*['|"].*\n\n?/, '' end def remove_turbolinks_from_gemfile remove_gem_from_gemfile(:turbolinks) end