rego 1.9.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/Rakefile +2 -2
- data/a.rb +14 -0
- data/bin/rego +13 -3
- data/lib/rego.rb +2 -106
- data/lib/rego/utils.rb +74 -0
- data/lib/rego/version.rb +34 -0
- data/rego.gemspec +12 -4
- data/tmp/bar.txt +0 -0
- data/tmp/foo.txt +0 -0
- metadata +32 -12
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NWE4YThlYTU3ZDNkMDYxMzg1NjMyM2U5OGUxNjY2MGZhZjgwMzUzM2UxMmFi
|
10
|
-
OWU3ZTUwZjBmZmZjYzgxNjI3OTJhNDE0MTIyN2E0ZWNiYTJmY2M2OTIwNmQ1
|
11
|
-
ZGRkODljZWU2ZWNkMzI4NzliZjBjYThjNzkyYTdkYWVhNWRiYjY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZDU4OTAwNGRhOWM5NTI3OWU0ZWU4MzdjZDFjZDE4MWE4ZDcwMDRhM2ZiYzgw
|
14
|
-
ZDhiNzIyYzc4MTBkYzUzN2VlZTAzNzE1NWFhOTBmZDk1NThlMjFlZjQ2Zjc5
|
15
|
-
OTAyMjAwODgxYmM2NjEwM2Q0ZDc3MjFkOTNmNmRkZjU0Yzc2MjU=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9fb6e8eb8a8d4955a5a913cf9f2714c558ac742c
|
4
|
+
data.tar.gz: 7a280fc424eb8ccea11558623ec4b42899db5c88
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40590d449e2c39840b7a773cceb4e8d601bfe46eb4eb42a49153c353e42ec8d7e3c71341a680f5539fff647fe3a38861b359d8cfcd6822f4f590690c0ae644e8
|
7
|
+
data.tar.gz: b1030576df67092e59464a8c1b32aba6aad6f67f51dbf04d2881da3e14515c06f06dbc4f2f5c3af95d9b53aa337682e8332515be275800f7aa284812b21dadb5
|
data/Rakefile
CHANGED
@@ -277,7 +277,7 @@ BEGIN {
|
|
277
277
|
#
|
278
278
|
version = ENV['VERSION']
|
279
279
|
unless version
|
280
|
-
require "./lib/#{ This.lib }"
|
280
|
+
require "./lib/#{ This.lib }/version.rb"
|
281
281
|
This.name = lib.capitalize
|
282
282
|
This.object = eval(This.name)
|
283
283
|
version = This.object.send(:version)
|
@@ -297,7 +297,7 @@ BEGIN {
|
|
297
297
|
|
298
298
|
# discover full path to this ruby executable
|
299
299
|
#
|
300
|
-
c =
|
300
|
+
c = RbConfig::CONFIG
|
301
301
|
bindir = c["bindir"] || c['BINDIR']
|
302
302
|
ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
|
303
303
|
ruby_ext = c['EXEEXT'] || ''
|
data/a.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rb-fsevent'
|
2
|
+
require 'map'
|
3
|
+
fsevent = FSEvent.new
|
4
|
+
fsevent.watch Dir.pwd do |paths, event_meta|
|
5
|
+
event_meta = Map.for(event_meta)
|
6
|
+
event_meta.events.each do |event|
|
7
|
+
puts "event ID: #{event.id}"
|
8
|
+
puts "path: #{event.path}"
|
9
|
+
puts "c flags: #{event.cflags}"
|
10
|
+
puts "named flags: #{event.flags.join(', ')}"
|
11
|
+
# named flags will include strings such as `ItemInodeMetaMod` or `OwnEvent`
|
12
|
+
end
|
13
|
+
end
|
14
|
+
fsevent.run
|
data/bin/rego
CHANGED
@@ -200,10 +200,20 @@ Main {
|
|
200
200
|
:since_when => 0
|
201
201
|
}
|
202
202
|
|
203
|
-
|
203
|
+
watchlist = (@files + @directories).uniq
|
204
204
|
|
205
|
-
|
206
|
-
|
205
|
+
watching = watchlist.inject(Hash.new){|hash, path| hash.update(path => true)}
|
206
|
+
|
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|
|
207
217
|
path =
|
208
218
|
begin
|
209
219
|
Rego.realpath(path)
|
data/lib/rego.rb
CHANGED
@@ -4,112 +4,8 @@ require 'yaml'
|
|
4
4
|
require 'tmpdir'
|
5
5
|
|
6
6
|
module Rego
|
7
|
-
|
8
|
-
|
9
|
-
def version
|
10
|
-
Rego::Version
|
11
|
-
end
|
12
|
-
|
13
|
-
def dependencies
|
14
|
-
{
|
15
|
-
'main' => [ 'main' , ' >= 6.0' ] ,
|
16
|
-
'rb-fsevent' => [ 'rb-fsevent' , ' >= 0.9.4' ] ,
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
def libdir(*args, &block)
|
21
|
-
@libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'')
|
22
|
-
args.empty? ? @libdir : File.join(@libdir, *args)
|
23
|
-
ensure
|
24
|
-
if block
|
25
|
-
begin
|
26
|
-
$LOAD_PATH.unshift(@libdir)
|
27
|
-
block.call()
|
28
|
-
ensure
|
29
|
-
$LOAD_PATH.shift()
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def load(*libs)
|
35
|
-
libs = libs.join(' ').scan(/[^\s+]+/)
|
36
|
-
Rego.libdir{ libs.each{|lib| Kernel.load(lib) } }
|
37
|
-
end
|
38
|
-
|
39
|
-
def realpath(path)
|
40
|
-
Pathname.new(path).realpath.to_s
|
41
|
-
end
|
42
|
-
|
43
|
-
def tmpdir(&block)
|
44
|
-
tmpdir = File.join(Dir.tmpdir, ['rego', Process.ppid.to_s, Process.pid.to_s, Thread.current.object_id.to_s].join('-') + '.d')
|
45
|
-
|
46
|
-
FileUtils.mkdir_p(tmpdir)
|
47
|
-
|
48
|
-
if block
|
49
|
-
begin
|
50
|
-
Dir.chdir(tmpdir, &block)
|
51
|
-
ensure
|
52
|
-
FileUtils.rm_rf(tmpdir)
|
53
|
-
at_exit{ `rm -rf #{ tmpdir }` }
|
54
|
-
end
|
55
|
-
else
|
56
|
-
tmpdir
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def say(phrase, *args)
|
61
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
62
|
-
options[:color] = args.shift.to_s.to_sym unless args.empty?
|
63
|
-
keys = options.keys
|
64
|
-
keys.each{|key| options[key.to_s.to_sym] = options.delete(key)}
|
65
|
-
|
66
|
-
color = options[:color]
|
67
|
-
bold = options.has_key?(:bold)
|
68
|
-
|
69
|
-
parts = [phrase]
|
70
|
-
|
71
|
-
if STDOUT.tty?
|
72
|
-
parts.unshift(ANSI[color]) if color
|
73
|
-
parts.unshift(ANSI[:bold]) if bold
|
74
|
-
parts.push(ANSI[:clear]) if parts.size > 1
|
75
|
-
end
|
76
|
-
|
77
|
-
method = options[:method] || :puts
|
78
|
-
|
79
|
-
send(method, parts.join)
|
80
|
-
end
|
81
|
-
|
82
|
-
ANSI = {
|
83
|
-
:clear => "\e[0m",
|
84
|
-
:reset => "\e[0m",
|
85
|
-
:erase_line => "\e[K",
|
86
|
-
:erase_char => "\e[P",
|
87
|
-
:bold => "\e[1m",
|
88
|
-
:dark => "\e[2m",
|
89
|
-
:underline => "\e[4m",
|
90
|
-
:underscore => "\e[4m",
|
91
|
-
:blink => "\e[5m",
|
92
|
-
:reverse => "\e[7m",
|
93
|
-
:concealed => "\e[8m",
|
94
|
-
:black => "\e[30m",
|
95
|
-
:red => "\e[31m",
|
96
|
-
:green => "\e[32m",
|
97
|
-
:yellow => "\e[33m",
|
98
|
-
:blue => "\e[34m",
|
99
|
-
:magenta => "\e[35m",
|
100
|
-
:cyan => "\e[36m",
|
101
|
-
:white => "\e[37m",
|
102
|
-
:on_black => "\e[40m",
|
103
|
-
:on_red => "\e[41m",
|
104
|
-
:on_green => "\e[42m",
|
105
|
-
:on_yellow => "\e[43m",
|
106
|
-
:on_blue => "\e[44m",
|
107
|
-
:on_magenta => "\e[45m",
|
108
|
-
:on_cyan => "\e[46m",
|
109
|
-
:on_white => "\e[47m"
|
110
|
-
}
|
111
|
-
|
112
|
-
extend(Rego)
|
7
|
+
require_relative 'rego/version.rb'
|
8
|
+
require_relative 'rego/utils.rb'
|
113
9
|
end
|
114
10
|
|
115
11
|
# gems
|
data/lib/rego/utils.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
module Rego
|
2
|
+
def Rego.realpath(path)
|
3
|
+
Pathname.new(path).realpath.to_s
|
4
|
+
end
|
5
|
+
|
6
|
+
def Rego.tmpdir(&block)
|
7
|
+
tmpdir = File.join(Dir.tmpdir, ['rego', Process.ppid.to_s, Process.pid.to_s, Thread.current.object_id.to_s].join('-') + '.d')
|
8
|
+
|
9
|
+
FileUtils.mkdir_p(tmpdir)
|
10
|
+
|
11
|
+
if block
|
12
|
+
begin
|
13
|
+
Dir.chdir(tmpdir, &block)
|
14
|
+
ensure
|
15
|
+
FileUtils.rm_rf(tmpdir)
|
16
|
+
at_exit{ `rm -rf #{ tmpdir }` }
|
17
|
+
end
|
18
|
+
else
|
19
|
+
tmpdir
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def Rego.say(phrase, *args)
|
24
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
25
|
+
options[:color] = args.shift.to_s.to_sym unless args.empty?
|
26
|
+
keys = options.keys
|
27
|
+
keys.each{|key| options[key.to_s.to_sym] = options.delete(key)}
|
28
|
+
|
29
|
+
color = options[:color]
|
30
|
+
bold = options.has_key?(:bold)
|
31
|
+
|
32
|
+
parts = [phrase]
|
33
|
+
|
34
|
+
if STDOUT.tty?
|
35
|
+
parts.unshift(ANSI[color]) if color
|
36
|
+
parts.unshift(ANSI[:bold]) if bold
|
37
|
+
parts.push(ANSI[:clear]) if parts.size > 1
|
38
|
+
end
|
39
|
+
|
40
|
+
method = options[:method] || :puts
|
41
|
+
|
42
|
+
send(method, parts.join)
|
43
|
+
end
|
44
|
+
|
45
|
+
ANSI = {
|
46
|
+
:clear => "\e[0m",
|
47
|
+
:reset => "\e[0m",
|
48
|
+
:erase_line => "\e[K",
|
49
|
+
:erase_char => "\e[P",
|
50
|
+
:bold => "\e[1m",
|
51
|
+
:dark => "\e[2m",
|
52
|
+
:underline => "\e[4m",
|
53
|
+
:underscore => "\e[4m",
|
54
|
+
:blink => "\e[5m",
|
55
|
+
:reverse => "\e[7m",
|
56
|
+
:concealed => "\e[8m",
|
57
|
+
:black => "\e[30m",
|
58
|
+
:red => "\e[31m",
|
59
|
+
:green => "\e[32m",
|
60
|
+
:yellow => "\e[33m",
|
61
|
+
:blue => "\e[34m",
|
62
|
+
:magenta => "\e[35m",
|
63
|
+
:cyan => "\e[36m",
|
64
|
+
:white => "\e[37m",
|
65
|
+
:on_black => "\e[40m",
|
66
|
+
:on_red => "\e[41m",
|
67
|
+
:on_green => "\e[42m",
|
68
|
+
:on_yellow => "\e[43m",
|
69
|
+
:on_blue => "\e[44m",
|
70
|
+
:on_magenta => "\e[45m",
|
71
|
+
:on_cyan => "\e[46m",
|
72
|
+
:on_white => "\e[47m"
|
73
|
+
}
|
74
|
+
end
|
data/lib/rego/version.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rego
|
2
|
+
Version = '2.0.0' unless defined?(Version)
|
3
|
+
|
4
|
+
def Rego.version
|
5
|
+
Rego::Version
|
6
|
+
end
|
7
|
+
|
8
|
+
def Rego.dependencies
|
9
|
+
{
|
10
|
+
'main' => [ 'main' , ' ~> 6.0' ] ,
|
11
|
+
'map' => [ 'map' , ' ~> 6.6' ] ,
|
12
|
+
'rb-fsevent' => [ 'rb-fsevent' , ' ~> 0.10' ] ,
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
def Rego.libdir(*args, &block)
|
17
|
+
@libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'')
|
18
|
+
args.empty? ? @libdir : File.join(@libdir, *args)
|
19
|
+
ensure
|
20
|
+
if block
|
21
|
+
begin
|
22
|
+
$LOAD_PATH.unshift(@libdir)
|
23
|
+
block.call()
|
24
|
+
ensure
|
25
|
+
$LOAD_PATH.shift()
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def Rego.load(*libs)
|
31
|
+
libs = libs.join(' ').scan(/[^\s+]+/)
|
32
|
+
Rego.libdir{ libs.each{|lib| Kernel.load(lib) } }
|
33
|
+
end
|
34
|
+
end
|
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 = "
|
6
|
+
spec.version = "2.0.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "rego"
|
9
9
|
spec.description = "description: rego kicks the ass"
|
@@ -12,11 +12,17 @@ Gem::Specification::new do |spec|
|
|
12
12
|
spec.files =
|
13
13
|
["README.md",
|
14
14
|
"Rakefile",
|
15
|
+
"a.rb",
|
15
16
|
"bin",
|
16
17
|
"bin/rego",
|
17
18
|
"lib",
|
19
|
+
"lib/rego",
|
18
20
|
"lib/rego.rb",
|
19
|
-
"rego.
|
21
|
+
"lib/rego/utils.rb",
|
22
|
+
"lib/rego/version.rb",
|
23
|
+
"rego.gemspec",
|
24
|
+
"tmp/bar.txt",
|
25
|
+
"tmp/foo.txt"]
|
20
26
|
|
21
27
|
spec.executables = ["rego"]
|
22
28
|
|
@@ -25,9 +31,11 @@ Gem::Specification::new do |spec|
|
|
25
31
|
spec.test_files = nil
|
26
32
|
|
27
33
|
|
28
|
-
spec.add_dependency(*["main", "
|
34
|
+
spec.add_dependency(*["main", " ~> 6.0"])
|
29
35
|
|
30
|
-
spec.add_dependency(*["
|
36
|
+
spec.add_dependency(*["map", " ~> 6.6"])
|
37
|
+
|
38
|
+
spec.add_dependency(*["rb-fsevent", " ~> 0.10"])
|
31
39
|
|
32
40
|
|
33
41
|
spec.extensions.push(*[])
|
data/tmp/bar.txt
ADDED
File without changes
|
data/tmp/foo.txt
ADDED
File without changes
|
metadata
CHANGED
@@ -1,44 +1,58 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rego
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.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:
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: main
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '6.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
26
|
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: map
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '6.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '6.6'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rb-fsevent
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
47
|
+
version: '0.10'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
41
|
-
description:
|
54
|
+
version: '0.10'
|
55
|
+
description: 'description: rego kicks the ass'
|
42
56
|
email: ara.t.howard@gmail.com
|
43
57
|
executables:
|
44
58
|
- rego
|
@@ -47,9 +61,14 @@ extra_rdoc_files: []
|
|
47
61
|
files:
|
48
62
|
- README.md
|
49
63
|
- Rakefile
|
64
|
+
- a.rb
|
50
65
|
- bin/rego
|
51
66
|
- lib/rego.rb
|
67
|
+
- lib/rego/utils.rb
|
68
|
+
- lib/rego/version.rb
|
52
69
|
- rego.gemspec
|
70
|
+
- tmp/bar.txt
|
71
|
+
- tmp/foo.txt
|
53
72
|
homepage: https://github.com/ahoward/rego
|
54
73
|
licenses:
|
55
74
|
- Ruby
|
@@ -60,18 +79,19 @@ require_paths:
|
|
60
79
|
- lib
|
61
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
81
|
requirements:
|
63
|
-
- -
|
82
|
+
- - ">="
|
64
83
|
- !ruby/object:Gem::Version
|
65
84
|
version: '0'
|
66
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
86
|
requirements:
|
68
|
-
- -
|
87
|
+
- - ">="
|
69
88
|
- !ruby/object:Gem::Version
|
70
89
|
version: '0'
|
71
90
|
requirements: []
|
72
91
|
rubyforge_project: codeforpeople
|
73
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.6.8
|
74
93
|
signing_key:
|
75
94
|
specification_version: 4
|
76
95
|
summary: rego
|
77
96
|
test_files: []
|
97
|
+
has_rdoc:
|