Skip to content

Commit

Permalink
make node.js binary available to the ruby lang pack
Browse files Browse the repository at this point in the history
  • Loading branch information
hone committed Oct 11, 2011
1 parent ea8460c commit c5430bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
9 changes: 0 additions & 9 deletions lib/language_pack/rails3.rb
Expand Up @@ -3,9 +3,6 @@

# Rails 3 Language Pack. This is for all Rails 3.x apps.
class LanguagePack::Rails3 < LanguagePack::Rails2
NODE_VERSION = "0.4.7"
NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}"

# detects if this is a Rails 3.x app
# @return [Boolean] true if it's a Rails 3.x app
def self.use?
Expand Down Expand Up @@ -41,12 +38,6 @@ def plugins
super.concat(%w( rails3_serve_static_assets )).uniq
end

def binaries
# execjs will blow up if no JS RUNTIME is detected and is loaded.
node = gem_is_bundled?('execjs') ? [NODE_JS_BINARY_PATH] : []
super + node
end

# runs the tasks for the Rails 3.1 asset pipeline
def setup_asset_pipeline
log("assets_precompile") do
Expand Down
19 changes: 14 additions & 5 deletions lib/language_pack/ruby.rb
Expand Up @@ -4,10 +4,12 @@

# base Ruby Language Pack. This is for any base ruby app.
class LanguagePack::Ruby < LanguagePack::Base
LIBYAML_VERSION = "0.1.4"
LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}"
BUNDLER_VERSION = "1.1.rc"
BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}"
LIBYAML_VERSION = "0.1.4"
LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}"
BUNDLER_VERSION = "1.1.rc"
BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}"
NODE_VERSION = "0.4.7"
NODE_JS_BINARY_PATH = "node-#{NODE_VERSION}"

# detects if this is a valid Ruby app
# @return [Boolean] true if it's a Ruby app
Expand Down Expand Up @@ -98,7 +100,7 @@ def install_language_pack_gems
# default set of binaries to install
# @return [Array] resulting list
def binaries
[]
add_node_js_binary
end

# vendors binaries into the slug
Expand Down Expand Up @@ -284,4 +286,11 @@ def allow_git(&blk)
def add_shared_database_addon
gem_is_bundled?("pg") ? ['shared-database:5mb'] : []
end

# decides if we need to install the node.js binary
# @note execjs will blow up if no JS RUNTIME is detected and is loaded.
# @return [Array] the node.js binary path if we need it or an empty Array
def add_node_js_binary
gem_is_bundled?('execjs') ? [NODE_JS_BINARY_PATH] : []
end
end

0 comments on commit c5430bc

Please sign in to comment.