Skip to content

Commit

Permalink
setup asset pipeline for rails 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hone committed Sep 6, 2011
1 parent 1770f9f commit 0e104d9
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions lib/language_pack/rails3.rb
Expand Up @@ -27,7 +27,7 @@ def default_process_types


def compile def compile
super super
allow_git { run_assets_precompile_task } allow_git { setup_asset_pipeline }
end end


private private
Expand All @@ -41,14 +41,23 @@ def binaries
super + node super + node
end end


def run_assets_precompile_task def setup_asset_pipeline
if rake_task_defined?("assets:precompile") if rake_task_defined?("assets:precompile")
topic("Preparing app for Rails asset pipeline") topic("Preparing app for Rails asset pipeline")
run("mkdir -p tmp/cache") if File.exists?("public/assets/manifest.yml")
# need to use a dummy DATABASE_URL here, so rails can load the environment puts "Local asset compilation detected."
run("env RAILS_ENV=production RAILS_GROUPS=assets DATABASE_URL=postgres://user:pass@127.0.0.1/dbname PATH=$PATH:bin bundle exec rake assets:precompile 2>&1") else
if $?.success? run("mkdir -p tmp/cache")
# uninstall_binary(NODE_JS_BINARY_PATH) # need to use a dummy DATABASE_URL here, so rails can load the environment
run("env RAILS_ENV=production RAILS_GROUPS=assets DATABASE_URL=postgres://user:pass@127.0.0.1/dbname PATH=$PATH:bin bundle exec rake assets:precompile 2>&1")
if $?.success?
puts "assets:precompile run successfully"
else
puts "Problems running assets:precompile"
puts "Setting up runtime asset compilation"
install_plugin("rails31_enable_runtime_asset_compilation")
# uninstall_binary(NODE_JS_BINARY_PATH)
end
end end
end end
end end
Expand Down

0 comments on commit 0e104d9

Please sign in to comment.