minitest-rerun 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae2a37170ef2a34572a56fbe7d4c50928eb6291b
4
- data.tar.gz: c904b2e72856a2f2cd5dedad4ee399712364db36
3
+ metadata.gz: c4ea2c762b6dac4867ce48cf9c4579765c02b0bc
4
+ data.tar.gz: ef37a4b94ff22fbeb7f9e15cf89fffd791c25c25
5
5
  SHA512:
6
- metadata.gz: 0a66271ddfe3e05d596019610502132ef9c1ff1dcd3c6de51aa00f71b819b79f8dff5f07a5943dce56f538098b938ad883850ec32a48c71afe759b346d27beda
7
- data.tar.gz: efd7dabb18f22c9acf2fc6beb79ce3efa247f83690bef57eb966e1419fdc3486ade7934d782d0891a10c122aa78225a609b6dfdbd8a77cb7769b5cdd42a51d5a
6
+ metadata.gz: a2d5cf4c71ec1c5a2a7915116320b090320eda166f610e866a4af4585bd992873aaded1fbc02c2b978e210e66305d9137e150242cfbef9592dd61eabacf2c3cf
7
+ data.tar.gz: 26cc421fea4b0023ffa93c5b32cb0da5658c04b5a13ca6c7d18ab58e24923bfc34a522fb6d78d213825208b53c96ba0b18494ba48fdf3f032f4daa642c2d5247
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,23 +2,38 @@ require "minitest/rerun/version"
2
2
 
3
3
  module Minitest::Rerun
4
4
  class << self
5
+ ASCII_COLORS = {:red => 31, :cyan => 36}
6
+
5
7
  def rerun_command(msg)
6
8
  info = msg.to_s.split("\n")[1]
7
- location = info[/ \[(.*?):\d+\]:/]
8
- name = info.sub(location, "")
9
- "ruby #{test_file($1)} -n '#{name}'"
9
+ location_part = info[/ \[((.*?):\d+)\]:/]
10
+ location = $1
11
+ file = $2
12
+ if location
13
+ name = info.sub(location_part, "")
14
+ colorize(:red, "ruby #{test_file(file)} -n '#{name}' ") + colorize(:cyan, "# #{relativize(location)}")
15
+ end
10
16
  end
11
17
 
12
18
  private
13
19
 
14
- def test_file(location)
15
- tests_run = $0.split(" ").select { |f| File.exist?(f) }
16
- if tests_run.size == 1
17
- tests_run.first
20
+ def colorize(color, string)
21
+ if $stdout.tty?
22
+ "\e[#{ASCII_COLORS[color]}m#{string}\e[0m"
18
23
  else
19
- location.sub(/^\.\//, "").sub("#{Dir.pwd}/", "")
24
+ string
20
25
  end
21
26
  end
27
+
28
+ def relativize(location)
29
+ location.sub(/^\.\//, "").sub("#{Dir.pwd}/", "")
30
+ end
31
+
32
+ def test_file(location)
33
+ tests_run = $0.split(" ").select { |f| File.exist?(f) }
34
+ location = tests_run.first if tests_run.size == 1
35
+ relativize(location)
36
+ end
22
37
  end
23
38
 
24
39
  module M4
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Rerun
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-rerun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
@@ -30,7 +30,7 @@ cert_chain:
30
30
  F5etKHZg0j3eHO31/i2HnswY04lqGImUu6aM5EnijFTB7PPW2KwKKM4+kKDYFdlw
31
31
  /0WV1Ng2/Y6qsHwmqGg2VlYj2h4=
32
32
  -----END CERTIFICATE-----
33
- date: 2014-03-29 00:00:00.000000000 Z
33
+ date: 2014-03-31 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: minitest
metadata.gz.sig CHANGED
Binary file