vx-builder 0.5.15 → 0.5.16
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/bin/vx_ruby_auto_build +116 -0
- data/lib/vx/builder/build_configuration.rb +7 -0
- data/lib/vx/builder/matrix_builder.rb +22 -12
- data/lib/vx/builder/script_builder/base.rb +4 -0
- data/lib/vx/builder/script_builder/ruby.rb +27 -4
- data/lib/vx/builder/version.rb +1 -1
- data/spec/fixtures/integration/ruby/deploy/after_script.sh +1 -1
- data/spec/fixtures/integration/ruby/deploy/before_script.sh +9 -7
- data/spec/fixtures/integration/ruby/language/after_script.sh +1 -1
- data/spec/fixtures/integration/ruby/language/before_script.sh +9 -7
- data/spec/fixtures/integration/ruby/matrix/0.before_script.sh +6 -4
- data/spec/fixtures/integration/ruby/matrix/1.before_script.sh +6 -4
- data/spec/fixtures/integration/ruby/matrix/d.before_script.sh +6 -4
- data/spec/integration/ruby_spec.rb +57 -1
- data/spec/lib/builder/build_configuration_spec.rb +20 -12
- data/spec/lib/builder/matrix_builder_spec.rb +7 -0
- 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: 9ba37c5a2d8c7a7adfffd046b94b2ab44a46729c
|
4
|
+
data.tar.gz: 9409c682c87c19126e6bc0cc77bc93c8a3b9b96d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af7d18ba9cdee91192b8a5958f9fa9fd0bda24e95c4ff9a302b8cfc7f8d759720f029490d1c2e2bc010f0ad68349ff4e69105535b2700c126c345090b8f4579f
|
7
|
+
data.tar.gz: e7b6443d23fd0677bfb2b897e1677831cec116b20e758e1bb1b3024e39724b7fffa8343ef9901ab2159b05979aa81e4d18d59368604e57ec03ad892872e46ed9
|
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
notice () {
|
6
|
+
echo "$@"
|
7
|
+
}
|
8
|
+
|
9
|
+
ruby_detect () {
|
10
|
+
(
|
11
|
+
test -f Gemfile && test -f Rakefile
|
12
|
+
) && (
|
13
|
+
notice "found ruby project"
|
14
|
+
)
|
15
|
+
}
|
16
|
+
|
17
|
+
rails_detect () {
|
18
|
+
test -f Gemfile && cat Gemfile | grep gem | grep -q rails
|
19
|
+
}
|
20
|
+
|
21
|
+
rails_gen_database_spec_for_pg () {
|
22
|
+
bundle show pg > /dev/null && (
|
23
|
+
notice 'create config/database.yml for postgresql'
|
24
|
+
cat > config/database.yml <<EOL
|
25
|
+
test:
|
26
|
+
adapter: postgresql
|
27
|
+
encoding: unicode
|
28
|
+
database: rails_test
|
29
|
+
username: postgres
|
30
|
+
host: localhost
|
31
|
+
EOL
|
32
|
+
)
|
33
|
+
}
|
34
|
+
|
35
|
+
rails_gen_database_spec_for_mysql () {
|
36
|
+
bundle show mysql2 > /dev/null && (
|
37
|
+
notice 'create config/database.yml for mysql'
|
38
|
+
cat > config/database.yml <<EOL
|
39
|
+
test:
|
40
|
+
adapter: mysql2
|
41
|
+
encoding: utf8
|
42
|
+
database: rails_test
|
43
|
+
username: root
|
44
|
+
host: localhost
|
45
|
+
EOL
|
46
|
+
)
|
47
|
+
}
|
48
|
+
|
49
|
+
rails_db_create () {
|
50
|
+
echo $ bundle exec rake db:create
|
51
|
+
bundle exec rake db:create
|
52
|
+
|
53
|
+
(
|
54
|
+
test -f db/schema.rb && (
|
55
|
+
echo $ bundle exec rake db:schema:load
|
56
|
+
bundle exec rake db:schema:load
|
57
|
+
)
|
58
|
+
) || (
|
59
|
+
test -d db/migrate && (
|
60
|
+
echo $ bundle exec rake db:migrate
|
61
|
+
bundle exec rake db:migrate
|
62
|
+
)
|
63
|
+
)
|
64
|
+
}
|
65
|
+
|
66
|
+
rails_setup_database () {
|
67
|
+
rails_detect && (
|
68
|
+
(
|
69
|
+
rails_gen_database_spec_for_pg ||
|
70
|
+
rails_gen_database_spec_for_mysql
|
71
|
+
) &&
|
72
|
+
rails_db_create
|
73
|
+
)
|
74
|
+
}
|
75
|
+
|
76
|
+
ruby_setup_env () {
|
77
|
+
echo $ export RAILS_ENV=test
|
78
|
+
export RAILS_ENV=test
|
79
|
+
|
80
|
+
echo $ export RACK_ENV=test
|
81
|
+
export RACK_ENV=test
|
82
|
+
|
83
|
+
echo $ export GEM_HOME=~/.rubygems
|
84
|
+
export GEM_HOME=~/.rubygems
|
85
|
+
|
86
|
+
test -f Gemfile && (
|
87
|
+
echo $ 'export BUNDLE_GEMFILE=${PWD}/Gemfile'
|
88
|
+
export BUNDLE_GEMFILE=${PWD}/Gemfile
|
89
|
+
)
|
90
|
+
}
|
91
|
+
|
92
|
+
bundle_install () {
|
93
|
+
test -f Gemfile && (
|
94
|
+
notice '$ bundle install --retry=3 --jobs=4 --clean'
|
95
|
+
bundle install --retry=3 --jobs=4 --clean
|
96
|
+
)
|
97
|
+
}
|
98
|
+
|
99
|
+
run_rake_default () {
|
100
|
+
echo $ bundle exec rake
|
101
|
+
bundle exec rake
|
102
|
+
}
|
103
|
+
|
104
|
+
ruby_build () {
|
105
|
+
notice 'build ruby project'
|
106
|
+
|
107
|
+
ruby_setup_env &&
|
108
|
+
bundle_install &&
|
109
|
+
( rails_setup_database || true ) &&
|
110
|
+
run_rake_default
|
111
|
+
}
|
112
|
+
|
113
|
+
ruby_detect || exit 1
|
114
|
+
ruby_build || (
|
115
|
+
exit $?
|
116
|
+
)
|
@@ -66,6 +66,7 @@ module Vx
|
|
66
66
|
def initialize(new_attributes = {}, matrix_attributes = {})
|
67
67
|
new_attributes = {} unless new_attributes.is_a?(Hash)
|
68
68
|
|
69
|
+
@is_empty = new_attributes == {}
|
69
70
|
@env = Env.new new_attributes.delete("env")
|
70
71
|
@cache = Cache.new new_attributes.delete("cache")
|
71
72
|
@vexor = Vexor.new new_attributes.delete("vexor")
|
@@ -87,6 +88,12 @@ module Vx
|
|
87
88
|
build_attributes new_attributes
|
88
89
|
end
|
89
90
|
|
91
|
+
# nil or empty configuration file
|
92
|
+
def empty?
|
93
|
+
@is_empty
|
94
|
+
end
|
95
|
+
|
96
|
+
# have any required attributes
|
90
97
|
def any?
|
91
98
|
REQUIRED_KEYS.any? do |key|
|
92
99
|
attributes[key].any?
|
@@ -21,19 +21,21 @@ module Vx
|
|
21
21
|
|
22
22
|
def build
|
23
23
|
@build ||= begin
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
if_empty do
|
25
|
+
new_attributes = build_configuration.to_hash.dup
|
26
|
+
build_configurations = attributes_for_new_build_configurations_with_parallel.map do |matrix_attributes|
|
27
|
+
BuildConfiguration.new(
|
28
|
+
new_attributes.merge(matrix_attributes),
|
29
|
+
matrix_attributes
|
30
|
+
)
|
31
|
+
end
|
32
|
+
filter_required_keys(
|
33
|
+
filter_exclude(
|
34
|
+
build_configuration.matrix.exclude,
|
35
|
+
build_configurations
|
36
|
+
)
|
29
37
|
)
|
30
38
|
end
|
31
|
-
filter_not_empty(
|
32
|
-
filter_exclude(
|
33
|
-
build_configuration.matrix.exclude,
|
34
|
-
build_configurations
|
35
|
-
)
|
36
|
-
)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
@@ -111,7 +113,15 @@ module Vx
|
|
111
113
|
|
112
114
|
private
|
113
115
|
|
114
|
-
def
|
116
|
+
def if_empty
|
117
|
+
if build_configuration.empty?
|
118
|
+
[build_configuration]
|
119
|
+
else
|
120
|
+
yield
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def filter_required_keys(configurations)
|
115
125
|
configurations.select{|c| c.any? }
|
116
126
|
end
|
117
127
|
|
@@ -4,7 +4,8 @@ module Vx
|
|
4
4
|
|
5
5
|
class Ruby < Base
|
6
6
|
|
7
|
-
DEFAULT_RUBY = '
|
7
|
+
DEFAULT_RUBY = '2.0.0'
|
8
|
+
DEFAULT_BUNDLE_INSTALL_ARGS = "--clean --retry=3 --jobs=4"
|
8
9
|
|
9
10
|
ALIASES = {
|
10
11
|
'jruby-19mode' => 'jruby'
|
@@ -12,7 +13,6 @@ module Vx
|
|
12
13
|
|
13
14
|
def call(env)
|
14
15
|
if enabled?(env)
|
15
|
-
|
16
16
|
vxvm_install(env, 'ruby', ruby_version(env))
|
17
17
|
|
18
18
|
do_cache_key(env) do |i|
|
@@ -21,6 +21,8 @@ module Vx
|
|
21
21
|
end
|
22
22
|
|
23
23
|
do_before_install(env) do |i|
|
24
|
+
i << trace_sh_command("export RAILS_ENV=test")
|
25
|
+
i << trace_sh_command("export RACK_ENV=test")
|
24
26
|
i << trace_sh_command("export BUNDLE_GEMFILE=${PWD}/#{gemfile(env)}")
|
25
27
|
i << trace_sh_command('export GEM_HOME=~/.rubygems')
|
26
28
|
end
|
@@ -32,9 +34,8 @@ module Vx
|
|
32
34
|
end
|
33
35
|
|
34
36
|
do_install(env) do |i|
|
35
|
-
bundler_args = env.source.bundler_args.first
|
37
|
+
bundler_args = env.source.bundler_args.first || DEFAULT_BUNDLE_INSTALL_ARGS
|
36
38
|
i << trace_sh_command("bundle install #{bundler_args}")
|
37
|
-
i << trace_sh_command("bundle clean --force")
|
38
39
|
end
|
39
40
|
|
40
41
|
do_script(env) do |i|
|
@@ -47,11 +48,33 @@ module Vx
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
51
|
+
if auto_build?(env)
|
52
|
+
vxvm_install(env, 'ruby', DEFAULT_RUBY)
|
53
|
+
|
54
|
+
do_init(env) do |i|
|
55
|
+
src = File.read(File.expand_path("../../../../../bin/vx_ruby_auto_build", __FILE__))
|
56
|
+
i << upload_sh_command("~/vx_ruby_auto_build", src)
|
57
|
+
i << "sudo chmod 0755 ~/vx_ruby_auto_build"
|
58
|
+
end
|
59
|
+
|
60
|
+
do_script(env) do |i|
|
61
|
+
i << "~/vx_ruby_auto_build"
|
62
|
+
end
|
63
|
+
|
64
|
+
do_cached_directories(env) do |i|
|
65
|
+
i << "~/.rubygems"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
50
69
|
app.call(env)
|
51
70
|
end
|
52
71
|
|
53
72
|
private
|
54
73
|
|
74
|
+
def auto_build?(env)
|
75
|
+
env.source.empty?
|
76
|
+
end
|
77
|
+
|
55
78
|
def enabled?(env)
|
56
79
|
env.source.rvm.first || env.source.language == 'ruby'
|
57
80
|
end
|
data/lib/vx/builder/version.rb
CHANGED
@@ -13,4 +13,4 @@ test -d ${VX_ROOT}/code/vexor/vx-test-repo || exit 1
|
|
13
13
|
cd ${VX_ROOT}/code/vexor/vx-test-repo
|
14
14
|
|
15
15
|
# after script
|
16
|
-
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher push http://example.com/test/pull-request/rvm-
|
16
|
+
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher push http://example.com/test/pull-request/rvm-2.0.0-gemfile.tgz
|
@@ -44,14 +44,18 @@ echo "download latest version of vxvm"
|
|
44
44
|
curl --tcp-nodelay --retry 3 --fail --silent --show-error -o $VX_ROOT/bin/vxvm https://raw.githubusercontent.com/vexor/vx-packages/master/vxvm
|
45
45
|
chmod +x $VX_ROOT/bin/vxvm
|
46
46
|
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
|
47
|
-
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher fetch http://example.com/test/pull-request/rvm-
|
47
|
+
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher fetch http://example.com/test/pull-request/rvm-2.0.0-gemfile.tgz http://example.com/master/rvm-2.0.0-gemfile.tgz || true
|
48
48
|
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher add ~/.rubygems || true
|
49
49
|
unset CASHER_DIR
|
50
50
|
|
51
51
|
# before install
|
52
|
-
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\
|
53
|
-
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby
|
52
|
+
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\ 2.0.0
|
53
|
+
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby 2.0.0)"
|
54
54
|
source "$VX_VM_SOURCE"
|
55
|
+
echo \$\ export\ RAILS_ENV\=test
|
56
|
+
export RAILS_ENV=test
|
57
|
+
echo \$\ export\ RACK_ENV\=test
|
58
|
+
export RACK_ENV=test
|
55
59
|
echo \$\ export\ BUNDLE_GEMFILE\=\$\{PWD\}/Gemfile
|
56
60
|
export BUNDLE_GEMFILE=${PWD}/Gemfile
|
57
61
|
echo \$\ export\ GEM_HOME\=\~/.rubygems
|
@@ -66,9 +70,7 @@ echo \$\ bundle\ --version
|
|
66
70
|
bundle --version
|
67
71
|
|
68
72
|
# install
|
69
|
-
echo \$\ bundle\ install\
|
70
|
-
bundle install
|
71
|
-
echo \$\ bundle\ clean\ --force
|
72
|
-
bundle clean --force
|
73
|
+
echo \$\ bundle\ install\ --clean\ --retry\=3\ --jobs\=4
|
74
|
+
bundle install --clean --retry=3 --jobs=4
|
73
75
|
|
74
76
|
# before script
|
@@ -13,4 +13,4 @@ test -d ${VX_ROOT}/code/vexor/vx-test-repo || exit 1
|
|
13
13
|
cd ${VX_ROOT}/code/vexor/vx-test-repo
|
14
14
|
|
15
15
|
# after script
|
16
|
-
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher push http://example.com/test/pull-request/rvm-
|
16
|
+
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher push http://example.com/test/pull-request/rvm-2.0.0-gemfile.tgz
|
@@ -40,14 +40,18 @@ echo "download latest version of vxvm"
|
|
40
40
|
curl --tcp-nodelay --retry 3 --fail --silent --show-error -o $VX_ROOT/bin/vxvm https://raw.githubusercontent.com/vexor/vx-packages/master/vxvm
|
41
41
|
chmod +x $VX_ROOT/bin/vxvm
|
42
42
|
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
|
43
|
-
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher fetch http://example.com/test/pull-request/rvm-
|
43
|
+
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher fetch http://example.com/test/pull-request/rvm-2.0.0-gemfile.tgz http://example.com/master/rvm-2.0.0-gemfile.tgz || true
|
44
44
|
test -f $HOME/.casher/bin/casher && casher-ruby $HOME/.casher/bin/casher add ~/.rubygems || true
|
45
45
|
unset CASHER_DIR
|
46
46
|
|
47
47
|
# before install
|
48
|
-
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\
|
49
|
-
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby
|
48
|
+
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\ 2.0.0
|
49
|
+
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby 2.0.0)"
|
50
50
|
source "$VX_VM_SOURCE"
|
51
|
+
echo \$\ export\ RAILS_ENV\=test
|
52
|
+
export RAILS_ENV=test
|
53
|
+
echo \$\ export\ RACK_ENV\=test
|
54
|
+
export RACK_ENV=test
|
51
55
|
echo \$\ export\ BUNDLE_GEMFILE\=\$\{PWD\}/Gemfile
|
52
56
|
export BUNDLE_GEMFILE=${PWD}/Gemfile
|
53
57
|
echo \$\ export\ GEM_HOME\=\~/.rubygems
|
@@ -62,9 +66,7 @@ echo \$\ bundle\ --version
|
|
62
66
|
bundle --version
|
63
67
|
|
64
68
|
# install
|
65
|
-
echo \$\ bundle\ install\
|
66
|
-
bundle install
|
67
|
-
echo \$\ bundle\ clean\ --force
|
68
|
-
bundle clean --force
|
69
|
+
echo \$\ bundle\ install\ --clean\ --retry\=3\ --jobs\=4
|
70
|
+
bundle install --clean --retry=3 --jobs=4
|
69
71
|
|
70
72
|
# before script
|
@@ -48,6 +48,10 @@ unset CASHER_DIR
|
|
48
48
|
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\ 1.9.3
|
49
49
|
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby 1.9.3)"
|
50
50
|
source "$VX_VM_SOURCE"
|
51
|
+
echo \$\ export\ RAILS_ENV\=test
|
52
|
+
export RAILS_ENV=test
|
53
|
+
echo \$\ export\ RACK_ENV\=test
|
54
|
+
export RACK_ENV=test
|
51
55
|
echo \$\ export\ BUNDLE_GEMFILE\=\$\{PWD\}/Gemfile
|
52
56
|
export BUNDLE_GEMFILE=${PWD}/Gemfile
|
53
57
|
echo \$\ export\ GEM_HOME\=\~/.rubygems
|
@@ -62,10 +66,8 @@ echo \$\ bundle\ --version
|
|
62
66
|
bundle --version
|
63
67
|
|
64
68
|
# install
|
65
|
-
echo \$\ bundle\ install\
|
66
|
-
bundle install
|
67
|
-
echo \$\ bundle\ clean\ --force
|
68
|
-
bundle clean --force
|
69
|
+
echo \$\ bundle\ install\ --clean\ --retry\=3\ --jobs\=4
|
70
|
+
bundle install --clean --retry=3 --jobs=4
|
69
71
|
|
70
72
|
# before script
|
71
73
|
echo \$\ echo\ before\ script
|
@@ -48,6 +48,10 @@ unset CASHER_DIR
|
|
48
48
|
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\ 2.0.0
|
49
49
|
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby 2.0.0)"
|
50
50
|
source "$VX_VM_SOURCE"
|
51
|
+
echo \$\ export\ RAILS_ENV\=test
|
52
|
+
export RAILS_ENV=test
|
53
|
+
echo \$\ export\ RACK_ENV\=test
|
54
|
+
export RACK_ENV=test
|
51
55
|
echo \$\ export\ BUNDLE_GEMFILE\=\$\{PWD\}/Gemfile
|
52
56
|
export BUNDLE_GEMFILE=${PWD}/Gemfile
|
53
57
|
echo \$\ export\ GEM_HOME\=\~/.rubygems
|
@@ -62,10 +66,8 @@ echo \$\ bundle\ --version
|
|
62
66
|
bundle --version
|
63
67
|
|
64
68
|
# install
|
65
|
-
echo \$\ bundle\ install\
|
66
|
-
bundle install
|
67
|
-
echo \$\ bundle\ clean\ --force
|
68
|
-
bundle clean --force
|
69
|
+
echo \$\ bundle\ install\ --clean\ --retry\=3\ --jobs\=4
|
70
|
+
bundle install --clean --retry=3 --jobs=4
|
69
71
|
|
70
72
|
# before script
|
71
73
|
echo \$\ echo\ before\ script
|
@@ -49,6 +49,10 @@ unset CASHER_DIR
|
|
49
49
|
echo \$\ sudo\ env\ PATH\=\$PATH\ vxvm\ install\ ruby\ 1.9.3
|
50
50
|
VX_VM_SOURCE="$(sudo env PATH=$PATH vxvm install ruby 1.9.3)"
|
51
51
|
source "$VX_VM_SOURCE"
|
52
|
+
echo \$\ export\ RAILS_ENV\=test
|
53
|
+
export RAILS_ENV=test
|
54
|
+
echo \$\ export\ RACK_ENV\=test
|
55
|
+
export RACK_ENV=test
|
52
56
|
echo \$\ export\ BUNDLE_GEMFILE\=\$\{PWD\}/Gemfile
|
53
57
|
export BUNDLE_GEMFILE=${PWD}/Gemfile
|
54
58
|
echo \$\ export\ GEM_HOME\=\~/.rubygems
|
@@ -63,9 +67,7 @@ echo \$\ bundle\ --version
|
|
63
67
|
bundle --version
|
64
68
|
|
65
69
|
# install
|
66
|
-
echo \$\ bundle\ install\
|
67
|
-
bundle install
|
68
|
-
echo \$\ bundle\ clean\ --force
|
69
|
-
bundle clean --force
|
70
|
+
echo \$\ bundle\ install\ --clean\ --retry\=3\ --jobs\=4
|
71
|
+
bundle install --clean --retry=3 --jobs=4
|
70
72
|
|
71
73
|
# before script
|
@@ -28,7 +28,7 @@ describe "(integration) ruby" do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def build(file, options = {})
|
31
|
-
config = Vx::Builder::BuildConfiguration.from_yaml(file)
|
31
|
+
config = file ? Vx::Builder::BuildConfiguration.from_yaml(file) : Vx::Builder::BuildConfiguration.new(nil)
|
32
32
|
matrix = Vx::Builder.matrix config
|
33
33
|
options[:task] ||= create(:task)
|
34
34
|
rs = OpenStruct.new matrix: matrix, scripts: []
|
@@ -135,4 +135,60 @@ describe "(integration) ruby" do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
it "should succesfuly run lang/ruby with auto build", real: true do
|
139
|
+
task = create(
|
140
|
+
:task,
|
141
|
+
sha: "HEAD",
|
142
|
+
branch: "lang/ruby"
|
143
|
+
)
|
144
|
+
|
145
|
+
b = build(nil, task: task)
|
146
|
+
Dir.chdir(path) do
|
147
|
+
File.open("script.sh", "w") do |io|
|
148
|
+
io.write "set -e\n"
|
149
|
+
io.write b.scripts[0].to_before_script
|
150
|
+
io.write b.scripts[0].to_script
|
151
|
+
end
|
152
|
+
system("env", "-", "USER=$USER", "HOME=#{path}", "bash", "script.sh" )
|
153
|
+
expect($?.to_i).to eq 0
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should succesfuly run lang/ruby-rails-pg with auto build", real: true do
|
158
|
+
task = create(
|
159
|
+
:task,
|
160
|
+
sha: "HEAD",
|
161
|
+
branch: "lang/ruby-rails-pg"
|
162
|
+
)
|
163
|
+
|
164
|
+
b = build(nil, task: task)
|
165
|
+
Dir.chdir(path) do
|
166
|
+
File.open("script.sh", "w") do |io|
|
167
|
+
io.write "set -e\n"
|
168
|
+
io.write b.scripts[0].to_before_script
|
169
|
+
io.write b.scripts[0].to_script
|
170
|
+
end
|
171
|
+
system("env", "-", "USER=$USER", "HOME=#{path}", "bash", "script.sh" )
|
172
|
+
expect($?.to_i).to eq 0
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should succesfuly run lang/ruby-rails-mysql with auto build", real: true do
|
177
|
+
task = create(
|
178
|
+
:task,
|
179
|
+
sha: "HEAD",
|
180
|
+
branch: "lang/ruby-rails-mysql"
|
181
|
+
)
|
182
|
+
|
183
|
+
b = build(nil, task: task)
|
184
|
+
Dir.chdir(path) do
|
185
|
+
File.open("script.sh", "w") do |io|
|
186
|
+
io.write "set -e\n"
|
187
|
+
io.write b.scripts[0].to_before_script
|
188
|
+
io.write b.scripts[0].to_script
|
189
|
+
end
|
190
|
+
system("env", "-", "USER=$USER", "HOME=#{path}", "bash", "script.sh" )
|
191
|
+
expect($?.to_i).to eq 0
|
192
|
+
end
|
193
|
+
end
|
138
194
|
end
|
@@ -89,21 +89,29 @@ describe Vx::Builder::BuildConfiguration do
|
|
89
89
|
|
90
90
|
context "any?" do
|
91
91
|
subject { config.any? }
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
} }
|
97
|
-
it { should be }
|
92
|
+
|
93
|
+
it "should be false when required keys" do
|
94
|
+
%w{ rvm scala jdk language script }.each do |required_key|
|
95
|
+
expect(described_class.new(required_key => "value")).to be_any
|
98
96
|
end
|
99
97
|
end
|
100
98
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
99
|
+
it "should be false when no any required keys" do
|
100
|
+
expect(described_class.new("before_script" => "value", "deploy" => "value")).to_not be_any
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "empty?" do
|
105
|
+
it "should be true if nil" do
|
106
|
+
expect(described_class.new nil).to be_empty
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should be true if empty hash" do
|
110
|
+
expect(described_class.new({})).to be_empty
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should be false if not empty hash" do
|
114
|
+
expect(described_class.new({"script" => "value"})).to_not be_empty
|
107
115
|
end
|
108
116
|
end
|
109
117
|
end
|
@@ -249,6 +249,13 @@ describe Vx::Builder::MatrixBuilder do
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
+
context "when build_configuration is empty" do
|
253
|
+
let(:config) { Vx::Builder::BuildConfiguration.new nil }
|
254
|
+
|
255
|
+
it "should return build configuration" do
|
256
|
+
expect(subject).to eq [config]
|
257
|
+
end
|
258
|
+
end
|
252
259
|
end
|
253
260
|
|
254
261
|
context "attributes_for_new_confgurations_with_merged_env" do
|
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.16
|
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-10-
|
11
|
+
date: 2014-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vx-common
|
@@ -114,6 +114,7 @@ email:
|
|
114
114
|
executables:
|
115
115
|
- vx_parallel_rspec
|
116
116
|
- vx_parallel_spinach
|
117
|
+
- vx_ruby_auto_build
|
117
118
|
extensions: []
|
118
119
|
extra_rdoc_files: []
|
119
120
|
files:
|
@@ -126,6 +127,7 @@ files:
|
|
126
127
|
- Rakefile
|
127
128
|
- bin/vx_parallel_rspec
|
128
129
|
- bin/vx_parallel_spinach
|
130
|
+
- bin/vx_ruby_auto_build
|
129
131
|
- lib/vx/builder.rb
|
130
132
|
- lib/vx/builder/build_configuration.rb
|
131
133
|
- lib/vx/builder/build_configuration/cache.rb
|