wwtd 0.1.8 → 0.1.9
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -3
- data/lib/wwtd.rb +84 -4
- data/lib/wwtd/version.rb +1 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8fc6e436ea91aa67fd00cc6285d866e4e5350ae
|
4
|
+
data.tar.gz: 36e0bc7cc2f324b60772f343c889f66a6f1cfef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220f889c7096aea1267d3122bff57a6dbd4f5c35e7d30e847c96472ebf1cf284a168ffc2097b9b18e078fbe8c3fc22bc98a92f52f41642eb3096be5741b5a87b
|
7
|
+
data.tar.gz: 31c06c72b004f3ad9e9efa5eaa7f7314ce45e86c78de4bcdf39c128cb419e3dd5364f57764a7d874b8267c5d2ffc0651119fc8bf074a33e46f0061dcc25a3e44
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
�5��yg�*����j����NP�� ��+�~>ż��K*
|
3
|
-
��(i��Ax�0p��ţ�8�+�:��?��5�~tJ�_>��^�^�[)e��MZ"<^�g`1/�#!EC��Ua�x��M��gdPF�~�El+{j�hr`�7�АfE>)�筼i��Wq)�M�o�Z
|
1
|
+
�'��<��D�8���#x�Y�xl|�ʐ��/|T��}�*x2/��q�8K�-��H1��b��rįN<7���O�i�:Bz�E�����8ٓ��;�$�� y7-�0�I�BFA|��9�K$\[?�7)p�������>������rU�%2��Ί����Ufm�?ئ""W�7���""R�F;�S'W50�0F;�����1�zl����VT�|G(�lR�ܲ{���fN�6��i�GV��r�x7�Bl�Hw���
|
data/lib/wwtd.rb
CHANGED
@@ -130,26 +130,106 @@ module WWTD
|
|
130
130
|
end
|
131
131
|
|
132
132
|
with_clean_env do
|
133
|
-
|
133
|
+
switch_ruby = switch_ruby(config["rvm"])
|
134
134
|
|
135
135
|
if wants_bundle
|
136
136
|
flock("#{lock}/#{config["rvm"] || "rvm"}") do
|
137
137
|
default_bundler_args = "--deployment --path #{Dir.pwd}/vendor/bundle" if committed?("#{gemfile || DEFAULT_GEMFILE}.lock")
|
138
|
-
bundle_command = "#{
|
138
|
+
bundle_command = "#{switch_ruby}bundle install #{config["bundler_args"] || default_bundler_args}"
|
139
139
|
return false unless sh "#{bundle_command.strip} --quiet"
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
143
|
default_command = (wants_bundle ? "bundle exec rake" : "rake")
|
144
144
|
command = config["script"] || default_command
|
145
|
-
command = "#{
|
145
|
+
command = "#{switch_ruby}#{command}"
|
146
146
|
|
147
147
|
sh(command)
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
|
+
def switch_ruby(version)
|
152
|
+
return unless version
|
153
|
+
version = normalize_ruby_version(version)
|
154
|
+
if rvm_executable
|
155
|
+
"rvm #{version} do "
|
156
|
+
else
|
157
|
+
if rbenv_executable
|
158
|
+
switch_path(version, "rbenv")
|
159
|
+
elsif chruby?
|
160
|
+
switch_path(version, "chruby")
|
161
|
+
else
|
162
|
+
"false # could not find ruby version changer # "
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def switch_path(version, changer)
|
168
|
+
prefix = extract_jruby_rbenv_options!(version)
|
169
|
+
if bin_path = send("#{changer}_bin_path", version)
|
170
|
+
"#{prefix}PATH=#{bin_path}:$PATH "
|
171
|
+
else
|
172
|
+
"false # could not find #{version} in #{changer} # "
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def chruby?
|
177
|
+
ENV["RUBY_ROOT"] # chruby is a shell function not available from inside ruby
|
178
|
+
end
|
179
|
+
|
180
|
+
def rvm_executable
|
181
|
+
cache_command("which rvm")
|
182
|
+
end
|
183
|
+
|
184
|
+
def rbenv_executable
|
185
|
+
cache_command("which rbenv")
|
186
|
+
end
|
187
|
+
|
188
|
+
def cache_command(command)
|
189
|
+
cache(command) do
|
190
|
+
if result = capture(command)
|
191
|
+
result.strip
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def chruby_bin_path(version)
|
197
|
+
found_version_path = Dir.glob("#{ENV['RUBY_ROOT']}/../*").detect { |p| File.basename(p).include?(version) }
|
198
|
+
"#{found_version_path}/bin" if found_version_path
|
199
|
+
end
|
200
|
+
|
201
|
+
def rbenv_bin_path(version)
|
202
|
+
known_version = capture("rbenv versions | grep #{version}")
|
203
|
+
known_version = known_version.split("\n").last[2..-1].split(" ")[0]
|
204
|
+
rbenv_root = rbenv_executable.sub(%r{/(\.?rbenv)/.*}, "/\\1")
|
205
|
+
"#{rbenv_root}/versions/#{known_version}/bin"
|
206
|
+
end
|
207
|
+
|
208
|
+
def cache(key)
|
209
|
+
@cache ||= {}
|
210
|
+
if @cache.key?(key)
|
211
|
+
@cache[key]
|
212
|
+
else
|
213
|
+
@cache[key] = yield
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
# set ruby-opts for jruby flavors
|
218
|
+
def extract_jruby_rbenv_options!(version)
|
219
|
+
if version.sub!("-d19", "")
|
220
|
+
"JRUBY_OPTS=--1.9 "
|
221
|
+
elsif version.sub!("-d18", "")
|
222
|
+
"JRUBY_OPTS=--1.8 "
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
def capture(command)
|
227
|
+
result = `#{command}`
|
228
|
+
$?.success? ? result : nil
|
229
|
+
end
|
230
|
+
|
151
231
|
# Taken from https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/rvm.rb
|
152
|
-
def
|
232
|
+
def normalize_ruby_version(rvm)
|
153
233
|
rvm.to_s.
|
154
234
|
gsub(/-(\d{2})mode$/, '-d\1').
|
155
235
|
gsub(/^rbx$/, 'rbx-weekly-d18').
|
data/lib/wwtd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wwtd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
y0kCSWmK6D+x/SbfS6r7Ke07MRqziJdB9GuE1+0cIRuFh8EQ+LN6HXCKM5pon/GU
|
30
30
|
ycwMXfl0
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-11-
|
32
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: parallel
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.0.
|
79
|
+
rubygems_version: 2.0.3
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Travis simulator so you do not need to wait for the build
|
metadata.gz.sig
CHANGED
Binary file
|