jit 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/config.rb +16 -6
- data/lib/index.rb +9 -4
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3456259298664412f5d90d68ba0a102320bd6b59a9ace12b3817b76cdd553a89
|
4
|
+
data.tar.gz: 57d5cec5ebd3150ccc5abd83a458d60ed59cc1065b0a0dc8a6fd4df40153ea53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bca4b9acaec9bc125b22adbcfe0179794a0f2f27e196c70be266cb1081296bda1a18c740e274cb17fa1f676499cd1d2bdd4187cfa751f8a380ffabdc7d529a50
|
7
|
+
data.tar.gz: 074d431d5f9a5b1b66e1fcb72223aa92a457fdd08be43d6f3361b7ecf2c3184fb1b3c13dd0437960b0763e604a673fb7114aaff140a613c0574808113f57fb89
|
data/lib/config.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require_relative "./lockfile"
|
2
2
|
|
3
3
|
class Config
|
4
|
-
SECTION_LINE =
|
5
|
-
VARIABLE_LINE =
|
6
|
-
BLANK_LINE =
|
7
|
-
INTEGER =
|
4
|
+
SECTION_LINE = /\A\s*\[([a-z0-9-]+)( "(.+)")?\]\s*(\Z|#|;)/i
|
5
|
+
VARIABLE_LINE = /\A\s*([a-z][a-z0-9-]*)\s*=\s*(.*?)\s*(\Z|#|;)/im
|
6
|
+
BLANK_LINE = /\A\s*(\Z|#|;)/
|
7
|
+
INTEGER = /\A-?[1-9][0-9]*\Z/
|
8
8
|
|
9
9
|
VALID_SECTION = /^[a-z0-9-]+$/i
|
10
10
|
VALID_VARIABLE = /^[a-z][a-z0-9-]*$/i
|
@@ -207,7 +207,7 @@ class Config
|
|
207
207
|
|
208
208
|
File.open(@path, File::RDONLY) do |file|
|
209
209
|
until file.eof?
|
210
|
-
line = parse_line(section, file
|
210
|
+
line = parse_line(section, read_line(file))
|
211
211
|
section = line.section
|
212
212
|
|
213
213
|
lines_for(section).push(line)
|
@@ -216,6 +216,15 @@ class Config
|
|
216
216
|
rescue Errno::ENOENT
|
217
217
|
end
|
218
218
|
|
219
|
+
def read_line(file)
|
220
|
+
buffer = ""
|
221
|
+
|
222
|
+
loop do
|
223
|
+
buffer.concat(file.readline)
|
224
|
+
return buffer unless buffer.end_with?("\\\n")
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
219
228
|
def parse_line(section, line)
|
220
229
|
if match = SECTION_LINE.match(line)
|
221
230
|
section = Section.new([match[1], match[3]].compact)
|
@@ -236,7 +245,8 @@ class Config
|
|
236
245
|
when "yes", "on", "true" then true
|
237
246
|
when "no", "off", "false" then false
|
238
247
|
when INTEGER then value.to_i
|
239
|
-
else
|
248
|
+
else
|
249
|
+
value.gsub(/\\\n/, "")
|
240
250
|
end
|
241
251
|
end
|
242
252
|
end
|
data/lib/index.rb
CHANGED
@@ -92,8 +92,8 @@ class Index
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def remove(pathname)
|
95
|
-
@parents[pathname.to_s].each { |child| remove_entry(child) }
|
96
95
|
remove_entry(pathname)
|
96
|
+
remove_children(pathname.to_s)
|
97
97
|
@changed = true
|
98
98
|
end
|
99
99
|
|
@@ -146,9 +146,7 @@ class Index
|
|
146
146
|
|
147
147
|
def discard_conflicts(entry)
|
148
148
|
entry.parent_directories.each { |parent| remove_entry(parent) }
|
149
|
-
|
150
|
-
set = @parents.fetch(entry.path, [])
|
151
|
-
set.each { |child| remove_entry(child) }
|
149
|
+
remove_children(entry.path)
|
152
150
|
end
|
153
151
|
|
154
152
|
def remove_entry(pathname)
|
@@ -169,6 +167,13 @@ class Index
|
|
169
167
|
end
|
170
168
|
end
|
171
169
|
|
170
|
+
def remove_children(path)
|
171
|
+
return unless @parents.has_key?(path)
|
172
|
+
|
173
|
+
children = @parents[path].clone
|
174
|
+
children.each { |child| remove_entry(child) }
|
175
|
+
end
|
176
|
+
|
172
177
|
def store_entry(entry)
|
173
178
|
@keys.add(entry.key)
|
174
179
|
@entries[entry.key] = entry
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Coglan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: jcoglan@gmail.com
|
@@ -130,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
|
134
|
-
rubygems_version: 2.5.2.3
|
133
|
+
rubygems_version: 3.1.2
|
135
134
|
signing_key:
|
136
135
|
specification_version: 4
|
137
136
|
summary: The information manager from London
|