Sha256: fa7d4ec6b547305ba6f7dad9c2ee6e2e27ca2ade9ceead639c0dca41e0fdb1f7

Contents?: true

Size: 996 Bytes

Versions: 10

Compression:

Stored size: 996 Bytes

Contents

module Vx
  module Builder
    class ScriptBuilder

      class Nodejs < Base

        DEFAULT_NODE = '0.10'

        def call(env)
          if enabled?(env)

            vxvm_install(env, 'nodejs', node_version(env))

            do_cache_key(env) do |i|
              i << "nodejs-#{node_version env}"
            end

            do_announce(env) do |i|
              i << trace_sh_command("node --version")
              i << trace_sh_command("npm --version")
            end

            do_install(env) do |i|
              i << trace_sh_command("npm install")
            end

            do_script(env) do |i|
              i << trace_sh_command("npm test")
            end
          end

          app.call(env)
        end

        private

          def enabled?(env)
            env.source.node_js.first || env.source.language == 'node_js'
          end

          def node_version(env)
            env.source.node_js.first || DEFAULT_NODE
          end

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vx-builder-0.5.12 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.11 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.10 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.9 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.8 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.7 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.6 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.5 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.4 lib/vx/builder/script_builder/nodejs.rb
vx-builder-0.5.3 lib/vx/builder/script_builder/nodejs.rb