gitattributes 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gitattributes.gemspec +1 -1
- data/lib/reality/git/attributes.rb +9 -0
- data/test/reality/git/test_attributes.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0a55496d6f14dbe3a2875abf144bb3481abebc5
|
4
|
+
data.tar.gz: 2deedb0df3e611e6aa5c5d39cba141c8c37fc88f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0e84e35f1e99b4147941e3752e639793d60d44a71b1da514bb4bdf9b07dad7e80da14727fdc7d6845c6e76763a399ab7a62a76b9ff76040756420f2042cf82c
|
7
|
+
data.tar.gz: 1e3554e0377532cd63ed243973e0ff2d3c9628ad6699d702954e773612905b1f75466960ea6c30292bbd1bb81b11823ebfa3e7768c470556615264a0198b4d96
|
data/gitattributes.gemspec
CHANGED
@@ -67,6 +67,11 @@ module Reality #nodoc
|
|
67
67
|
rule = AttributeRule.new(pattern, attributes)
|
68
68
|
@rules << rule
|
69
69
|
cache_rule(rule)
|
70
|
+
rule
|
71
|
+
end
|
72
|
+
|
73
|
+
def remove_rule(rule)
|
74
|
+
uncache_rule(rule) if @rules.delete(rule)
|
70
75
|
end
|
71
76
|
|
72
77
|
# Adds a rule for pattern that sets the text attribute.
|
@@ -111,6 +116,10 @@ module Reality #nodoc
|
|
111
116
|
def cache_rule(rule)
|
112
117
|
(@rule_map[rule.pattern] ||= []) << rule
|
113
118
|
end
|
119
|
+
|
120
|
+
def uncache_rule(rule)
|
121
|
+
(@rule_map[rule.pattern] ||= []).delete(rule)
|
122
|
+
end
|
114
123
|
end
|
115
124
|
end
|
116
125
|
end
|
@@ -32,6 +32,23 @@ TEXT
|
|
32
32
|
assert_equal(false, attributes.rules_by_pattern?('XXX'))
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_remove_rule
|
36
|
+
attributes = Reality::Git::Attributes.new("#{working_dir}/#{::SecureRandom.hex}")
|
37
|
+
|
38
|
+
rule1 = attributes.text_rule('*.md')
|
39
|
+
rule2 = attributes.text_rule('*.rake', :eofnl => false)
|
40
|
+
|
41
|
+
assert_equal(['*.md text', '*.rake text -eofnl'], attributes.rules.collect {|p| p.to_s})
|
42
|
+
|
43
|
+
attributes.remove_rule(rule1)
|
44
|
+
|
45
|
+
assert_equal(['*.rake text -eofnl'], attributes.rules.collect {|p| p.to_s})
|
46
|
+
|
47
|
+
attributes.remove_rule(rule2)
|
48
|
+
|
49
|
+
assert_equal([], attributes.rules.collect {|p| p.to_s})
|
50
|
+
end
|
51
|
+
|
35
52
|
def test_multiple_rules_with_same_pattern
|
36
53
|
content = <<TEXT
|
37
54
|
* -text
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitattributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Donald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|