rego 1.5.2 → 1.6.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 +15 -0
  2. data/bin/rego +42 -3
  3. data/lib/rego.rb +1 -1
  4. data/rego.gemspec +1 -1
  5. metadata +5 -11
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDBmMTk2ZTFiMWNkODIxZjNmYjg1NTQ3ZGVjNzYyMWU3Mjk1MjkxNQ==
5
+ data.tar.gz: !binary |-
6
+ NTE5Mzc1OWY4NzExOWE2YTgzNDZmNmExMjEzMTZjYzBhMWM5OTAxZQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OGIwNGE0NDAwMjUzNTViN2E5MjIzNDdlNzE4ZGU4YTNhZjEwOTU0MTEzMTJm
10
+ ZmJkNTMwNTJkYTRhNDNlNzYxYjNkNzFjOGQwZWJmYTk0NzJiYWZmMTFjMzcy
11
+ MzVlMjIyZjA0ZWY5YjViYzI0OWQ1NGQ4ZGE0ZTllN2E2ZTFkNGI=
12
+ data.tar.gz: !binary |-
13
+ NzAzNzU5OThkMGY4YmEyYzk5Nzc3MmI1MzZhNWM2ZTg0NTg5NDRlMTRlYjQ1
14
+ NzhmYTVmZDNlNTFkNTA0NWNlNDE4MWRkMDdlNGViZmJmNDA0NzA2NjNiZjI1
15
+ MDlmYjMyYmVlZmU3MGJhZGE5NmJhZGRiNmFjNTRmN2Q0YWE5YzM=
data/bin/rego CHANGED
@@ -84,12 +84,14 @@ Main {
84
84
  end
85
85
 
86
86
  def loop_watching_files_and_running_commands
87
+ @initial_directories = []
87
88
  @directories = []
88
89
  @files = []
89
90
 
90
91
  @paths.each do |path|
91
92
  if test(?d, path)
92
93
  @directories.push(Rego.realpath(path))
94
+ @initial_directories.push(Rego.realpath(path))
93
95
  else
94
96
  @files.push(Rego.realpath(path))
95
97
  @directories.push(Rego.realpath(File.dirname(path)))
@@ -135,19 +137,54 @@ Main {
135
137
  end
136
138
 
137
139
  #
138
- rego.call()
140
+ q = Queue.new
141
+
142
+ Thread.new do
143
+ loop do
144
+ rego.call(q.pop)
145
+ end
146
+ end
147
+
139
148
 
140
149
  #
141
150
  fsevent = FSEvent.new
142
151
 
143
152
  options = {
144
- :latency => 0.42,
153
+ :latency => 0.01,
145
154
  :no_defer => true,
146
155
  :file_events => true,
147
156
  :since_when => 0
148
157
  }
149
158
 
150
- fsevent.watch(@directories, options) do |*args|
159
+ watching = (@files + @directories).inject(Hash.new){|hash, path| hash.update(path => true)}
160
+
161
+ fsevent.watch(@files + @directories, options) do |*args|
162
+ args.flatten.compact.each do |path|
163
+ path =
164
+ begin
165
+ Rego.realpath(path)
166
+ rescue Object
167
+ next
168
+ end
169
+
170
+ @initial_directories.each do |directory|
171
+ if path =~ /^#{ Regexp.escape(directory) }\b/
172
+ watching[path] = true
173
+ end
174
+ end
175
+
176
+ if watching[path]
177
+ before = stats[path]
178
+ after = File.stat(path)
179
+
180
+ if before.nil? or after.mtime > before.mtime
181
+ stats[path] = after
182
+ q.push(path)
183
+ end
184
+ end
185
+ end
186
+
187
+ =begin
151
188
  unless $running
152
189
  $running = true
153
190
 
@@ -175,6 +212,7 @@ Main {
175
212
  end
176
213
  end
177
214
  $running = false
215
+ =end
178
216
  end
179
217
 
180
218
  begin
@@ -270,6 +308,7 @@ if false
270
308
  end
271
309
 
272
310
  require 'pathname'
311
+ require 'thread'
273
312
 
274
313
  this = Pathname.new(__FILE__).realpath.to_s
275
314
  bindir = File.dirname(this)
data/lib/rego.rb CHANGED
@@ -4,7 +4,7 @@ require 'yaml'
4
4
  require 'tmpdir'
5
5
 
6
6
  module Rego
7
- Version = '1.5.2' unless defined?(Version)
7
+ Version = '1.6.0' unless defined?(Version)
8
8
 
9
9
  def version
10
10
  Rego::Version
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 = "1.5.2"
6
+ spec.version = "1.6.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rego"
9
9
  spec.description = "description: rego kicks the ass"
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rego
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
5
- prerelease:
4
+ version: 1.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ara T. Howard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-25 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: main
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rb-fsevent
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -58,26 +53,25 @@ files:
58
53
  - rego.gemspec
59
54
  homepage: https://github.com/ahoward/rego
60
55
  licenses: []
56
+ metadata: {}
61
57
  post_install_message:
62
58
  rdoc_options: []
63
59
  require_paths:
64
60
  - lib
65
61
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
62
  requirements:
68
63
  - - ! '>='
69
64
  - !ruby/object:Gem::Version
70
65
  version: '0'
71
66
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
67
  requirements:
74
68
  - - ! '>='
75
69
  - !ruby/object:Gem::Version
76
70
  version: '0'
77
71
  requirements: []
78
72
  rubyforge_project: codeforpeople
79
- rubygems_version: 1.8.23
73
+ rubygems_version: 2.0.3
80
74
  signing_key:
81
- specification_version: 3
75
+ specification_version: 4
82
76
  summary: rego
83
77
  test_files: []