Skip to content
Newer
Older
100644 84 lines (70 sloc) 2.34 KB
11771c5 @ddollar initial copy from slugc
ddollar authored May 24, 2011
1 require "language_pack"
2 require "language_pack/rails2"
3
4 class LanguagePack::Rails3 < LanguagePack::Rails2
10e58a8 @hone mv node/node-0.4.7 to node-0.4.7
hone authored Aug 22, 2011
5 NODE_JS_BINARY_PATH = 'node-0.4.7/node'
11771c5 @ddollar initial copy from slugc
ddollar authored May 24, 2011
6
7 def self.use?
8 super &&
9 File.exists?("config/application.rb") &&
10 File.read("config/application.rb") =~ /Rails::Application/
11 end
12
13 def name
719ee84 @ddollar name packs as language/framework
ddollar authored May 27, 2011
14 "Ruby/Rails"
11771c5 @ddollar initial copy from slugc
ddollar authored May 24, 2011
15 end
16
17 def default_process_types
18 web_process = gem_is_bundled?("thin") ?
19 "bundle exec thin start -R config.ru -e $RAILS_ENV -p $PORT" :
20 "bundle exec rails server -p $PORT"
21
22 super.merge({
23 "web" => web_process,
24 "console" => "bundle exec rails console"
25 })
26 end
27
28 def compile
29 super
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored Sep 4, 2011
30 allow_git { setup_asset_pipeline }
11771c5 @ddollar initial copy from slugc
ddollar authored May 24, 2011
31 end
32
33 private
34
35 def plugins
36 super.concat(%w( rails3_serve_static_assets )).uniq
37 end
38
3da296d @hone Revert "Revert "bundle node into rails 3 slugs :{""
hone authored Jul 18, 2011
39 def binaries
d46635a @hone uninstall node.js if assets:precompile works
hone authored Jul 18, 2011
40 node = gem_is_bundled?('execjs') ? [NODE_JS_BINARY_PATH] : []
5a46865 @hone Revert "Revert "only bundle in node for execjs based apps""
hone authored Jul 18, 2011
41 super + node
3da296d @hone Revert "Revert "bundle node into rails 3 slugs :{""
hone authored Jul 18, 2011
42 end
43
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored Sep 5, 2011
44 def setup_asset_pipeline
06af685 @hone remove the compile task check since it might not stay around
hone authored Jul 14, 2011
45 if rake_task_defined?("assets:precompile")
fd691b1 @hone change asset pipeline copy
hone authored Jul 22, 2011
46 topic("Preparing app for Rails asset pipeline")
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored Sep 5, 2011
47 if File.exists?("public/assets/manifest.yml")
5cfc0b9 @hone asset pipeline copy changes from David Dollar
hone authored Sep 6, 2011
48 puts "Detected manifest.yml, assuming assets were compiled locally"
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored Sep 5, 2011
49 else
7bbb5ee @ddollar allow user env to take precedence
ddollar authored Sep 22, 2011
50 ENV["DATABASE_URL"] ||= begin
51 # need to use a dummy DATABASE_URL here, so rails can load the environment
52 scheme =
53 if gem_is_bundled?("pg")
54 "postgres"
55 elsif gem_is_bundled?("mysql")
56 "mysql"
57 elsif gem_is_bundled?("mysql2")
58 "mysql2"
59 elsif gem_is_bundled?("sqlite3") || gem_is_bundled?("sqlite3-ruby")
60 "sqlite3"
61 end
62 "#{scheme}://user:pass@127.0.0.1/dbname"
63 end
64
65 ENV["RAILS_GROUPS"] ||= "assets"
66 ENV["RAILS_ENV"] ||= "production"
5f467e4 @hone Revert "Revert "pick a database_url based on gems""
hone authored Sep 6, 2011
67
5cfc0b9 @hone asset pipeline copy changes from David Dollar
hone authored Sep 6, 2011
68 puts "Running: rake assets:precompile"
69 rake_output = ""
7bbb5ee @ddollar allow user env to take precedence
ddollar authored Sep 22, 2011
70 rake_output << run("env PATH=$PATH:bin bundle exec rake assets:precompile 2>&1")
5cfc0b9 @hone asset pipeline copy changes from David Dollar
hone authored Sep 6, 2011
71 puts rake_output
72 unless $?.success?
73 puts "Precompiling assets failed, enabling runtime asset compilation"
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored Sep 5, 2011
74 install_plugin("rails31_enable_runtime_asset_compilation")
0882151 @hone link to docs on assets:precompile fail
hone authored Sep 13, 2011
75 puts "Please see this article for troubleshooting help:"
76 puts "http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting"
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored Sep 5, 2011
77 # uninstall_binary(NODE_JS_BINARY_PATH)
78 end
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored Jun 9, 2011
79 end
80 end
81 end
82
11771c5 @ddollar initial copy from slugc
ddollar authored May 24, 2011
83 end
Something went wrong with that request. Please try again.