vx-builder 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/vx/builder/build_configuration.rb +2 -0
 - data/lib/vx/builder/matrix_builder.rb +1 -0
 - data/lib/vx/builder/script_builder/nodejs.rb +48 -0
 - data/lib/vx/builder/script_builder.rb +2 -0
 - data/lib/vx/builder/version.rb +1 -1
 - data/spec/fixtures/integration/ruby/matrix/d.before_script.sh +1 -0
 - data/spec/fixtures/travis.yml +2 -0
 - data/spec/integration/nodejs_spec.rb +42 -0
 - data/spec/lib/builder/build_configuration_spec.rb +1 -0
 - metadata +5 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ed4202898a00a69bd2f499a568f8caec71977d66
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 992ff2819ab8e68872fbde5c5c14d78cfe360505
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a7c911962c18960fc2b26a07ba3fdbc338a5970527cc8eb833f0837874b305374d7f7fb19e53f2ddc6b6dbf46096d4e970595fed22a36b6a6c0b3a5923acd9b9
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 34eb9d1f94e16abab9ac897ed67729ff2385e7bdfd90073241a342662ed6b0ad3aba1f6c7092e26b494241edf3006f8dcf56efdfd4487ac43d7cb22d8456c275
         
     | 
| 
         @@ -0,0 +1,48 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Vx
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Builder
         
     | 
| 
      
 3 
     | 
    
         
            +
                class ScriptBuilder
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  class Nodejs < Base
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                    DEFAULT_NODE = '0.10'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    def call(env)
         
     | 
| 
      
 10 
     | 
    
         
            +
                      if enabled?(env)
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                        vxvm_install(env, 'nodejs', node_version(env))
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                        do_cache_key(env) do |i|
         
     | 
| 
      
 15 
     | 
    
         
            +
                          i << "nodejs-#{node_version env}"
         
     | 
| 
      
 16 
     | 
    
         
            +
                        end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                        do_announce(env) do |i|
         
     | 
| 
      
 19 
     | 
    
         
            +
                          i << trace_sh_command("node --version")
         
     | 
| 
      
 20 
     | 
    
         
            +
                          i << trace_sh_command("npm --version")
         
     | 
| 
      
 21 
     | 
    
         
            +
                        end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                        do_install(env) do |i|
         
     | 
| 
      
 24 
     | 
    
         
            +
                          i << trace_sh_command("npm install")
         
     | 
| 
      
 25 
     | 
    
         
            +
                        end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                        do_script(env) do |i|
         
     | 
| 
      
 28 
     | 
    
         
            +
                          i << trace_sh_command("npm test")
         
     | 
| 
      
 29 
     | 
    
         
            +
                        end
         
     | 
| 
      
 30 
     | 
    
         
            +
                      end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                      app.call(env)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    private
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                      def enabled?(env)
         
     | 
| 
      
 38 
     | 
    
         
            +
                        env.source.node_js.first || env.source.language == 'node_js'
         
     | 
| 
      
 39 
     | 
    
         
            +
                      end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                      def node_version(env)
         
     | 
| 
      
 42 
     | 
    
         
            +
                        env.source.node_js.first || DEFAULT_NODE
         
     | 
| 
      
 43 
     | 
    
         
            +
                      end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -8,6 +8,7 @@ module Vx 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  autoload :Env,          File.expand_path("../script_builder/env",       __FILE__)
         
     | 
| 
       9 
9 
     | 
    
         
             
                  autoload :Ruby,         File.expand_path("../script_builder/ruby",      __FILE__)
         
     | 
| 
       10 
10 
     | 
    
         
             
                  autoload :Go,           File.expand_path("../script_builder/go",        __FILE__)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  autoload :Nodejs,       File.expand_path("../script_builder/nodejs",    __FILE__)
         
     | 
| 
       11 
12 
     | 
    
         
             
                  autoload :Java,         File.expand_path("../script_builder/java",      __FILE__)
         
     | 
| 
       12 
13 
     | 
    
         
             
                  autoload :Scala,        File.expand_path("../script_builder/scala",     __FILE__)
         
     | 
| 
       13 
14 
     | 
    
         
             
                  autoload :Clojure,      File.expand_path("../script_builder/clojure",   __FILE__)
         
     | 
| 
         @@ -33,6 +34,7 @@ module Vx 
     | 
|
| 
       33 
34 
     | 
    
         
             
                    use Builder::ScriptBuilder::Clojure
         
     | 
| 
       34 
35 
     | 
    
         
             
                    use Builder::ScriptBuilder::Ruby
         
     | 
| 
       35 
36 
     | 
    
         
             
                    use Builder::ScriptBuilder::Go
         
     | 
| 
      
 37 
     | 
    
         
            +
                    use Builder::ScriptBuilder::Nodejs
         
     | 
| 
       36 
38 
     | 
    
         | 
| 
       37 
39 
     | 
    
         
             
                    use Builder::ScriptBuilder::Deploy
         
     | 
| 
       38 
40 
     | 
    
         
             
                    use Builder::ScriptBuilder::Defaults
         
     | 
    
        data/lib/vx/builder/version.rb
    CHANGED
    
    
| 
         @@ -38,6 +38,7 @@ chmod +x $VX_ROOT/bin/vxvm 
     | 
|
| 
       38 
38 
     | 
    
         
             
             export CASHER_DIR=$HOME/.casher && ( mkdir -p $CASHER_DIR/bin && /usr/bin/curl https://raw2.github.com/dima-exe/casher/master/bin/casher --tcp-nodelay --retry 3 --fail --silent --show-error -o $HOME/.casher/bin/casher && chmod +x $HOME/.casher/bin/casher ) || true 
         
     | 
| 
       39 
39 
     | 
    
         
             
            test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher fetch http://example.com/test/pull-request/rvm-1.9.3-gemfile.tgz http://example.com/master/rvm-1.9.3-gemfile.tgz || true
         
     | 
| 
       40 
40 
     | 
    
         
             
            test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher add ~/.rubygems || true
         
     | 
| 
      
 41 
     | 
    
         
            +
            test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher add ~/.rubygems || true
         
     | 
| 
       41 
42 
     | 
    
         
             
            unset CASHER_DIR
         
     | 
| 
       42 
43 
     | 
    
         | 
| 
       43 
44 
     | 
    
         
             
            # before install
         
     | 
    
        data/spec/fixtures/travis.yml
    CHANGED
    
    
| 
         @@ -0,0 +1,42 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'tmpdir'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'fileutils'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            describe "(integration) nodejs" do
         
     | 
| 
      
 7 
     | 
    
         
            +
              let(:path) { Dir.tmpdir + "/vx-builder-test" }
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              before do
         
     | 
| 
      
 10 
     | 
    
         
            +
                FileUtils.rm_rf(path)
         
     | 
| 
      
 11 
     | 
    
         
            +
                FileUtils.mkdir_p(path)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
              after { FileUtils.rm_rf(path) }
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              def build(file, options = {})
         
     | 
| 
      
 16 
     | 
    
         
            +
                config = Vx::Builder::BuildConfiguration.from_yaml(file)
         
     | 
| 
      
 17 
     | 
    
         
            +
                matrix = Vx::Builder.matrix config
         
     | 
| 
      
 18 
     | 
    
         
            +
                options[:task] ||= create(:task)
         
     | 
| 
      
 19 
     | 
    
         
            +
                script = Vx::Builder.script(options[:task], matrix.build.first)
         
     | 
| 
      
 20 
     | 
    
         
            +
                OpenStruct.new script: script, matrix: matrix
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              it "should succesfuly run lang/go", real: true do
         
     | 
| 
      
 24 
     | 
    
         
            +
                file = {"language" => "node_js"}.to_yaml
         
     | 
| 
      
 25 
     | 
    
         
            +
                task = create(
         
     | 
| 
      
 26 
     | 
    
         
            +
                  :task,
         
     | 
| 
      
 27 
     | 
    
         
            +
                  sha: "HEAD",
         
     | 
| 
      
 28 
     | 
    
         
            +
                  branch: "lang/nodejs"
         
     | 
| 
      
 29 
     | 
    
         
            +
                )
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                b = build(file, task: task)
         
     | 
| 
      
 32 
     | 
    
         
            +
                Dir.chdir(path) do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  File.open("script.sh", "w") do |io|
         
     | 
| 
      
 34 
     | 
    
         
            +
                    io.write "set -e\n"
         
     | 
| 
      
 35 
     | 
    
         
            +
                    io.write b.script.to_before_script
         
     | 
| 
      
 36 
     | 
    
         
            +
                    io.write b.script.to_script
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  system("env", "-", "USER=$USER", "HOME=#{path}", "bash", "script.sh" )
         
     | 
| 
      
 39 
     | 
    
         
            +
                  expect($?.to_i).to eq 0
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vx-builder
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Dmitry Galinsky
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014-07- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-07-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: vx-common
         
     | 
| 
         @@ -145,6 +145,7 @@ files: 
     | 
|
| 
       145 
145 
     | 
    
         
             
            - lib/vx/builder/script_builder/env.rb
         
     | 
| 
       146 
146 
     | 
    
         
             
            - lib/vx/builder/script_builder/go.rb
         
     | 
| 
       147 
147 
     | 
    
         
             
            - lib/vx/builder/script_builder/java.rb
         
     | 
| 
      
 148 
     | 
    
         
            +
            - lib/vx/builder/script_builder/nodejs.rb
         
     | 
| 
       148 
149 
     | 
    
         
             
            - lib/vx/builder/script_builder/prepare.rb
         
     | 
| 
       149 
150 
     | 
    
         
             
            - lib/vx/builder/script_builder/ruby.rb
         
     | 
| 
       150 
151 
     | 
    
         
             
            - lib/vx/builder/script_builder/scala.rb
         
     | 
| 
         @@ -184,6 +185,7 @@ files: 
     | 
|
| 
       184 
185 
     | 
    
         
             
            - spec/fixtures/vx_test_repo_insecure_key.pub
         
     | 
| 
       185 
186 
     | 
    
         
             
            - spec/integration/clojure_spec.rb
         
     | 
| 
       186 
187 
     | 
    
         
             
            - spec/integration/go_spec.rb
         
     | 
| 
      
 188 
     | 
    
         
            +
            - spec/integration/nodejs_spec.rb
         
     | 
| 
       187 
189 
     | 
    
         
             
            - spec/integration/ruby_spec.rb
         
     | 
| 
       188 
190 
     | 
    
         
             
            - spec/lib/builder/build_configuration/cache_spec.rb
         
     | 
| 
       189 
191 
     | 
    
         
             
            - spec/lib/builder/build_configuration/deploy/base_spec.rb
         
     | 
| 
         @@ -266,6 +268,7 @@ test_files: 
     | 
|
| 
       266 
268 
     | 
    
         
             
            - spec/fixtures/vx_test_repo_insecure_key.pub
         
     | 
| 
       267 
269 
     | 
    
         
             
            - spec/integration/clojure_spec.rb
         
     | 
| 
       268 
270 
     | 
    
         
             
            - spec/integration/go_spec.rb
         
     | 
| 
      
 271 
     | 
    
         
            +
            - spec/integration/nodejs_spec.rb
         
     | 
| 
       269 
272 
     | 
    
         
             
            - spec/integration/ruby_spec.rb
         
     | 
| 
       270 
273 
     | 
    
         
             
            - spec/lib/builder/build_configuration/cache_spec.rb
         
     | 
| 
       271 
274 
     | 
    
         
             
            - spec/lib/builder/build_configuration/deploy/base_spec.rb
         
     |