codeclimate-yaml 0.0.2 → 0.0.3

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: f11cd9130a26b307a757b7185d6cc13a8a8fd674
4
- data.tar.gz: c3ac927fe9cbb10672ac86f7ca9766ad4787e808
3
+ metadata.gz: 2e53c3cfeac47e6e8e5ee14f71e1a07f8cbed24c
4
+ data.tar.gz: f6c1730f9692f01d37def2b7a6b1783179498d1a
5
5
  SHA512:
6
- metadata.gz: d0e76fd49313dc2e257da98ceb628ef432af7f2ab47ad9c6ca5525840d59ef0934dd354bf4ed7c4dcb978458348927bdf344b9fd2172e93ba92f68b082221855
7
- data.tar.gz: 31da5485256634fd8a55496c5752f11c8c2dafcdc5371ad14969d233260285ed59b5ef07d54c9e168d9dfbff4a1146e0d42c6b13bc936449405a60b12a254c05
6
+ metadata.gz: b5f55e36440282ca832b6170d1e06b78c404e951c5f24469626abe653ec2c3bfbbc47f91edcf38678080c35d99479487eb69ded3c4908d2d042f85395d9cfbca
7
+ data.tar.gz: cd21c9de593060ac4d33667a86ddb8a51aee385adcdd1374747d5368e2168341e3d1ef9a8d04c978860ae3574b300da0fc10130bf34e2bee736164b6f1f98bb3
data/lib/cc/yaml/nodes.rb CHANGED
@@ -3,11 +3,12 @@ module CC
3
3
  module Nodes
4
4
  autoload :Engine, "cc/yaml/nodes/engine"
5
5
  autoload :EngineList, "cc/yaml/nodes/engine_list"
6
- autoload :ExcludePath, "cc/yaml/nodes/exclude_path"
7
- autoload :ExcludePathList, "cc/yaml/nodes/exclude_path_list"
6
+ autoload :Glob, "cc/yaml/nodes/glob"
7
+ autoload :GlobList, "cc/yaml/nodes/glob_list"
8
8
  autoload :Mapping, "cc/yaml/nodes/mapping"
9
9
  autoload :Node, "cc/yaml/nodes/node"
10
10
  autoload :OpenMapping, "cc/yaml/nodes/open_mapping"
11
+ autoload :Ratings, "cc/yaml/nodes/ratings"
11
12
  autoload :Root, "cc/yaml/nodes/root"
12
13
  autoload :Scalar, "cc/yaml/nodes/scalar"
13
14
  autoload :Sequence, "cc/yaml/nodes/sequence"
@@ -0,0 +1,11 @@
1
+ module CC
2
+ module Yaml
3
+ module Nodes
4
+ class Glob < Scalar
5
+ def match?(path)
6
+ File.fnmatch(to_s, path)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ module CC
2
+ module Yaml
3
+ module Nodes
4
+ class GlobList < Sequence
5
+ type Glob
6
+
7
+ def match_any?(path)
8
+ any? { |g| g.match?(path) }
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module CC
2
+ module Yaml
3
+ module Nodes
4
+ class Ratings < Mapping
5
+ map :paths, to: GlobList
6
+
7
+ def rate?(path)
8
+ paths.present? && paths.match_any?(path)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,9 +1,13 @@
1
+ require "active_support"
2
+ require "active_support/core_ext"
3
+
1
4
  module CC
2
5
  module Yaml
3
6
  module Nodes
4
7
  class Root < Mapping
5
- map :exclude_paths, to: ExcludePathList
6
8
  map :engines, to: EngineList
9
+ map :exclude_paths, to: GlobList
10
+ map :ratings, to: Ratings
7
11
 
8
12
  def initialize
9
13
  super(nil)
@@ -16,6 +20,14 @@ module CC
16
20
  def inspect
17
21
  "#<#{self.class.name}:#{super}>"
18
22
  end
23
+
24
+ def exclude?(path)
25
+ exclude_paths.present? && exclude_paths.match_any?(path)
26
+ end
27
+
28
+ def rate?(path)
29
+ ratings.present? && ratings.rate?(path)
30
+ end
19
31
  end
20
32
  end
21
33
  end
@@ -1,5 +1,5 @@
1
1
  module CC
2
2
  module Yaml
3
- VERSION = "0.0.2".freeze
3
+ VERSION = "0.0.3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: secure_string
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: Code Climate YAML parser
28
42
  email: hello@codeclimate.com
29
43
  executables: []
@@ -34,11 +48,12 @@ files:
34
48
  - lib/cc/yaml/nodes.rb
35
49
  - lib/cc/yaml/nodes/engine.rb
36
50
  - lib/cc/yaml/nodes/engine_list.rb
37
- - lib/cc/yaml/nodes/exclude_path.rb
38
- - lib/cc/yaml/nodes/exclude_path_list.rb
51
+ - lib/cc/yaml/nodes/glob.rb
52
+ - lib/cc/yaml/nodes/glob_list.rb
39
53
  - lib/cc/yaml/nodes/mapping.rb
40
54
  - lib/cc/yaml/nodes/node.rb
41
55
  - lib/cc/yaml/nodes/open_mapping.rb
56
+ - lib/cc/yaml/nodes/ratings.rb
42
57
  - lib/cc/yaml/nodes/root.rb
43
58
  - lib/cc/yaml/nodes/scalar.rb
44
59
  - lib/cc/yaml/nodes/sequence.rb
@@ -1,8 +0,0 @@
1
- module CC
2
- module Yaml
3
- module Nodes
4
- class ExcludePath < Scalar
5
- end
6
- end
7
- end
8
- end
@@ -1,9 +0,0 @@
1
- module CC
2
- module Yaml
3
- module Nodes
4
- class ExcludePathList < Sequence
5
- type ExcludePath
6
- end
7
- end
8
- end
9
- end