vx-builder 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vx/builder/script/ruby.rb +10 -1
- data/lib/vx/builder/source/constants.rb +1 -1
- data/lib/vx/builder/source/matrix.rb +1 -1
- data/lib/vx/builder/version.rb +1 -1
- data/spec/fixtures/travis.yml +2 -0
- data/spec/lib/builder/script/ruby_spec.rb +25 -0
- data/spec/lib/builder/source_spec.rb +7 -4
- data/spec/support/create.rb +10 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be5cdd3fce6728724ea5b5dfeafc8ad84a296a8c
|
4
|
+
data.tar.gz: d656d3934abcae13a35bc817e075314a242901dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 873d68e4ea251f4d05bef3f0b7ba0ca96ea2cef984dd62dc651f8a01ed1a28775bfd2035a2aff0bf696eca4662519285dd7f15e175a097555a8eb2c94601e7e5
|
7
|
+
data.tar.gz: bfe817065afd19d996a7c5d6dd1120ef823b1b0f6367035ee7c18c24f6a2c56c99740debc865a63a764b8ff25f2f1c3447a073aed684e113de594e3aec57dcf4
|
@@ -13,7 +13,7 @@ module Vx
|
|
13
13
|
env.before_install.tap do |i|
|
14
14
|
i << 'eval "$(rbenv init -)" || true'
|
15
15
|
i << "rbenv shell #{make_rbenv_version_command env}"
|
16
|
-
i <<
|
16
|
+
i << "export BUNDLE_GEMFILE=${PWD}/#{gemfile(env)}"
|
17
17
|
i << 'export GEM_HOME=$HOME/cached/rubygems'
|
18
18
|
end
|
19
19
|
|
@@ -38,6 +38,15 @@ module Vx
|
|
38
38
|
env.source.rvm.first
|
39
39
|
end
|
40
40
|
|
41
|
+
def gemfile(env)
|
42
|
+
if env.source.gemfile
|
43
|
+
env.source.gemfile.first
|
44
|
+
else
|
45
|
+
env.source.gemfile = ["Gemfile"]
|
46
|
+
gemfile(env)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
41
50
|
def make_rbenv_version_command(env)
|
42
51
|
select_rbenv_version(env)
|
43
52
|
end
|
data/lib/vx/builder/version.rb
CHANGED
data/spec/fixtures/travis.yml
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vx::Builder::Script::Ruby do
|
4
|
+
let(:app) { ->(_) { 0 } }
|
5
|
+
let(:script) { described_class.new app }
|
6
|
+
let(:env) { create :env }
|
7
|
+
let(:run) { script.call env }
|
8
|
+
subject { run }
|
9
|
+
|
10
|
+
it { should eq 0 }
|
11
|
+
|
12
|
+
context "run it" do
|
13
|
+
let(:command) { create :command_from_env, env: env }
|
14
|
+
before { run }
|
15
|
+
|
16
|
+
it "should be success" do
|
17
|
+
puts env
|
18
|
+
puts command
|
19
|
+
|
20
|
+
system( command )
|
21
|
+
expect($?.to_i).to eq 0
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -7,6 +7,7 @@ describe Vx::Builder::Source do
|
|
7
7
|
|
8
8
|
its(:attributes) { should be }
|
9
9
|
its(:rvm) { should eq %w{ 2.0.0 } }
|
10
|
+
its(:gemfile) { should eq %w{ Gemfile } }
|
10
11
|
its(:before_script) { should eq ["echo before_script"] }
|
11
12
|
its(:script) { should eq ["RAILS_ENV=test ls -1 && echo DONE!"] }
|
12
13
|
|
@@ -28,6 +29,7 @@ describe Vx::Builder::Source do
|
|
28
29
|
context "build new instance" do
|
29
30
|
let(:expected) { {
|
30
31
|
"rvm" => ["2.0.0"],
|
32
|
+
"gemfile" => ["Gemfile"],
|
31
33
|
"before_script" => ["echo before_script"],
|
32
34
|
"before_install" => ["echo before_install"],
|
33
35
|
"script" => ["RAILS_ENV=test ls -1 && echo DONE!"],
|
@@ -50,6 +52,7 @@ describe Vx::Builder::Source do
|
|
50
52
|
context "from_attributes" do
|
51
53
|
let(:attrs) {{
|
52
54
|
rvm: "2.0.0",
|
55
|
+
gemfile: "Gemfile",
|
53
56
|
before_script: "echo before_script",
|
54
57
|
before_install: "echo before_install",
|
55
58
|
script: "RAILS_ENV=test ls -1 && echo DONE!"
|
@@ -67,27 +70,27 @@ describe Vx::Builder::Source do
|
|
67
70
|
|
68
71
|
context "to_matrix_s" do
|
69
72
|
subject { config.to_matrix_s }
|
70
|
-
it { should eq 'rvm:2.0.0' }
|
73
|
+
it { should eq 'gemfile:Gemfile, rvm:2.0.0' }
|
71
74
|
|
72
75
|
context "when many items" do
|
73
76
|
before do
|
74
77
|
mock(config).rvm { %w{ 1.9.3 2.0.0 } }
|
75
78
|
mock(config).scala { %w{ 2.10.1 } }
|
76
79
|
end
|
77
|
-
it { should eq "rvm:1.9.3, scala:2.10.1" }
|
80
|
+
it { should eq "gemfile:Gemfile, rvm:1.9.3, scala:2.10.1" }
|
78
81
|
end
|
79
82
|
end
|
80
83
|
|
81
84
|
context "matrix_keys" do
|
82
85
|
subject { config.matrix_keys }
|
83
|
-
it { should eq("rvm" => "2.0.0") }
|
86
|
+
it { should eq("rvm" => "2.0.0", "gemfile" => "Gemfile") }
|
84
87
|
|
85
88
|
context "when many items" do
|
86
89
|
before do
|
87
90
|
mock(config).rvm { %w{ 1.9.3 2.0.0 } }
|
88
91
|
mock(config).scala { %w{ 2.10.1 } }
|
89
92
|
end
|
90
|
-
it { should eq({"rvm"=>"1.9.3", "scala"=>"2.10.1"}) }
|
93
|
+
it { should eq({"rvm"=>"1.9.3", "scala"=>"2.10.1", "gemfile" => "Gemfile"}) }
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
data/spec/support/create.rb
CHANGED
@@ -20,9 +20,16 @@ def create(name, options = {})
|
|
20
20
|
|
21
21
|
when :env
|
22
22
|
OpenStruct.new(
|
23
|
-
init:
|
24
|
-
|
25
|
-
|
23
|
+
init: [],
|
24
|
+
before_install: [],
|
25
|
+
install: [],
|
26
|
+
announce: [],
|
27
|
+
before_script: [],
|
28
|
+
script: [],
|
29
|
+
after_script: [],
|
30
|
+
source: create(:source),
|
31
|
+
task: create(:task),
|
32
|
+
cache_key: []
|
26
33
|
)
|
27
34
|
|
28
35
|
when :command_from_env
|
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.0.
|
4
|
+
version: 0.0.11
|
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-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vx-common
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- spec/lib/builder/configuration_spec.rb
|
147
147
|
- spec/lib/builder/script/env_spec.rb
|
148
148
|
- spec/lib/builder/script/prepare_spec.rb
|
149
|
+
- spec/lib/builder/script/ruby_spec.rb
|
149
150
|
- spec/lib/builder/script_spec.rb
|
150
151
|
- spec/lib/builder/source_matrix_spec.rb
|
151
152
|
- spec/lib/builder/source_spec.rb
|
@@ -186,6 +187,7 @@ test_files:
|
|
186
187
|
- spec/lib/builder/configuration_spec.rb
|
187
188
|
- spec/lib/builder/script/env_spec.rb
|
188
189
|
- spec/lib/builder/script/prepare_spec.rb
|
190
|
+
- spec/lib/builder/script/ruby_spec.rb
|
189
191
|
- spec/lib/builder/script_spec.rb
|
190
192
|
- spec/lib/builder/source_matrix_spec.rb
|
191
193
|
- spec/lib/builder/source_spec.rb
|