File tree 8 files changed +32
-7
lines changed
8 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,4 @@ build-iPhoneSimulator/
50
50
.rvmrc
51
51
/site /public
52
52
/.byebug_history
53
+ /.idea
Original file line number Diff line number Diff line change
1
+ copper
Original file line number Diff line number Diff line change
1
+ ruby-2.5.1
Original file line number Diff line number Diff line change 1
1
PATH
2
2
remote: .
3
3
specs:
4
- c66-copper (0.0.3 )
4
+ c66-copper (0.0.4 )
5
5
colorize (~> 0.8 )
6
6
ipaddress (~> 0.8 )
7
7
json (~> 1.4 )
17
17
colorize (0.8.1 )
18
18
ffi (1.9.23 )
19
19
ipaddress (0.8.3 )
20
- json (1.8.3 )
21
- jsonpath (0.8.11 )
20
+ json (1.8.6 )
21
+ jsonpath (0.9.4 )
22
22
multi_json
23
23
to_regexp (~> 0.2.1 )
24
24
listen (3.1.5 )
37
37
semantic (1.6.1 )
38
38
thor (0.20.0 )
39
39
to_regexp (0.2.1 )
40
- treetop (1.6.9 )
40
+ treetop (1.6.10 )
41
41
polyglot (~> 0.3 )
42
42
43
43
PLATFORMS
@@ -51,4 +51,4 @@ DEPENDENCIES
51
51
rerun (~> 0.13 )
52
52
53
53
BUNDLED WITH
54
- 1.16.1
54
+ 1.16.4
Original file line number Diff line number Diff line change
1
+ a :
2
+ b : " c"
Original file line number Diff line number Diff line change
1
+ rule abc warn {
2
+ fetch("") -> console
3
+ }
Original file line number Diff line number Diff line change @@ -36,23 +36,40 @@ module Copper
36
36
require 'byebug' if $debug
37
37
38
38
rule_file = options [ :rules ]
39
+ if !rule_file
40
+ puts "No rule file provided. Use --rule option" . red
41
+ exit ( 1 )
42
+ end
43
+
39
44
unless File . exists? ( rule_file )
40
45
puts "Rule file #{ rule_file } not found" . red
41
46
exit ( 1 )
42
47
end
43
48
content_file = options [ :file ]
49
+ if !content_file
50
+ puts "No config file provided. Use --file option" . red
51
+ exit ( 1 )
52
+ end
53
+
44
54
unless File . exists? ( content_file )
45
55
puts "Config file #{ content_file } not found" . red
46
56
exit ( 1 )
47
57
end
48
58
49
59
rules = File . read ( rule_file )
50
- file = ""
60
+ if rules . empty?
61
+ puts "Empty rules file" . red
62
+ exit ( 2 )
63
+ end
51
64
raise ::NotImplementedError if options [ :format ] != 'yaml'
52
65
# load the yaml file and split them into separate yamls
53
66
54
67
failed = false
55
68
content = File . read ( content_file )
69
+ if content . empty?
70
+ puts "Empty config file" . red
71
+ exit ( 2 )
72
+ end
56
73
content . split ( '---' ) . each_with_index do |part , idx |
57
74
puts "Validating part #{ idx } "
58
75
file = YAML ::load ( part )
Original file line number Diff line number Diff line change 1
1
module Copper
2
- VERSION = '0.0.4 '
2
+ VERSION = '0.0.5 '
3
3
COPYRIGHT_MESSAGE = "(c) 2018 Cloud66 Inc."
4
4
APP_NAME = 'Copper'
5
5
end
You can’t perform that action at this time.
0 commit comments