wwtd 1.2.0 → 1.3.0
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/wwtd.rb +11 -2
- data/lib/wwtd/cli.rb +4 -2
- data/lib/wwtd/ruby.rb +1 -1
- data/lib/wwtd/run.rb +21 -10
- data/lib/wwtd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61da2cf51ba1d01d93f74f8979a6114f74863592
|
4
|
+
data.tar.gz: ead0ba73395bb7f8180aece8665dbbbcbc5536a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07e972cabce7d8256374fd796f148c10cc827a7def79fc20079377ee6b844db1ebdaae4d504038253e7f7b15cee446b223e01cfdc8d84636a1f9fa99566246d5
|
7
|
+
data.tar.gz: d07e181e39e27b68816b2b3e8bcac1580b50abc3c64f2877fd7f01ff3f0f848400a0bf4e91ff314571b782ebfbea7f0165e3ffaec03cc5be3936477e7b130252
|
data/lib/wwtd.rb
CHANGED
@@ -18,7 +18,7 @@ module WWTD
|
|
18
18
|
def read_travis_yml(options={})
|
19
19
|
config = (File.exist?(CONFIG) ? YAML.load_file(CONFIG) : {})
|
20
20
|
config.delete("source_key") # we don't need that we already have the source
|
21
|
-
ignored = (config.keys - UNDERSTOOD) + Array(options[:ignore])
|
21
|
+
ignored = (config.keys - UNDERSTOOD - Array(options[:use])) + Array(options[:ignore])
|
22
22
|
|
23
23
|
calculate_local_ruby_matrix = (
|
24
24
|
ignored.include?("rvm") &&
|
@@ -97,7 +97,16 @@ module WWTD
|
|
97
97
|
|
98
98
|
def matrix(config)
|
99
99
|
if config["env"] && config["env"].is_a?(Hash)
|
100
|
-
|
100
|
+
global = if config["env"]["global"]
|
101
|
+
" " + config["env"]["global"].join(" ")
|
102
|
+
else
|
103
|
+
""
|
104
|
+
end
|
105
|
+
if config["env"]["matrix"]
|
106
|
+
config["env"] = config["env"]["matrix"].map { |v| v + global }
|
107
|
+
else
|
108
|
+
config["env"] = global.strip
|
109
|
+
end
|
101
110
|
end
|
102
111
|
|
103
112
|
matrix = [{}]
|
data/lib/wwtd/cli.rb
CHANGED
@@ -33,7 +33,7 @@ module WWTD
|
|
33
33
|
puts "\nFailed:"
|
34
34
|
failed.each do |state, config|
|
35
35
|
runner = WWTD::Run.new(config.merge(:rerun => true), {}, nil)
|
36
|
-
env, cmd = runner.
|
36
|
+
env, cmd = runner.env_and_command_for_section("script")
|
37
37
|
env = WWTD.escaped_env(env, :rerun => true)
|
38
38
|
puts colorize(:red, env + cmd)
|
39
39
|
end
|
@@ -60,7 +60,8 @@ module WWTD
|
|
60
60
|
|
61
61
|
def parse_options(argv)
|
62
62
|
options = {
|
63
|
-
:ignore => []
|
63
|
+
:ignore => [],
|
64
|
+
:use => [],
|
64
65
|
}
|
65
66
|
OptionParser.new do |opts|
|
66
67
|
opts.banner = <<-BANNER.gsub(/^ {10}/, "")
|
@@ -73,6 +74,7 @@ module WWTD
|
|
73
74
|
BANNER
|
74
75
|
opts.on("-l", "--local", "Ignore rvm options / only run on current ruby") { options[:ignore] << "rvm" }
|
75
76
|
opts.on("-i", "--ignore FIELDS", String, "Ignore selected travis fields like rvm/gemfile/matrix/...") { |fields| options[:ignore] += fields.split(",") }
|
77
|
+
opts.on("-u", "--use FIELDS", String, "Use dangerous travis fields like before_install/install/before_script/...") { |fields| options[:use] += fields.split(",") }
|
76
78
|
opts.on("-p", "--parallel [COUNT]", Integer, "Run in parallel") { |c| options[:parallel] = c || 4 }
|
77
79
|
opts.on("-o", "--only-bundle", "Only bundle, do not run anything") { options[:only_bundle] = true }
|
78
80
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
data/lib/wwtd/ruby.rb
CHANGED
@@ -13,7 +13,7 @@ module WWTD
|
|
13
13
|
return unless version
|
14
14
|
version = normalize_ruby_version(version)
|
15
15
|
if rvm_executable
|
16
|
-
command = "rvm #{version}
|
16
|
+
command = "rvm-exec #{version} "
|
17
17
|
command if cache_command("#{command} ruby -v")
|
18
18
|
elsif chruby_executable
|
19
19
|
command = "chruby-exec #{version} -- "
|
data/lib/wwtd/run.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module WWTD
|
2
2
|
class Run
|
3
|
+
|
4
|
+
SCRIPT_SECTIONS = ["before_install", "install", "before_script", "script", "after_script"]
|
5
|
+
|
3
6
|
def initialize(config, env, lock)
|
4
7
|
@config, @env, @lock = config, env, lock
|
5
8
|
add_env_from_config
|
6
9
|
@switch = build_switch_statement
|
7
10
|
end
|
8
11
|
|
9
|
-
def execute
|
12
|
+
def execute
|
10
13
|
state = if Ruby.available?(config["rvm"])
|
11
14
|
yield(:start, config)
|
12
15
|
success? ? :success : :failure
|
@@ -20,20 +23,22 @@ module WWTD
|
|
20
23
|
end
|
21
24
|
|
22
25
|
# internal api
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
def env_and_command_for_section(key)
|
27
|
+
if command = config[key]
|
28
|
+
command = [command] unless Array === command
|
29
|
+
command = command.map { |cmd| "#{switch}#{cmd}" }.join(" && ")
|
30
|
+
|
31
|
+
[env, command]
|
32
|
+
elsif key == "script"
|
33
|
+
command = (wants_bundle? ? "#{switch}bundle exec rake" : "#{switch}rake")
|
34
|
+
[env, command]
|
35
|
+
end
|
30
36
|
end
|
31
37
|
|
32
38
|
private
|
33
39
|
|
34
40
|
attr_reader :config, :env, :lock, :switch
|
35
41
|
|
36
|
-
|
37
42
|
def success?
|
38
43
|
if wants_bundle?
|
39
44
|
flock File.join(lock, (config["rvm"] || "rvm").to_s) do
|
@@ -43,7 +48,13 @@ module WWTD
|
|
43
48
|
end
|
44
49
|
end
|
45
50
|
|
46
|
-
|
51
|
+
SCRIPT_SECTIONS.each do |section|
|
52
|
+
if env_and_command = env_and_command_for_section(section)
|
53
|
+
return unless sh(*env_and_command)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
true
|
47
58
|
end
|
48
59
|
|
49
60
|
def wants_bundle?
|
data/lib/wwtd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wwtd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|