vx-builder 0.0.18 → 0.0.19
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/script.rb +4 -0
- data/lib/vx/builder/script/env.rb +2 -0
- data/lib/vx/builder/script/java.rb +31 -0
- data/lib/vx/builder/script/ruby.rb +5 -1
- data/lib/vx/builder/script/scala.rb +48 -0
- data/lib/vx/builder/source/constants.rb +1 -1
- data/lib/vx/builder/version.rb +1 -1
- data/spec/fixtures/scala.yml +10 -0
- data/spec/lib/builder/script/java_spec.rb +23 -0
- data/spec/lib/builder/script/ruby_spec.rb +9 -2
- data/spec/lib/builder/script/scala_spec.rb +33 -0
- data/spec/support/create.rb +3 -2
- metadata +9 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc388974f9a96b875a54aa696fd8355ecb33c0e7
|
4
|
+
data.tar.gz: aa0518b528ee2928db46e43ccda9c50011572cba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea105c4c7af16bc0e6c12bcea6a259274120c059ed0565ed70bf12e06746f090c0865622a5a4cb80769bcb80531f08d52b68f4da2ba9fc67fe3ebd81387f21ed
|
7
|
+
data.tar.gz: c8aec854e833d2957f0e18b6f63640b9d0ad1b62c3c4ff074a3af25c0373fb8e7a9b5aa26119b4cd9aa523063650e26950c45599f423bfd36fe58a8350cdde84
|
data/lib/vx/builder/script.rb
CHANGED
@@ -6,6 +6,8 @@ module Vx
|
|
6
6
|
|
7
7
|
autoload :Env, File.expand_path("../script/env", __FILE__)
|
8
8
|
autoload :Ruby, File.expand_path("../script/ruby", __FILE__)
|
9
|
+
autoload :Java, File.expand_path("../script/java", __FILE__)
|
10
|
+
autoload :Scala, File.expand_path("../script/scala", __FILE__)
|
9
11
|
autoload :Script, File.expand_path("../script/script", __FILE__)
|
10
12
|
autoload :Prepare, File.expand_path("../script/prepare", __FILE__)
|
11
13
|
autoload :Databases, File.expand_path("../script/databases", __FILE__)
|
@@ -19,6 +21,8 @@ module Vx
|
|
19
21
|
use Builder::Script::Services
|
20
22
|
use Builder::Script::Env
|
21
23
|
use Builder::Script::Prepare
|
24
|
+
use Builder::Script::Java
|
25
|
+
use Builder::Script::Scala
|
22
26
|
use Builder::Script::Ruby
|
23
27
|
use Builder::Script::Script
|
24
28
|
end
|
@@ -8,7 +8,9 @@ module Vx
|
|
8
8
|
|
9
9
|
def call(env)
|
10
10
|
env.init << "set -e"
|
11
|
+
env.init << "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
11
12
|
env.init << 'export LC_ALL=en_US.UTF8'
|
13
|
+
env.init << "source /etc/profile.d/*.sh"
|
12
14
|
env.source.global_env.each do |e|
|
13
15
|
env.init << trace_sh_command("export #{e}")
|
14
16
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Vx
|
2
|
+
module Builder
|
3
|
+
class Script
|
4
|
+
|
5
|
+
Java = Struct.new(:app) do
|
6
|
+
|
7
|
+
include Helper::TraceShCommand
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
if java(env)
|
11
|
+
env.cache_key << "jdk-#{java env}"
|
12
|
+
|
13
|
+
env.before_install.tap do |i|
|
14
|
+
i << "source $(which jdk_switcher.sh)"
|
15
|
+
i << trace_sh_command("jdk_switcher use #{java env}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
app.call(env)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def java(env)
|
25
|
+
env.source.jdk.first
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -14,7 +14,6 @@ module Vx
|
|
14
14
|
env.cache_key << gemfile(env)
|
15
15
|
|
16
16
|
env.before_install.tap do |i|
|
17
|
-
i << "source /etc/profile.d/rbenv.sh"
|
18
17
|
i << 'eval "$(rbenv init -)" || true'
|
19
18
|
i << "rbenv shell #{make_rbenv_version_command env}"
|
20
19
|
i << trace_sh_command("export BUNDLE_GEMFILE=${PWD}/#{gemfile(env)}")
|
@@ -32,6 +31,11 @@ module Vx
|
|
32
31
|
i << trace_sh_command("bundle clean --force")
|
33
32
|
end
|
34
33
|
|
34
|
+
if env.source.script.empty?
|
35
|
+
script = "test -f Rakefile && #{trace_sh_command "bundle exec rake"} || true"
|
36
|
+
env.script << script
|
37
|
+
end
|
38
|
+
|
35
39
|
if env.source.cached_directories != false
|
36
40
|
env.cached_directories.push "~/.rubygems"
|
37
41
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Vx
|
2
|
+
module Builder
|
3
|
+
class Script
|
4
|
+
|
5
|
+
Scala = Struct.new(:app) do
|
6
|
+
|
7
|
+
include Helper::TraceShCommand
|
8
|
+
|
9
|
+
DEFAULT_SCALA = '2.10.3'
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
if enabled?(env)
|
13
|
+
env.cache_key << "scala-#{scala env}"
|
14
|
+
|
15
|
+
env.announce.tap do |i|
|
16
|
+
i << "echo Using scala #{scala env}"
|
17
|
+
end
|
18
|
+
|
19
|
+
if env.source.script.empty?
|
20
|
+
env.script.tap do |i|
|
21
|
+
i << "if [[ -d project || -f build.sbt ]] ; then #{trace_sh_command "sbt ++#{scala env} test"} ; fi"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
if env.source.cached_directories != false
|
26
|
+
env.cached_directories.push "~/.sbt"
|
27
|
+
env.cached_directories.push "~/.ivy2"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
app.call(env)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def enabled?(env)
|
37
|
+
env.source.scala.first || env.language == 'scala'
|
38
|
+
end
|
39
|
+
|
40
|
+
def scala(env)
|
41
|
+
env.source.scala.first || DEFAULT_SCALA
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/vx/builder/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vx::Builder::Script::Java do
|
4
|
+
let(:app) { ->(env) { env } }
|
5
|
+
let(:script) { described_class.new app }
|
6
|
+
let(:source) { create :source, name: "scala.yml" }
|
7
|
+
let(:env) { create :env, source: source }
|
8
|
+
let(:run) { script.call env }
|
9
|
+
subject { run }
|
10
|
+
|
11
|
+
it { should eq env }
|
12
|
+
|
13
|
+
context "run it" do
|
14
|
+
subject { env }
|
15
|
+
|
16
|
+
context "should be success" do
|
17
|
+
before { run }
|
18
|
+
its(:before_install) { should_not be_empty }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -13,15 +13,22 @@ describe Vx::Builder::Script::Ruby do
|
|
13
13
|
let(:command) { create :command_from_env, env: env }
|
14
14
|
subject { env }
|
15
15
|
|
16
|
-
before { run }
|
17
|
-
|
18
16
|
context "should be success" do
|
17
|
+
before { run }
|
19
18
|
its(:before_install) { should_not be_empty }
|
20
19
|
its(:announce) { should_not be_empty }
|
21
20
|
its(:install) { should_not be_empty }
|
22
21
|
its(:cached_directories) { should eq %w{ ~/.rubygems } }
|
23
22
|
end
|
24
23
|
|
24
|
+
context "when script is empty" do
|
25
|
+
before do
|
26
|
+
env.source.script.clear
|
27
|
+
run
|
28
|
+
end
|
29
|
+
its(:script) { should_not be_empty }
|
30
|
+
end
|
31
|
+
|
25
32
|
|
26
33
|
end
|
27
34
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vx::Builder::Script::Scala do
|
4
|
+
let(:app) { ->(env) { env } }
|
5
|
+
let(:script) { described_class.new app }
|
6
|
+
let(:source) { create :source, name: "scala.yml" }
|
7
|
+
let(:env) { create :env, source: source }
|
8
|
+
let(:run) { script.call env }
|
9
|
+
subject { run }
|
10
|
+
|
11
|
+
it { should eq env }
|
12
|
+
|
13
|
+
context "run it" do
|
14
|
+
subject { env }
|
15
|
+
|
16
|
+
context "should be success" do
|
17
|
+
before { run }
|
18
|
+
its(:announce) { should_not be_empty }
|
19
|
+
its(:cached_directories) { should eq %w{ ~/.sbt ~/.ivy2 } }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when script is empty" do
|
23
|
+
before do
|
24
|
+
env.source.script.clear
|
25
|
+
run
|
26
|
+
end
|
27
|
+
its(:script) { should_not be_empty }
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/support/create.rb
CHANGED
@@ -17,7 +17,8 @@ def create(name, options = {})
|
|
17
17
|
)
|
18
18
|
|
19
19
|
when :source
|
20
|
-
|
20
|
+
name = options[:name] || "travis.yml"
|
21
|
+
Vx::Builder::Source.from_yaml(fixture(name))
|
21
22
|
|
22
23
|
when :env
|
23
24
|
OpenStruct.new(
|
@@ -28,7 +29,7 @@ def create(name, options = {})
|
|
28
29
|
before_script: [],
|
29
30
|
script: [],
|
30
31
|
after_script: [],
|
31
|
-
source: create(:source),
|
32
|
+
source: options[:source] || create(:source),
|
32
33
|
task: create(:task),
|
33
34
|
cache_key: [],
|
34
35
|
cached_directories: []
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
@@ -129,8 +129,10 @@ files:
|
|
129
129
|
- lib/vx/builder/script.rb
|
130
130
|
- lib/vx/builder/script/cache.rb
|
131
131
|
- lib/vx/builder/script/env.rb
|
132
|
+
- lib/vx/builder/script/java.rb
|
132
133
|
- lib/vx/builder/script/prepare.rb
|
133
134
|
- lib/vx/builder/script/ruby.rb
|
135
|
+
- lib/vx/builder/script/scala.rb
|
134
136
|
- lib/vx/builder/script/script.rb
|
135
137
|
- lib/vx/builder/script/services.rb
|
136
138
|
- lib/vx/builder/source.rb
|
@@ -139,14 +141,17 @@ files:
|
|
139
141
|
- lib/vx/builder/source/serializable.rb
|
140
142
|
- lib/vx/builder/task.rb
|
141
143
|
- lib/vx/builder/version.rb
|
144
|
+
- spec/fixtures/scala.yml
|
142
145
|
- spec/fixtures/travis.yml
|
143
146
|
- spec/fixtures/travis_bug_1.yml
|
144
147
|
- spec/fixtures/travis_bug_2.yml
|
145
148
|
- spec/lib/builder/configuration_spec.rb
|
146
149
|
- spec/lib/builder/script/cache_spec.rb
|
147
150
|
- spec/lib/builder/script/env_spec.rb
|
151
|
+
- spec/lib/builder/script/java_spec.rb
|
148
152
|
- spec/lib/builder/script/prepare_spec.rb
|
149
153
|
- spec/lib/builder/script/ruby_spec.rb
|
154
|
+
- spec/lib/builder/script/scala_spec.rb
|
150
155
|
- spec/lib/builder/script_spec.rb
|
151
156
|
- spec/lib/builder/source_matrix_spec.rb
|
152
157
|
- spec/lib/builder/source_spec.rb
|
@@ -181,14 +186,17 @@ signing_key:
|
|
181
186
|
specification_version: 4
|
182
187
|
summary: Write a gem summary
|
183
188
|
test_files:
|
189
|
+
- spec/fixtures/scala.yml
|
184
190
|
- spec/fixtures/travis.yml
|
185
191
|
- spec/fixtures/travis_bug_1.yml
|
186
192
|
- spec/fixtures/travis_bug_2.yml
|
187
193
|
- spec/lib/builder/configuration_spec.rb
|
188
194
|
- spec/lib/builder/script/cache_spec.rb
|
189
195
|
- spec/lib/builder/script/env_spec.rb
|
196
|
+
- spec/lib/builder/script/java_spec.rb
|
190
197
|
- spec/lib/builder/script/prepare_spec.rb
|
191
198
|
- spec/lib/builder/script/ruby_spec.rb
|
199
|
+
- spec/lib/builder/script/scala_spec.rb
|
192
200
|
- spec/lib/builder/script_spec.rb
|
193
201
|
- spec/lib/builder/source_matrix_spec.rb
|
194
202
|
- spec/lib/builder/source_spec.rb
|