yaml-lint 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -13
  2. data/bin/yaml-lint +8 -0
  3. data/lib/yaml-lint.rb +11 -3
  4. metadata +5 -5
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OTAxYTk0NjJkZjM2NzUwOTllY2UyYjM2MGNkYTVlNmJjMGU2NzcyNg==
5
- data.tar.gz: !binary |-
6
- M2FhMDAyYWEwNzlhNDhhNzdkN2EzNWMyNGRkOTU5OTlmOWVkMDBjYw==
2
+ SHA256:
3
+ metadata.gz: 2738d9c6fd9834e2a96d204a317fef5ad5a0c5732862ddf76575813205ae3b61
4
+ data.tar.gz: b5276f99671de55551ac2f419cd8a5aa4b4f04ba22391aa3a462545a2f9c68c7
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDhiZDgyY2JkNWE4NjJmNjYwMjI0ZmIwN2VlMTNiNzhiNDRkMjA5YjU0MDU0
10
- ZWJjOGZmNmQ3M2E3OTBiMTI3OWFlOGMxNzYxMmFkZjk3MWVhMWUxMzc1Nzdh
11
- NDgwZmZhNTRhMTY5YzMzYjc4YWI2ZDgwZDk0ZTU3MjhhZmZhYzc=
12
- data.tar.gz: !binary |-
13
- YTI2ZTk4OGUzZTM3YmE2MTI0N2NjNDJiMWY2ZmNlZDI2ZTk3YzY5ZTg1YWYy
14
- YTg1YjU4YzZlMGYxZmMwNWNlMWMyOTFjZjMzYjE4MDc0ZmE1YjQ5MTk4NjFj
15
- M2MwMDc4Mzk1ODRhNmE5NWVhMmM4NzlhNWYxMjVmYjU2ZGY4MDc=
6
+ metadata.gz: 97ccbd8f69de3e846d4ea7e18f02eb15e61f9deae35a54d4b116438ec65ba90660ee797e1697143cc9410bd4e4510ab94fb7c7f5c6d721772de6ef34001c4d2e
7
+ data.tar.gz: 2ec074027f53b504df930ef4b47650583ea08e7284ce7eb2544f77f1196d5aa7c631264218531142e6cb5d392dc605f96ba533725c97b76f230519ee87ee98a4
@@ -29,6 +29,14 @@ OptionParser.new do |opts|
29
29
  options[:ignorenoyaml] = true
30
30
  end
31
31
 
32
+ opts.on("-e x,y,z", "--exclude x,y,z", Array, "Coma-separated list of files or folders to exclude.") do |n|
33
+ options[:exclude] = n
34
+ end
35
+
36
+ opts.on("-c", "--no-color", "Disables the colors in the output.") do |n|
37
+ options[:nocolor] = true
38
+ end
39
+
32
40
  opts.on_tail("-h", "--help") do |q|
33
41
  puts 'yaml-lint is a tool to check the syntax of your YAML files'
34
42
  puts opts
@@ -23,9 +23,9 @@ module Logging
23
23
  def emit(opts={})
24
24
  color = opts[:color]
25
25
  message = opts[:message]
26
- print ESCAPES[color]
26
+ print ESCAPES[color] unless @config[:nocolor]
27
27
  print message
28
- print ESCAPES[:reset]
28
+ print ESCAPES[:reset] unless @config[:nocolor]
29
29
  print "\n"
30
30
  end
31
31
  end
@@ -46,7 +46,8 @@ class YamlLint
46
46
  return 0
47
47
  else
48
48
  if File.directory? @file
49
- return self.parse_directory @file
49
+ directory = format_directory(@file)
50
+ return self.parse_directory directory
50
51
  else
51
52
  return self.parse_file @file
52
53
  end
@@ -55,6 +56,7 @@ class YamlLint
55
56
 
56
57
  def parse_directory(directory)
57
58
  Dir.glob("#{directory}/*").inject(0) do |mem, fdir|
59
+ next mem if (Array(@config[:exclude])).include? File.basename(fdir)
58
60
  if File.directory? fdir
59
61
  mem + parse_directory(fdir)
60
62
  else
@@ -82,4 +84,10 @@ class YamlLint
82
84
  return 0
83
85
  end
84
86
  end
87
+
88
+ private
89
+
90
+ def format_directory(directory)
91
+ directory[-1] == '/' ? directory.chop : directory
92
+ end
85
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Fabre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Check if your YAML files can be loaded.
14
14
  email: ju.pryz@gmail.com
@@ -29,17 +29,17 @@ require_paths:
29
29
  - lib
30
30
  required_ruby_version: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  required_rubygems_version: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ! '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 2.5.1
42
+ rubygems_version: 2.7.6
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Really simple YAML lint