Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 57 lines (44 sloc) 1.349 kb
11771c5 @ddollar initial copy from slugc
ddollar authored
1 require "language_pack"
2 require "language_pack/rails2"
3
4 class LanguagePack::Rails3 < LanguagePack::Rails2
5
6 def self.use?
7 super &&
8 File.exists?("config/application.rb") &&
9 File.read("config/application.rb") =~ /Rails::Application/
10 end
11
12 def name
719ee84 @ddollar name packs as language/framework
ddollar authored
13 "Ruby/Rails"
11771c5 @ddollar initial copy from slugc
ddollar authored
14 end
15
16 def default_process_types
17 web_process = gem_is_bundled?("thin") ?
18 "bundle exec thin start -R config.ru -e $RAILS_ENV -p $PORT" :
19 "bundle exec rails server -p $PORT"
20
21 super.merge({
22 "web" => web_process,
23 "console" => "bundle exec rails console"
24 })
25 end
26
27 def compile
28 super
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored
29 run_assets_precompile_task
11771c5 @ddollar initial copy from slugc
ddollar authored
30 end
31
32 private
33
34 def plugins
35 super.concat(%w( rails3_serve_static_assets )).uniq
36 end
37
3da296d @hone Revert "Revert "bundle node into rails 3 slugs :{""
hone authored
38 def binaries
5a46865 @hone Revert "Revert "only bundle in node for execjs based apps""
hone authored
39 node = gem_is_bundled?('execjs') ? ['node/node-0.4.7/node'] : []
40 super + node
3da296d @hone Revert "Revert "bundle node into rails 3 slugs :{""
hone authored
41 end
42
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored
43 def run_assets_precompile_task
06af685 @hone remove the compile task check since it might not stay around
hone authored
44 if rake_task_defined?("assets:precompile")
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored
45 topic("Running assets:precompile task")
2dac248 @hone rails needs this to set the cache store to file
hone authored
46 run("mkdir -p tmp/cache")
abf735a @hone use dummy database_url for assets:precompile
hone authored
47 # need to use a dummy DATABASE_URL here, so rails can load the environment
3da296d @hone Revert "Revert "bundle node into rails 3 slugs :{""
hone authored
48 pipe("env RAILS_ENV=production DATABASE_URL=postgres://user:pass@127.0.0.1/dbname PATH=$PATH:bin bundle exec rake assets:precompile 2>&1")
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored
49 unless $?.success?
af665ab @hone don't fail if the assets:precompile task works
hone authored
50 puts "assets:precompile task failed"
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored
51 end
52 end
53 end
54
11771c5 @ddollar initial copy from slugc
ddollar authored
55 end
56
Something went wrong with that request. Please try again.