true 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/true-cli +15 -11
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4991a75b377b7447e85b46077701cd8886520605
4
- data.tar.gz: 4e7afcea7dbd134caa728473f2b73a1e7ffd01e1
3
+ metadata.gz: ab5a6417b68be0dad0134effa015e923f4a655fd
4
+ data.tar.gz: a52b1f776572e2b2219ed32fc6406a16412fda33
5
5
  SHA512:
6
- metadata.gz: 7ee7cc9c924ad1dfddeb231e7083b1299a4dc8f01cf53067a68fbf7f53521a0eb1282ed5b0f6826a2d8771883a2f89a0d8dfaf3016c3de1918e58930aa7a5314
7
- data.tar.gz: 786b63b92a43ec1ad116fc2aaf901537cb9a7e7eb75951942e74da9612ef54b80d6b83b62eaa32f385acaaa69fa706ee41f9c670e87094e279bacdb9773f5da4
6
+ metadata.gz: 12e482d1edbc75592f708d0e4a0b1ee914a158d62507042691184b9836dcceee9230fc46370090e712172aa5075aeae7ab0e77040b6ad34f037a226309b73485
7
+ data.tar.gz: dab87289bd9df35090f56d1e501603a4d8cbd4fbdbcde4319d5a3f91299e68ff6e26274d360e669e1a47388b786bb8e850751209d62fafb020c134fc48a6e8a8
data/bin/true-cli CHANGED
@@ -14,7 +14,7 @@ OptionParser.new do |opts|
14
14
  opts.banner = "Usage: true-cli [options] file"
15
15
 
16
16
  opts.on('-c', '--config PATH', String, 'path to config file') do |config|
17
- config_file = config
17
+ config_file = File.join(Dir.pwd, config)
18
18
  end
19
19
  opts.on('-d', '--debug') do
20
20
  options['debug'] = true
@@ -24,7 +24,6 @@ OptionParser.new do |opts|
24
24
  end
25
25
  end.parse!(ARGV)
26
26
 
27
-
28
27
  def with_captured_stdout
29
28
  begin
30
29
  old_stderr = $stderr
@@ -35,12 +34,6 @@ def with_captured_stdout
35
34
  $stderr = old_stderr
36
35
  end
37
36
  end
38
- output = with_captured_stdout do
39
- ARGV.each do |file|
40
- Sass::Engine.for_file(file, {}).render
41
- end
42
- end
43
-
44
37
  if File.exists?(config_file)
45
38
  puts "Using config file: #{config_file}" unless options['slient']
46
39
  config_options = YAML.load(File.read(config_file))
@@ -54,17 +47,28 @@ if File.exists?(config_file)
54
47
  end
55
48
  end
56
49
  end
57
-
58
- if output.empty?
50
+ if ARGV.empty?
59
51
  puts "No test files supplied"
60
52
  exit(2)
61
53
  end
62
54
 
55
+ output = with_captured_stdout do
56
+ ARGV.each do |file|
57
+ Sass::Engine.for_file(file, {}).render
58
+ end
59
+ end
60
+
61
+
63
62
  matches = output.match(%r{(?<tests>\d+) Tests, (?<passed>\d+) Passed, (?<failed>\d+) Failed})
63
+ if matches.nil? # return sass errors
64
+ puts output
65
+ exit(2)
66
+ end
64
67
 
65
68
  if matches[:failed] == '0'
66
69
  if options['color']
67
- puts COLORS[:ok] + output + COLORS[:end] unless options['slient']
70
+ noun = matches[:tests].to_i == 1 ? 'Test' : 'Tests'
71
+ puts COLORS[:ok] + "#{matches[:tests]} #{noun}, #{matches[:passed]} Passed, #{matches[:failed]} Failed" + COLORS[:end] unless options['slient']
68
72
  else
69
73
  puts output unless options['slient']
70
74
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 'true'
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Suzanne