rego 3.0.0 → 3.1.0

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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -8
  3. data/bin/rego +159 -27
  4. data/lib/rego/_lib.rb +4 -4
  5. data/rego.gemspec +4 -5
  6. metadata +13 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb49b3d2016108b3dec5ada89bc0e68ab2a5910845a629926929f10510a62f2c
4
- data.tar.gz: 27aac62ef93b549bb813978e17b1202c8b5af1ce06c4324fed147bcebbdc4bc2
3
+ metadata.gz: 738b5c494fd8dd07635d1e6602d898cd79877e4c0f9681d58a7063e15bb2fb06
4
+ data.tar.gz: f7c8175cee2dfdca458668d645fef5cbedec4e98d95c8a05313448211c3f6261
5
5
  SHA512:
6
- metadata.gz: 9e4ae3bf5f6947650575517dc3d679983e119e724f50f9edf5e6474d850067439766633b2022a0c706d226ff4f4aeb89b85f18d8979d76eaaacb1a27f25f6dee
7
- data.tar.gz: a9e310138224b88f4f4b3a9858a3a3dd3517f97c7525884a4a521d50e27425d72c0a7ecdda004aab34fd98b1a68ae90226384764d87ccf995c0c93d71eff7052
6
+ metadata.gz: 8fba73063ba506990915c357a9c14a8b67ca267fa113da53f013301207ffce16a5b39dafc5d72ff2fe802556181361291905bde7707ee5a16fb151f47121999b
7
+ data.tar.gz: 61465a39a564df08a505fa9c35984b35edd7360f46e757dfea5c8a70fd27517d34950f31b4f11c7cbc8a162e6f406a7369b235e890961c5e4d31620c85cc8101
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- This.rubyforge_project = 'codeforpeople'
2
1
  This.author = "Ara T. Howard"
3
2
  This.email = "ara.t.howard@gmail.com"
4
3
  This.homepage = "https://github.com/ahoward/#{ This.lib }"
@@ -145,7 +144,6 @@ task :gemspec do
145
144
 
146
145
  spec.extensions.push(*<%= extensions.inspect %>)
147
146
 
148
- spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
149
147
  spec.author = <%= This.author.inspect %>
150
148
  spec.email = <%= This.email.inspect %>
151
149
  spec.homepage = <%= This.homepage.inspect %>
@@ -230,12 +228,6 @@ task :release => [:clean, :gemspec, :gem] do
230
228
  puts
231
229
  system(cmd)
232
230
  abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
233
-
234
- cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
235
- puts cmd
236
- puts
237
- system(cmd)
238
- abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
239
231
  end
240
232
 
241
233
 
data/bin/rego CHANGED
@@ -68,19 +68,44 @@ Main {
68
68
  @replacement = false
69
69
  end
70
70
 
71
- _args, _command = @argv, command
72
- _paths = _args.join(' ').strip.scan(/[^\s]+/)
71
+ @paths, @command = @argv, command
73
72
 
74
- if _paths.empty?
75
- _paths.push '.'
76
- end
73
+ @paths = @paths.join(' ').strip.scan(/[^\s]+/)
74
+ @command = @command.to_s.strip
77
75
 
78
- @paths = _args.join(' ').strip.scan(/[^\s]+/).sort.uniq
79
- @command = _command.to_s.strip
76
+ if @paths.empty?
77
+ @paths.push('.')
78
+ end
80
79
 
81
80
  if @command.empty?
82
81
  @command = false
83
82
  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!
84
109
  end
85
110
 
86
111
  def print_a_summary_of_watched_files
@@ -166,36 +191,144 @@ Main {
166
191
  rego.call(:__START__)
167
192
 
168
193
  #
194
+ fsevent = FSEvent.new
169
195
 
170
- watchlist =
171
- [].tap do |list|
172
- @directories.each do |directory|
173
- list.push directory
174
- end
196
+ options = {
197
+ :latency => 0.01,
198
+ :no_defer => true,
199
+ :file_events => true,
200
+ :since_when => 0
201
+ }
175
202
 
176
- @files.each do |file|
177
- list.push File.dirname(file)
178
- end
203
+ watchlist = (@files + @directories).uniq
179
204
 
180
- list.flatten!
181
- list.sort!
182
- list.uniq!
183
- end
184
-
185
205
  watching = watchlist.inject(Hash.new){|hash, path| hash.update(path => true)}
186
206
 
187
- listener = Listen.to(*watchlist) do |modified, added, removed|
188
- paths = [modified, added, removed].flatten.compact.sort.uniq
207
+ fsevent.watch(watchlist, options) do |directories, meta|
208
+ meta = Map.for(meta)
209
+ events = meta.events
210
+ paths = []
211
+
212
+ meta.events.each do |event|
213
+ paths << event.path
214
+ end
215
+
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)
189
236
 
190
- paths.each do |path|
191
- q.push(path)
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
192
244
  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
193
275
  end
194
276
 
195
- listener.start
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
196
324
 
197
- sleep
325
+ begin
326
+ fsevent.run
327
+ rescue SignalException
328
+ exit(0)
329
+ end
198
330
  end
331
+ =end
199
332
  }
200
333
 
201
334
 
@@ -235,7 +368,6 @@ end
235
368
 
236
369
  require 'pathname'
237
370
  require 'thread'
238
- require 'set'
239
371
 
240
372
  this = Pathname.new(__FILE__).realpath.to_s
241
373
  bindir = File.dirname(this)
data/lib/rego/_lib.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Rego
2
- Version = '3.0.0' unless defined?(Version)
2
+ Version = '3.1.0' unless defined?(Version)
3
3
 
4
4
  def Rego.version
5
5
  Rego::Version
@@ -7,9 +7,9 @@ module Rego
7
7
 
8
8
  def Rego.dependencies
9
9
  {
10
- 'main' => [ 'main' , ' ~> 6.0' ] ,
11
- 'map' => [ 'map' , ' ~> 6.6' ] ,
12
- 'listen' => [ 'listen' , '~> 3.0' ] ,
10
+ 'main' => [ 'main' , ' ~> 6.3.0' ] ,
11
+ 'map' => [ 'map' , ' ~> 6.6.0' ] ,
12
+ 'rb-fsevent' => [ 'rb-fsevent' , ' ~> 0.11.2' ] ,
13
13
  }
14
14
  end
15
15
 
data/rego.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rego"
6
- spec.version = "3.0.0"
6
+ spec.version = "3.1.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rego"
9
9
  spec.description = "description: rego kicks the ass"
@@ -28,16 +28,15 @@ Gem::Specification::new do |spec|
28
28
  spec.test_files = nil
29
29
 
30
30
 
31
- spec.add_dependency(*["main", " ~> 6.0"])
31
+ spec.add_dependency(*["main", " ~> 6.3.0"])
32
32
 
33
- spec.add_dependency(*["map", " ~> 6.6"])
33
+ spec.add_dependency(*["map", " ~> 6.6.0"])
34
34
 
35
- spec.add_dependency(*["listen", "~> 3.0"])
35
+ spec.add_dependency(*["rb-fsevent", " ~> 0.11.2"])
36
36
 
37
37
 
38
38
  spec.extensions.push(*[])
39
39
 
40
- spec.rubyforge_project = "codeforpeople"
41
40
  spec.author = "Ara T. Howard"
42
41
  spec.email = "ara.t.howard@gmail.com"
43
42
  spec.homepage = "https://github.com/ahoward/rego"
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: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-30 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: main
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: 6.3.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: 6.3.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: map
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.6'
33
+ version: 6.6.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '6.6'
40
+ version: 6.6.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: listen
42
+ name: rb-fsevent
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: 0.11.2
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: '3.0'
54
+ version: 0.11.2
55
55
  description: 'description: rego kicks the ass'
56
56
  email: ara.t.howard@gmail.com
57
57
  executables:
@@ -70,7 +70,7 @@ homepage: https://github.com/ahoward/rego
70
70
  licenses:
71
71
  - Ruby
72
72
  metadata: {}
73
- post_install_message:
73
+ post_install_message:
74
74
  rdoc_options: []
75
75
  require_paths:
76
76
  - lib
@@ -85,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.0.3
89
- signing_key:
88
+ rubygems_version: 3.3.7
89
+ signing_key:
90
90
  specification_version: 4
91
91
  summary: rego
92
92
  test_files: []