rego 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +5 -5
  2. data/bin/rego +27 -159
  3. data/lib/rego/_lib.rb +5 -5
  4. data/rego.gemspec +2 -2
  5. metadata +6 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 81b3c327cbc803c238d9aa4fecd8a178a5b89d71
4
- data.tar.gz: 991daf0148a99d859d3d010b7d30c78ade144ee1
2
+ SHA256:
3
+ metadata.gz: bb49b3d2016108b3dec5ada89bc0e68ab2a5910845a629926929f10510a62f2c
4
+ data.tar.gz: 27aac62ef93b549bb813978e17b1202c8b5af1ce06c4324fed147bcebbdc4bc2
5
5
  SHA512:
6
- metadata.gz: 395205b2b86a2449ed4ff58ab9343bbea8da055b6574477f18da28d4c3be8df0677568be085c851d69faf149f472deaa85daa61920cbcd7003ad6efe19db44c8
7
- data.tar.gz: ea33a297d3a489fe31c49cb1f90e8b99eaa91008c35da8761d2901ece6dfe5434d5ccedc07f9b5ce55b3ae0d27ce55924d9efaa6439dc2daf24f185cc50828c9
6
+ metadata.gz: 9e4ae3bf5f6947650575517dc3d679983e119e724f50f9edf5e6474d850067439766633b2022a0c706d226ff4f4aeb89b85f18d8979d76eaaacb1a27f25f6dee
7
+ data.tar.gz: a9e310138224b88f4f4b3a9858a3a3dd3517f97c7525884a4a521d50e27425d72c0a7ecdda004aab34fd98b1a68ae90226384764d87ccf995c0c93d71eff7052
data/bin/rego CHANGED
@@ -68,44 +68,19 @@ Main {
68
68
  @replacement = false
69
69
  end
70
70
 
71
- @paths, @command = @argv, command
71
+ _args, _command = @argv, command
72
+ _paths = _args.join(' ').strip.scan(/[^\s]+/)
72
73
 
73
- @paths = @paths.join(' ').strip.scan(/[^\s]+/)
74
- @command = @command.to_s.strip
75
-
76
- if @paths.empty?
77
- @paths.push('.')
74
+ if _paths.empty?
75
+ _paths.push '.'
78
76
  end
79
77
 
78
+ @paths = _args.join(' ').strip.scan(/[^\s]+/).sort.uniq
79
+ @command = _command.to_s.strip
80
+
80
81
  if @command.empty?
81
82
  @command = false
82
83
  end
83
-
84
- @paths.map! do |path|
85
- if test(?d, path)
86
- globbed =
87
- Dir.glob(
88
- File.join(path, '**/**'),
89
- File::FNM_DOTMATCH
90
- ).delete_if{|path| %w[ .. ].include?(File.basename(path))}
91
-
92
- [path, globbed]
93
- else
94
- path
95
- end
96
- end
97
-
98
- @paths.flatten!
99
- @paths.compact!
100
- @paths.uniq!
101
- @paths.map! do |path|
102
- begin
103
- Rego.realpath(path)
104
- rescue Object
105
- nil
106
- end
107
- end
108
- @paths.compact!
109
84
  end
110
85
 
111
86
  def print_a_summary_of_watched_files
@@ -191,144 +166,36 @@ Main {
191
166
  rego.call(:__START__)
192
167
 
193
168
  #
194
- fsevent = FSEvent.new
195
-
196
- options = {
197
- :latency => 0.01,
198
- :no_defer => true,
199
- :file_events => true,
200
- :since_when => 0
201
- }
202
169
 
203
- watchlist = (@files + @directories).uniq
204
-
205
- watching = watchlist.inject(Hash.new){|hash, path| hash.update(path => true)}
170
+ watchlist =
171
+ [].tap do |list|
172
+ @directories.each do |directory|
173
+ list.push directory
174
+ end
206
175
 
207
- fsevent.watch(watchlist, options) do |directories, meta|
208
- meta = Map.for(meta)
209
- events = meta.events
210
- paths = []
176
+ @files.each do |file|
177
+ list.push File.dirname(file)
178
+ end
211
179
 
212
- meta.events.each do |event|
213
- paths << event.path
180
+ list.flatten!
181
+ list.sort!
182
+ list.uniq!
214
183
  end
184
+
185
+ watching = watchlist.inject(Hash.new){|hash, path| hash.update(path => true)}
215
186
 
216
- paths.flatten.compact.sort.uniq.each do |path|
217
- path =
218
- begin
219
- Rego.realpath(path)
220
- rescue Object
221
- next
222
- end
223
-
224
- ignore = false # TODO
225
-
226
- unless ignore
227
- @initial_directories.each do |directory|
228
- if path =~ /^#{ Regexp.escape(directory) }\b/
229
- watching[path] = true
230
- end
231
- end
232
-
233
- if watching[path]
234
- before = stats[path]
235
- after = File.stat(path)
187
+ listener = Listen.to(*watchlist) do |modified, added, removed|
188
+ paths = [modified, added, removed].flatten.compact.sort.uniq
236
189
 
237
- if before.nil? or after.mtime > before.mtime
238
- stats[path] = after
239
- @started_at ||= Time.now.to_f
240
- q.push(path)
241
- end
242
- end
243
- end
190
+ paths.each do |path|
191
+ q.push(path)
244
192
  end
245
-
246
- =begin
247
- unless $running
248
- $running = true
249
-
250
- args.flatten.each do |dir|
251
- glob = File.join(dir, '**/**')
252
- entries = Dir.glob(glob)
253
-
254
- entries.each do |entry|
255
- entry = File.expand_path(entry)
256
- next unless stats.has_key?(entry)
257
-
258
- begin
259
- stats[entry] ||= File.stat(entry)
260
- before = stats[entry]
261
- after = File.stat(entry)
262
- rescue
263
- next
264
- end
265
-
266
- unless before.mtime == after.mtime
267
- stats[entry] = after
268
- rego[ entry ]
269
- end
270
- end
271
- end
272
- end
273
- $running = false
274
- =end
275
193
  end
276
194
 
277
- begin
278
- fsevent.run
279
- rescue SignalException
280
- exit(0)
281
- end
282
- end
283
- =begin
284
- fsevent = FSEvent.new
285
-
286
- fsevent.watch(
287
-
288
- @directories,
289
- :latency => 0.42,
290
- :no_defer => true,
291
- :file_events => true,
292
- :watch_root => true,
293
- :since_when => 0
294
-
295
- ) do |*args|
296
- unless $running
297
- $running = true
298
-
299
- args.flatten.each do |dir|
300
- glob = File.join(dir, '**/**')
301
- entries = Dir.glob(glob)
302
-
303
- entries.each do |entry|
304
- entry = File.expand_path(entry)
305
- next unless stats.has_key?(entry)
306
-
307
- begin
308
- stats[entry] ||= File.stat(entry)
309
- before = stats[entry]
310
- after = File.stat(entry)
311
- rescue
312
- next
313
- end
314
-
315
- unless before.mtime == after.mtime
316
- stats[entry] = after
317
- rego[ entry ]
318
- end
319
- end
320
- end
321
- end
322
- $running = false
323
- end
195
+ listener.start
324
196
 
325
- begin
326
- fsevent.run
327
- rescue SignalException
328
- exit(0)
329
- end
197
+ sleep
330
198
  end
331
- =end
332
199
  }
333
200
 
334
201
 
@@ -368,6 +235,7 @@ end
368
235
 
369
236
  require 'pathname'
370
237
  require 'thread'
238
+ require 'set'
371
239
 
372
240
  this = Pathname.new(__FILE__).realpath.to_s
373
241
  bindir = File.dirname(this)
@@ -1,5 +1,5 @@
1
1
  module Rego
2
- Version = '2.1.0' unless defined?(Version)
2
+ Version = '3.0.0' unless defined?(Version)
3
3
 
4
4
  def Rego.version
5
5
  Rego::Version
@@ -7,14 +7,14 @@ module Rego
7
7
 
8
8
  def Rego.dependencies
9
9
  {
10
- 'main' => [ 'main' , ' ~> 6.0' ] ,
11
- 'map' => [ 'map' , ' ~> 6.6' ] ,
12
- 'rb-fsevent' => [ 'rb-fsevent' , ' ~> 0.10' ] ,
10
+ 'main' => [ 'main' , ' ~> 6.0' ] ,
11
+ 'map' => [ 'map' , ' ~> 6.6' ] ,
12
+ 'listen' => [ 'listen' , '~> 3.0' ] ,
13
13
  }
14
14
  end
15
15
 
16
16
  def Rego.libdir(*args, &block)
17
- @libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'')
17
+ @libdir ||= File.basename(File.expand_path(__FILE__).sub(/\.rb$/,''))
18
18
  args.empty? ? @libdir : File.join(@libdir, *args)
19
19
  ensure
20
20
  if block
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rego"
6
- spec.version = "2.1.0"
6
+ spec.version = "3.0.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rego"
9
9
  spec.description = "description: rego kicks the ass"
@@ -32,7 +32,7 @@ Gem::Specification::new do |spec|
32
32
 
33
33
  spec.add_dependency(*["map", " ~> 6.6"])
34
34
 
35
- spec.add_dependency(*["rb-fsevent", " ~> 0.10"])
35
+ spec.add_dependency(*["listen", "~> 3.0"])
36
36
 
37
37
 
38
38
  spec.extensions.push(*[])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rego
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-02 00:00:00.000000000 Z
11
+ date: 2019-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: main
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '6.6'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rb-fsevent
42
+ name: listen
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.10'
47
+ version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.10'
54
+ version: '3.0'
55
55
  description: 'description: rego kicks the ass'
56
56
  email: ara.t.howard@gmail.com
57
57
  executables:
@@ -85,10 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubyforge_project: codeforpeople
89
- rubygems_version: 2.6.8
88
+ rubygems_version: 3.0.3
90
89
  signing_key:
91
90
  specification_version: 4
92
91
  summary: rego
93
92
  test_files: []
94
- has_rdoc: