Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Update precompilation paths for rails4
Browse files Browse the repository at this point in the history
  • Loading branch information
cazzerson committed Sep 28, 2016
1 parent 37aa22b commit 58195c8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
29 changes: 28 additions & 1 deletion lib/generators/lentil/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,36 @@ def lentil_config_comments
insert_into_file "config/application.rb", "\n # Inserted by lentil\n # End of lentil changes\n\n", :after => "class Application < Rails::Application\n"
end

desc "Remove test/performance/browsing_test.rb"
def remove_test_performance_browsing_test
remove_file("test/performance/browsing_test.rb")
end

desc "Update gems"
def lentil_update_gems
gsub_file "Gemfile", /^.*sass-rails.*$/, "gem 'sass-rails'"
gsub_file "Gemfile", /^.*coffee-rails.*$/, "gem 'coffee-rails'"
end

desc "Remove gems"
def lentil_remove_gems
gsub_file "Gemfile", /^.*rails-perftest.*$/, ""
gsub_file "Gemfile", /^.*ruby-prof.*$/, ""
end

desc "Enable raise_in_transactions_callbacks"
def enable_raise_trans_cb
insert_into_file "config/application.rb", " config.active_record.raise_in_transactional_callbacks = true", :after => "# Inserted by lentil\n"
end

desc "Randomize tests"
def randomize_tests
insert_into_file "config/environments/test.rb", " config.active_support.test_order = :random", :before => "end"
end

desc 'precompile additional assets'
def precompile_assets
insert_into_file "config/application.rb", " config.assets.precompile += %w( lentil/iframe.js lentil/iframe.css addanimatedimages.js animatedimages/css/style.css )\n", :after => "# Inserted by lentil\n"
append_to_file "config/assets.rb", "Rails.application.config.assets.precompile += %w( *.js ^[^_]*.css *.css.erb lentil/iframe.js lentil/iframe.css addanimatedimages.js animatedimages/css/style.css )\n"
end

desc 'do not enforce available locales'
Expand Down
3 changes: 2 additions & 1 deletion lib/generators/lentil/upgrade_v1_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def randomize_tests

desc "Update precompilation paths"
def update_precompilation_paths
gsub_file "config/application.rb", /^.*Rails.application.config.assets.precompile.*$/, "Rails.application.config.assets.precompile += %w( *.js ^[^_]*.css *.css.erb lentil/iframe.js lentil/iframe.css addanimatedimages.js animatedimages/css/style.css )"
gsub_file "config/application.rb", /^.*Rails.application.config.assets.precompile.*$/, ""
append_to_file "config/assets.rb", "Rails.application.config.assets.precompile += %w( *.js ^[^_]*.css *.css.erb lentil/iframe.js lentil/iframe.css addanimatedimages.js animatedimages/css/style.css )\n"
end

end
Expand Down

0 comments on commit 58195c8

Please sign in to comment.