wwtd 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa67745551b56d3fb2c7fbf2e06fb3a253916877
4
- data.tar.gz: 5e2fb3b4a30fab6c8e1c12ea35bb36eb4a64d058
3
+ metadata.gz: 4bc9fc99c14b0d246c0fa04f9dd3555d8cace6be
4
+ data.tar.gz: 42c7cd96d020415b8e4809fb3bdfaffd1cee3964
5
5
  SHA512:
6
- metadata.gz: e5b6f48c94877458ff7bf8707ad0954eaf12d07a7e7a16e3309039effb34a5843afda6cbc1d7d91b4ad9666f6c04554a907b929a6857a7119e505aa458d3f718
7
- data.tar.gz: 70871fa5a3d12a9d986461d0c82406f84d398a8d1b634a2233201b38067ff9fb83d8971bf91c15f6bac0576f8eb2467c5c3ab511d71519ea0b80efb5ffa2210e
6
+ metadata.gz: f0c5eee13ac1855633dd96578029ee1bc777c625280940c5be2e0fb30c842ff534b1aa0ad5b33b4fb5b97cd39f7df4156b07511e68484fe9f86db0bdeb39282f
7
+ data.tar.gz: 848d096ac13598c827c2cccd3a828e85153d7329f265e4ed6b7eaade1b5b40e525322a8e15b7e3316519ecf825425619ccba069ea0ed47890f2acc3c82d8916e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -5,7 +5,6 @@ require "shellwords"
5
5
  require "parallel"
6
6
  require "tempfile"
7
7
  require "tmpdir"
8
- require "wwtd/colors"
9
8
  require "wwtd/ruby"
10
9
  require "wwtd/cli"
11
10
 
@@ -1,13 +1,14 @@
1
1
  module WWTD
2
2
  module CLI
3
3
  INFO_MAX_CHARACTERS = 30
4
- COLOR_MAP = {:start => :yellow, :success => :green}
4
+ STATE_COLOR_MAP = {:start => :yellow, :success => :green}
5
+ ASCII_COLORS = {:red => 31, :green => 32, :yellow => 33}
5
6
 
6
7
  class << self
7
8
  def run(argv=[])
8
9
  # Read travis.yml
9
10
  matrix, ignored = ::WWTD.read_travis_yml
10
- puts "Ignoring: #{ignored.sort.join(", ")}" unless ignored.empty?
11
+ puts "Ignoring: #{ignored.sort.join(", ")}" if ignored.any?
11
12
 
12
13
  # Execute tests
13
14
  results = ::WWTD.run(matrix, parse_options(argv)) do |state, config|
@@ -25,10 +26,28 @@ module WWTD
25
26
 
26
27
  private
27
28
 
29
+ def parse_options(argv)
30
+ options = {}
31
+ OptionParser.new do |opts|
32
+ opts.banner = <<-BANNER.gsub(/^ {10}/, "")
33
+ WWTD: Travis simulator - faster + no more waiting for build emails
34
+
35
+ Usage:
36
+ wwtd
37
+
38
+ Options:
39
+ BANNER
40
+ opts.on("-p", "--parallel [PROCESSES]", Integer, "Run in parallel") { |c| options[:parallel] = c || Parallel.processor_count }
41
+ opts.on("-h", "--help", "Show this.") { puts opts; exit }
42
+ opts.on("-v", "--version", "Show Version"){ puts WWTD::VERSION; exit}
43
+ end.parse!(argv)
44
+ options
45
+ end
46
+
28
47
  def info_line(state, config, matrix)
29
48
  config_info = config_info(matrix, config)
30
- color = COLOR_MAP[state] || :red
31
- "#{Colors.send(color, state.to_s.upcase)} #{config_info}"
49
+ color = STATE_COLOR_MAP[state] || :red
50
+ "#{colorize(color, state.to_s.upcase)} #{config_info}"
32
51
  end
33
52
 
34
53
  # human readable config without options that are the same in all configs
@@ -51,22 +70,12 @@ module WWTD
51
70
  end
52
71
  end
53
72
 
54
- def parse_options(argv)
55
- options = {}
56
- OptionParser.new do |opts|
57
- opts.banner = <<-BANNER.gsub(/^ {10}/, "")
58
- WWTD: Travis simulator - faster + no more waiting for build emails
59
-
60
- Usage:
61
- wwtd
62
-
63
- Options:
64
- BANNER
65
- opts.on("-p", "--parallel [PROCESSES]", Integer, "Run in parallel") { |c| options[:parallel] = c || Parallel.processor_count }
66
- opts.on("-h", "--help", "Show this.") { puts opts; exit }
67
- opts.on("-v", "--version", "Show Version"){ puts WWTD::VERSION; exit}
68
- end.parse!(argv)
69
- options
73
+ def colorize(color, string)
74
+ if $stdout.tty?
75
+ "\e[#{ASCII_COLORS[color]}m#{string}\e[0m"
76
+ else
77
+ string
78
+ end
70
79
  end
71
80
  end
72
81
  end
@@ -1,6 +1,6 @@
1
1
  require "wwtd"
2
2
 
3
- run_wwtd = lambda { |args| exit 1 unless WWTD.run(args) == 0 }
3
+ run_wwtd = lambda { |args| exit 1 unless WWTD::CLI.run(args) == 0 }
4
4
  task :wwtd do
5
5
  run_wwtd.call([])
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module WWTD
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
@@ -55,7 +55,6 @@ files:
55
55
  - bin/wwtd
56
56
  - lib/wwtd.rb
57
57
  - lib/wwtd/cli.rb
58
- - lib/wwtd/colors.rb
59
58
  - lib/wwtd/ruby.rb
60
59
  - lib/wwtd/tasks.rb
61
60
  - lib/wwtd/version.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,25 +0,0 @@
1
- module WWTD
2
- module Colors
3
- class << self
4
- def tint(color, string)
5
- if $stdout.tty?
6
- "\e[#{color}m#{string}\e[0m"
7
- else
8
- string
9
- end
10
- end
11
-
12
- def red(string)
13
- tint(31, string)
14
- end
15
-
16
- def green(string)
17
- tint(32, string)
18
- end
19
-
20
- def yellow(string)
21
- tint(33, string)
22
- end
23
- end
24
- end
25
- end