wwtd 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data.tar.gz.sig +0 -0
  2. data/lib/wwtd.rb +25 -15
  3. data/lib/wwtd/version.rb +1 -1
  4. metadata +4 -4
  5. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
@@ -24,9 +24,23 @@ module WWTD
24
24
 
25
25
  # Execute tests
26
26
  matrix = matrix(config)
27
+ results = run_full_matrix(matrix, options)
28
+
29
+ # Summary
30
+ if matrix.size > 1
31
+ puts "\nResults:"
32
+ puts results.map(&:last)
33
+ end
34
+
35
+ results.all?(&:first) ? 0 : 1
36
+ end
37
+
38
+ private
39
+
40
+ def run_full_matrix(matrix, options)
27
41
  results = nil
28
42
  with_clean_dot_bundle do
29
- Tempfile.open "wwtd" do |lock|
43
+ Dir.mktmpdir do |lock| # does not return values in ruby 1.8
30
44
  results = Parallel.map(matrix.each_with_index, :in_processes => options[:parallel].to_i) do |config, i|
31
45
  ENV["TEST_ENV_NUMBER"] = (i == 0 ? "" : (i + 1).to_s) if options[:parallel]
32
46
 
@@ -41,18 +55,9 @@ module WWTD
41
55
  end
42
56
  end
43
57
  end
44
-
45
- # Summary
46
- if matrix.size > 1
47
- puts "\nResults:"
48
- puts results.map(&:last)
49
- end
50
-
51
- results.all?(&:first) ? 0 : 1
58
+ results
52
59
  end
53
60
 
54
- private
55
-
56
61
  def with_clean_dot_bundle
57
62
  had_old = File.exist?(".bundle")
58
63
  Dir.mktmpdir do |dir|
@@ -136,10 +141,10 @@ module WWTD
136
141
  rvm = "rvm #{config["rvm"]} do " if config["rvm"]
137
142
 
138
143
  if wants_bundle
139
- flock(lock) do
140
- default_bundler_args = "--deployment" if File.exist?("#{gemfile || DEFAULT_GEMFILE}.lock")
144
+ flock("#{lock}/#{config["rvm"] || "rvm"}") do
145
+ default_bundler_args = "--deployment --path #{Dir.pwd}/vendor/bundle" if committed?("#{gemfile || DEFAULT_GEMFILE}.lock")
141
146
  bundle_command = "#{rvm}bundle install #{config["bundler_args"] || default_bundler_args}"
142
- return false unless sh "#{bundle_command.strip} --quiet --path #{Dir.pwd}/vendor/bundle"
147
+ return false unless sh "#{bundle_command.strip} --quiet"
143
148
  end
144
149
  end
145
150
 
@@ -151,8 +156,13 @@ module WWTD
151
156
  end
152
157
  end
153
158
 
159
+ def committed?(file)
160
+ @committed_files ||= (File.exist?(".git") && `git ls-files`.split("\n")) || []
161
+ @committed_files.include?(file)
162
+ end
163
+
154
164
  def flock(file)
155
- File.open(file.path) do |f|
165
+ File.open(file, "w") do |f|
156
166
  begin
157
167
  f.flock(File::LOCK_EX)
158
168
  yield
@@ -1,3 +1,3 @@
1
1
  module WWTD
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wwtd
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -36,7 +36,7 @@ cert_chain:
36
36
  ycwMXfl0
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2013-09-01 00:00:00 Z
39
+ date: 2013-09-02 00:00:00 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: parallel
metadata.gz.sig CHANGED
Binary file