rego 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +51 -0
- data/Rakefile +11 -7
- data/bin/rego +41 -7
- data/lib/rego.rb +2 -2
- data/rego.gemspec +4 -4
- metadata +7 -7
- data/2013-06-22-your-filename.md +0 -6
- data/README +0 -43
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzBhODQ2YjcxN2Q0OTIwYWM1Zjg5YTY1YzllOGRkOTg4ODBjMDU3Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Yjk2Y2YzN2IzYWNkZTI5MGU4YjFmMDljNTJiYjgyYWFkNjRlYmE0ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTQyN2IyODlkYTZiYzFlNGM2YWIxN2YxMDMzMjRiYzE3NWMxYjZlNThhZGYy
|
10
|
+
ZGFhNGFmY2ZkMDk3OTAxYTdmNjRhMWIwMWIyOTEyYzI5NTY5OTE5YWNjNDQw
|
11
|
+
N2FhMzAwN2QwNjdhMGQ5ZmJlYzhkNTljNjk2MjVmN2U0Y2U1MGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjY0ZWU5YWE2YWMwZmJmNDM2OWMxM2M5YTViMjljMWUwNjAwN2UwYWQyMTdl
|
14
|
+
NGYyNmQxYjQ2ZDJmN2E0YzFmZmE3ZmI3YjllYzc0Zjg4MmIyMDUzZmYwMGE0
|
15
|
+
M2Y0ZGYzYjE3MGFhN2Q5NjVjMGE3ZDZmOTU1YzBkNDkyZTc3MGM=
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
NAME
|
2
|
+
---------------
|
3
|
+
|
4
|
+
rego
|
5
|
+
|
6
|
+
SYNOPSIS
|
7
|
+
---------------
|
8
|
+
|
9
|
+
rego ./files ./to ./watch -- command-to-run
|
10
|
+
|
11
|
+
INSTALL
|
12
|
+
---------------
|
13
|
+
|
14
|
+
gem install rego
|
15
|
+
|
16
|
+
DESCRIPTION
|
17
|
+
---------------
|
18
|
+
|
19
|
+
run arbitrary commands easily when files change
|
20
|
+
|
21
|
+
PARAMETERS
|
22
|
+
---------------
|
23
|
+
|
24
|
+
--help, -h
|
25
|
+
|
26
|
+
EXAMPLES
|
27
|
+
---------------
|
28
|
+
|
29
|
+
```bash
|
30
|
+
|
31
|
+
# say hai whenever the file foo.txt changes
|
32
|
+
#
|
33
|
+
~> rego foo.txt -- echo hai
|
34
|
+
|
35
|
+
# say hai whenever any file (recursively) in bar changes
|
36
|
+
#
|
37
|
+
~> rego ./bar/ -- echo hai
|
38
|
+
|
39
|
+
# echo *the file that changed* when any file (recursively) in bar changes
|
40
|
+
#
|
41
|
+
~> rego ./bar/ -- echo "@ was changed"
|
42
|
+
|
43
|
+
# run a specific test whenever anything in lib, test, app, or config changes
|
44
|
+
#
|
45
|
+
~> rego {lib,test,app,config} -- ruby -Itest ./test/units/foo_test.rb --name teh_test
|
46
|
+
|
47
|
+
# run a specific test whenever it, or your app, has changed
|
48
|
+
#
|
49
|
+
~> rego ./test -- ruby -Itest @
|
50
|
+
|
51
|
+
```
|
data/Rakefile
CHANGED
@@ -3,6 +3,9 @@ This.author = "Ara T. Howard"
|
|
3
3
|
This.email = "ara.t.howard@gmail.com"
|
4
4
|
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
5
5
|
|
6
|
+
task :license do
|
7
|
+
open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
|
8
|
+
end
|
6
9
|
|
7
10
|
task :default do
|
8
11
|
puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
|
@@ -29,7 +32,7 @@ def run_tests!(which = nil)
|
|
29
32
|
|
30
33
|
test_rbs.each_with_index do |test_rb, index|
|
31
34
|
testno = index + 1
|
32
|
-
command = "#{
|
35
|
+
command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
|
33
36
|
|
34
37
|
puts
|
35
38
|
say(div, :color => :cyan, :bold => true)
|
@@ -60,7 +63,7 @@ end
|
|
60
63
|
task :gemspec do
|
61
64
|
ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
|
62
65
|
ignore_directories = ['pkg']
|
63
|
-
ignore_files = ['test/log'
|
66
|
+
ignore_files = ['test/log']
|
64
67
|
|
65
68
|
shiteless =
|
66
69
|
lambda do |list|
|
@@ -87,9 +90,10 @@ task :gemspec do
|
|
87
90
|
files = shiteless[Dir::glob("**/**")]
|
88
91
|
executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
|
89
92
|
#has_rdoc = true #File.exist?('doc')
|
90
|
-
test_files =
|
93
|
+
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
|
91
94
|
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
|
92
95
|
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
|
96
|
+
license = object.respond_to?(:license) ? object.license : "Ruby"
|
93
97
|
|
94
98
|
if This.extensions.nil?
|
95
99
|
This.extensions = []
|
@@ -100,7 +104,6 @@ task :gemspec do
|
|
100
104
|
end
|
101
105
|
extensions = [extensions].flatten.compact
|
102
106
|
|
103
|
-
# TODO
|
104
107
|
if This.dependencies.nil?
|
105
108
|
dependencies = []
|
106
109
|
else
|
@@ -127,6 +130,7 @@ task :gemspec do
|
|
127
130
|
spec.platform = Gem::Platform::RUBY
|
128
131
|
spec.summary = <%= lib.inspect %>
|
129
132
|
spec.description = <%= description.inspect %>
|
133
|
+
spec.license = <%= license.inspect %>
|
130
134
|
|
131
135
|
spec.files =\n<%= files.sort.pretty_inspect %>
|
132
136
|
spec.executables = <%= executables.inspect %>
|
@@ -188,8 +192,8 @@ task :readme do
|
|
188
192
|
end
|
189
193
|
|
190
194
|
template =
|
191
|
-
if test(?e, '
|
192
|
-
Template{ IO.read('
|
195
|
+
if test(?e, 'README.erb')
|
196
|
+
Template{ IO.read('README.erb') }
|
193
197
|
else
|
194
198
|
Template {
|
195
199
|
<<-__
|
@@ -293,7 +297,7 @@ BEGIN {
|
|
293
297
|
|
294
298
|
# discover full path to this ruby executable
|
295
299
|
#
|
296
|
-
c =
|
300
|
+
c = Config::CONFIG
|
297
301
|
bindir = c["bindir"] || c['BINDIR']
|
298
302
|
ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
|
299
303
|
ruby_ext = c['EXEEXT'] || ''
|
data/bin/rego
CHANGED
@@ -40,6 +40,13 @@ Main {
|
|
40
40
|
~> rego ./test -- ruby -Itest @
|
41
41
|
__
|
42
42
|
|
43
|
+
option('--replacement=replacement', '-r'){
|
44
|
+
default '@'
|
45
|
+
}
|
46
|
+
|
47
|
+
option('--no-replacement', '-n'){
|
48
|
+
}
|
49
|
+
|
43
50
|
def run
|
44
51
|
parse_the_command_line
|
45
52
|
print_a_summary_of_watched_files
|
@@ -47,11 +54,23 @@ Main {
|
|
47
54
|
end
|
48
55
|
|
49
56
|
def parse_the_command_line
|
50
|
-
|
57
|
+
# FIXME - this works around main.rb dropping '--' on the floor in @argv so
|
58
|
+
# we restore it and re-parse params to restore valid state. should be
|
59
|
+
# forward compatible if main fixes this though...
|
60
|
+
#
|
61
|
+
argv, command = ARGV.join(' ').split(/\s+--\s+/).map{|value| value.to_s.strip}
|
62
|
+
@argv = argv.scan(/[^\s]+/)
|
63
|
+
parse_parameters()
|
64
|
+
|
65
|
+
@replacement = params[:replacement].value
|
66
|
+
|
67
|
+
if params['no-replacement'].given?
|
68
|
+
@replacement = false
|
69
|
+
end
|
51
70
|
|
52
|
-
@paths, @command = argv
|
71
|
+
@paths, @command = @argv, command
|
53
72
|
|
54
|
-
@paths = @paths.
|
73
|
+
@paths = @paths.join(' ').strip.scan(/[^\s]+/)
|
55
74
|
@command = @command.to_s.strip
|
56
75
|
|
57
76
|
if @paths.empty?
|
@@ -59,7 +78,7 @@ Main {
|
|
59
78
|
end
|
60
79
|
|
61
80
|
if @command.empty?
|
62
|
-
@command =
|
81
|
+
@command = false
|
63
82
|
end
|
64
83
|
|
65
84
|
@paths.map!{|path| test(?d, path) ? [path, Dir.glob(File.join(path, '**/**'))] : path}
|
@@ -119,8 +138,14 @@ Main {
|
|
119
138
|
#
|
120
139
|
rego =
|
121
140
|
proc do |*args|
|
122
|
-
path = args.shift
|
123
|
-
|
141
|
+
path = args.flatten.compact.shift
|
142
|
+
|
143
|
+
cmd =
|
144
|
+
if @command
|
145
|
+
@replacement ? @command.gsub(@replacement, path) : @command
|
146
|
+
else
|
147
|
+
"echo #{ path.inspect }"
|
148
|
+
end
|
124
149
|
|
125
150
|
puts line
|
126
151
|
|
@@ -138,10 +163,18 @@ Main {
|
|
138
163
|
|
139
164
|
#
|
140
165
|
q = Queue.new
|
166
|
+
@started_at = nil
|
167
|
+
@fucking_hack = 1.42
|
141
168
|
|
142
169
|
Thread.new do
|
143
170
|
loop do
|
144
|
-
|
171
|
+
args = q.pop
|
172
|
+
|
173
|
+
running_for = Time.now.to_f - @started_at
|
174
|
+
|
175
|
+
if running_for > @fucking_hack
|
176
|
+
rego.call(*args)
|
177
|
+
end
|
145
178
|
end
|
146
179
|
end
|
147
180
|
|
@@ -179,6 +212,7 @@ Main {
|
|
179
212
|
|
180
213
|
if before.nil? or after.mtime > before.mtime
|
181
214
|
stats[path] = after
|
215
|
+
@started_at ||= Time.now.to_f
|
182
216
|
q.push(path)
|
183
217
|
end
|
184
218
|
end
|
data/lib/rego.rb
CHANGED
@@ -4,7 +4,7 @@ require 'yaml'
|
|
4
4
|
require 'tmpdir'
|
5
5
|
|
6
6
|
module Rego
|
7
|
-
Version = '1.
|
7
|
+
Version = '1.7.0' unless defined?(Version)
|
8
8
|
|
9
9
|
def version
|
10
10
|
Rego::Version
|
@@ -13,7 +13,7 @@ module Rego
|
|
13
13
|
def dependencies
|
14
14
|
{
|
15
15
|
'main' => [ 'main' , ' >= 4.8' ] ,
|
16
|
-
'rb-fsevent' => [ 'rb-fsevent' , ' >= 0.9'
|
16
|
+
'rb-fsevent' => [ 'rb-fsevent' , ' >= 0.9.4' ] ,
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
data/rego.gemspec
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "rego"
|
6
|
-
spec.version = "1.
|
6
|
+
spec.version = "1.7.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "rego"
|
9
9
|
spec.description = "description: rego kicks the ass"
|
10
|
+
spec.license = "Ruby"
|
10
11
|
|
11
12
|
spec.files =
|
12
|
-
["
|
13
|
-
"README",
|
13
|
+
["README.md",
|
14
14
|
"Rakefile",
|
15
15
|
"bin",
|
16
16
|
"bin/rego",
|
@@ -27,7 +27,7 @@ Gem::Specification::new do |spec|
|
|
27
27
|
|
28
28
|
spec.add_dependency(*["main", " >= 4.8"])
|
29
29
|
|
30
|
-
spec.add_dependency(*["rb-fsevent", " >= 0.9"])
|
30
|
+
spec.add_dependency(*["rb-fsevent", " >= 0.9.4"])
|
31
31
|
|
32
32
|
|
33
33
|
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: 1.
|
4
|
+
version: 1.7.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:
|
11
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: main
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.9.4
|
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:
|
40
|
+
version: 0.9.4
|
41
41
|
description: ! 'description: rego kicks the ass'
|
42
42
|
email: ara.t.howard@gmail.com
|
43
43
|
executables:
|
@@ -45,14 +45,14 @@ executables:
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
-
|
49
|
-
- README
|
48
|
+
- README.md
|
50
49
|
- Rakefile
|
51
50
|
- bin/rego
|
52
51
|
- lib/rego.rb
|
53
52
|
- rego.gemspec
|
54
53
|
homepage: https://github.com/ahoward/rego
|
55
|
-
licenses:
|
54
|
+
licenses:
|
55
|
+
- Ruby
|
56
56
|
metadata: {}
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options: []
|
data/2013-06-22-your-filename.md
DELETED
data/README
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
NAME
|
2
|
-
|
3
|
-
rego
|
4
|
-
|
5
|
-
SYNOPSIS
|
6
|
-
|
7
|
-
rego
|
8
|
-
|
9
|
-
[options]+
|
10
|
-
|
11
|
-
DESCRIPTION
|
12
|
-
|
13
|
-
run arbitrary commands easily when files change
|
14
|
-
|
15
|
-
PARAMETERS
|
16
|
-
|
17
|
-
--help, -h
|
18
|
-
|
19
|
-
EXAMPLES
|
20
|
-
|
21
|
-
### gem install rego
|
22
|
-
|
23
|
-
|
24
|
-
# say hai whenever the file foo.txt changes
|
25
|
-
#
|
26
|
-
~> rego foo.txt -- echo hai
|
27
|
-
|
28
|
-
# say hai whenever any file (recursively) in bar changes
|
29
|
-
#
|
30
|
-
~> rego ./bar/ -- echo hai
|
31
|
-
|
32
|
-
# echo *the file that changed* when any file (recursively) in bar changes
|
33
|
-
#
|
34
|
-
~> rego ./bar/ -- echo "@ was changed"
|
35
|
-
|
36
|
-
# run a specific test whenever anything in lib, test, app, or config changes
|
37
|
-
#
|
38
|
-
~> rego {lib,test,app,config} -- ruby -Itest ./test/units/foo_test.rb --name teh_test
|
39
|
-
|
40
|
-
# run a specific test whenever it, or your app, has changed
|
41
|
-
#
|
42
|
-
~> rego ./test -- ruby -Itest @
|
43
|
-
|