true 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/true-cli +15 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab5a6417b68be0dad0134effa015e923f4a655fd
|
4
|
+
data.tar.gz: a52b1f776572e2b2219ed32fc6406a16412fda33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|