Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 67 lines (54 sloc) 1.79 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
10e58a8 @hone mv node/node-0.4.7 to node-0.4.7
hone authored
5 NODE_JS_BINARY_PATH = 'node-0.4.7/node'
11771c5 @ddollar initial copy from slugc
ddollar authored
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
14 "Ruby/Rails"
11771c5 @ddollar initial copy from slugc
ddollar authored
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
30 allow_git { setup_asset_pipeline }
11771c5 @ddollar initial copy from slugc
ddollar authored
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
39 def binaries
d46635a @hone uninstall node.js if assets:precompile works
hone authored
40 node = gem_is_bundled?('execjs') ? [NODE_JS_BINARY_PATH] : []
5a46865 @hone Revert "Revert "only bundle in node for execjs based apps""
hone authored
41 super + node
3da296d @hone Revert "Revert "bundle node into rails 3 slugs :{""
hone authored
42 end
43
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored
44 def setup_asset_pipeline
06af685 @hone remove the compile task check since it might not stay around
hone authored
45 if rake_task_defined?("assets:precompile")
fd691b1 @hone change asset pipeline copy
hone authored
46 topic("Preparing app for Rails asset pipeline")
0e104d9 @hone setup asset pipeline for rails 3.1.0
hone authored
47 if File.exists?("public/assets/manifest.yml")
48 puts "Local asset compilation detected."
49 else
50 run("mkdir -p tmp/cache")
51 # need to use a dummy DATABASE_URL here, so rails can load the environment
52 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")
53 if $?.success?
54 puts "assets:precompile run successfully"
55 else
56 puts "Problems running assets:precompile"
57 puts "Setting up runtime asset compilation"
58 install_plugin("rails31_enable_runtime_asset_compilation")
59 # uninstall_binary(NODE_JS_BINARY_PATH)
60 end
bc90eeb @hone execute assets:precompile on rails 3 apps
hone authored
61 end
62 end
63 end
64
11771c5 @ddollar initial copy from slugc
ddollar authored
65 end
66
Something went wrong with that request. Please try again.