cuco 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/bin/cuco +3 -3
- data/lib/{controller.rb → cuco/controller.rb} +14 -3
- data/lib/{version.rb → cuco/version.rb} +3 -1
- metadata +11 -21
- data/.github/workflows/rake.yml +0 -31
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.watchr +0 -9
- data/Gemfile +0 -11
- data/Gemfile.lock +0 -184
- data/Rakefile +0 -11
- data/cuco.gemspec +0 -24
- data/test/controller_test.rb +0 -52
- data/test/cuco_test.rb +0 -29
- data/test/script_test.rb +0 -29
- data/test/test_helper.rb +0 -14
- /data/{LICENSE-MIT → MIT-LICENSE} +0 -0
- /data/lib/{cuco.rb → cuco/cuco.rb} +0 -0
- /data/lib/{script.rb → cuco/script.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7caa6f2db505a694828f8617ab2f84cfc8807e859e6a224f85da20c47baa7bf0
|
4
|
+
data.tar.gz: a37b963ca861435eec245de81b4e5f63e5ac3aa7e63f1ae262c96bc7a3471a50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a8be2228d6913c8f0522d2f67a2053539f87fd786389d814367d77c2d4d99ab36a90f67bfc35b5e122ed0e9333e56a943cfdbb9b82448e37453c57d5b2eebc
|
7
|
+
data.tar.gz: 8a4cb238abdcd19ffbee6af5ebb3ad6e25bb41bb92b29b3cd17c46feb8d1ab1c8a86a72ddfb4cb47a3e8478c63e9a2f4c6bce77ccafb87f0aaebf9737bf4e86d
|
data/README.md
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/cuco)
|
4
4
|
[](https://rubygems.org/gems/cuco)
|
5
|
+
[](http://choosealicense.com/licenses/mit/)
|
5
6
|
|
6
|
-
*Cuco*
|
7
|
+
*Cuco* watches files in a directory and take an action when they change.
|
7
8
|
|
8
9
|
*Cuco* is controlled by a user-supplied script file.
|
9
10
|
Intermixed "watch" commands specify what to do
|
@@ -38,7 +39,10 @@ $ cuco path/to/script/file
|
|
38
39
|
will monitor files in the current directory tree
|
39
40
|
and react to events on those files in accordance with the script.
|
40
41
|
|
41
|
-
## A simple example of a script file
|
42
|
+
## A simple example of a script file
|
43
|
+
|
44
|
+
This sample script is intended for testing purposes with Minitest.
|
45
|
+
*md* is the match-data (see Ruby regular expressions).
|
42
46
|
|
43
47
|
```ruby
|
44
48
|
watch( 'test/.*_test\.rb$' ) { |md| run_it(md[0]) }
|
@@ -59,7 +63,6 @@ Scripts are pure Ruby.
|
|
59
63
|
Intermixed are "watch" rules that match observed files to an action.
|
60
64
|
The matching is achieved by a pattern (a regular expression) parameter.
|
61
65
|
The action is specified by a block (see above sample).
|
62
|
-
*md* is the match-data.
|
63
66
|
|
64
67
|
Updates to script files are picked up on the fly (no need to restart *cuco*)
|
65
68
|
so experimenting is painless.
|
@@ -69,6 +72,8 @@ since the whole command is custom.
|
|
69
72
|
The above actions could just as easily call "jruby", "ruby --rubygems",
|
70
73
|
"ruby -I lib", etc. or any combination of these.
|
71
74
|
|
75
|
+
See directory _scripts_ for samples.
|
76
|
+
|
72
77
|
## Miscellaneous
|
73
78
|
|
74
79
|
*Cuco* is heavily inspired by:
|
data/bin/cuco
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
lib = File.expand_path("../lib/", __dir__)
|
4
4
|
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
5
5
|
|
6
|
-
require "version"
|
7
|
-
require "cuco"
|
8
|
-
require "controller"
|
6
|
+
require "cuco/version"
|
7
|
+
require "cuco/cuco"
|
8
|
+
require "cuco/controller"
|
9
9
|
require "micro-optparse"
|
10
10
|
|
11
11
|
options = Parser.new do |p|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "listen"
|
2
2
|
require "singleton"
|
3
|
-
require "cuco"
|
4
|
-
require "script"
|
3
|
+
require "cuco/cuco"
|
4
|
+
require "cuco/script"
|
5
5
|
|
6
6
|
class Controller
|
7
7
|
include Singleton
|
@@ -40,7 +40,18 @@ class Controller
|
|
40
40
|
|
41
41
|
def file_run(pattern, type = nil)
|
42
42
|
puts "*** file_run(#{pattern}, #{type})" if debug
|
43
|
-
|
43
|
+
rules = find_rules(pattern, type)
|
44
|
+
rules.each { |rule| match_run(rule, pattern) }
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def find_rules(pattern, type)
|
50
|
+
puts "*** find_rules(#{pattern}, #{type})" if debug
|
51
|
+
G.script.__rules.reverse.select { |rule|
|
52
|
+
pattern.match(rule.pattern) &&
|
53
|
+
(rule.event_type.nil? || rule.event_type == type)
|
54
|
+
}
|
44
55
|
end
|
45
56
|
|
46
57
|
def match_run(rule, pattern)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: micro-optparse
|
@@ -71,27 +71,17 @@ email: dittmar.krall@matiq.de
|
|
71
71
|
executables:
|
72
72
|
- cuco
|
73
73
|
extensions: []
|
74
|
-
extra_rdoc_files:
|
74
|
+
extra_rdoc_files:
|
75
|
+
- README.md
|
76
|
+
- MIT-LICENSE
|
75
77
|
files:
|
76
|
-
-
|
77
|
-
- ".ruby-gemset"
|
78
|
-
- ".ruby-version"
|
79
|
-
- ".watchr"
|
80
|
-
- Gemfile
|
81
|
-
- Gemfile.lock
|
82
|
-
- LICENSE-MIT
|
78
|
+
- MIT-LICENSE
|
83
79
|
- README.md
|
84
|
-
- Rakefile
|
85
80
|
- bin/cuco
|
86
|
-
- cuco.
|
87
|
-
- lib/
|
88
|
-
- lib/cuco.rb
|
89
|
-
- lib/
|
90
|
-
- lib/version.rb
|
91
|
-
- test/controller_test.rb
|
92
|
-
- test/cuco_test.rb
|
93
|
-
- test/script_test.rb
|
94
|
-
- test/test_helper.rb
|
81
|
+
- lib/cuco/controller.rb
|
82
|
+
- lib/cuco/cuco.rb
|
83
|
+
- lib/cuco/script.rb
|
84
|
+
- lib/cuco/version.rb
|
95
85
|
homepage: http://www.matiq.de
|
96
86
|
licenses:
|
97
87
|
- MIT
|
@@ -111,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
101
|
- !ruby/object:Gem::Version
|
112
102
|
version: '0'
|
113
103
|
requirements: []
|
114
|
-
rubygems_version: 3.5.
|
104
|
+
rubygems_version: 3.5.9
|
115
105
|
signing_key:
|
116
106
|
specification_version: 4
|
117
107
|
summary: A file watcher
|
data/.github/workflows/rake.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# see also https://github.com/whitequark/parser/blob/master/.github/workflows/test.yml
|
2
|
-
name: Rake
|
3
|
-
|
4
|
-
on: [push]
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
os: [ubuntu-latest]
|
12
|
-
ruby: ["3.0", 3.3]
|
13
|
-
test_command: ["bundle exec rake"]
|
14
|
-
runs-on: ${{ matrix.os }}
|
15
|
-
|
16
|
-
steps:
|
17
|
-
- uses: actions/checkout@v3
|
18
|
-
- name: Set up Ruby
|
19
|
-
uses: ruby/setup-ruby@v1
|
20
|
-
with:
|
21
|
-
ruby-version: ${{ matrix.ruby_version }}
|
22
|
-
# bundler-cache: true
|
23
|
-
# - name: Build and test with Rake
|
24
|
-
# run: bundle exec rake
|
25
|
-
- name: Bundle install
|
26
|
-
run: |
|
27
|
-
bundle config path /home/runner/bundle
|
28
|
-
bundle install
|
29
|
-
bundle update
|
30
|
-
- name: test with Rake
|
31
|
-
run: ${{ matrix.test_command }}
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rails-7.1
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby-3.3.0
|
data/.watchr
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
watch('test/.*_test\.rb$') { |md| run_it(md[0]) }
|
2
|
-
watch('lib/(.*)\.rb$') { |md| run_it("test/#{md[1]}_test.rb") }
|
3
|
-
|
4
|
-
def run_it(file)
|
5
|
-
system %(bundle exec ruby -I test #{file})
|
6
|
-
end
|
7
|
-
|
8
|
-
Signal.trap("QUIT") { system("bundle exec rake") } # Ctrl-\ or ctrl-4
|
9
|
-
Signal.trap("INT") { abort("Interrupted\n") } # Ctrl-C
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
cuco (0.1.0)
|
5
|
-
listen
|
6
|
-
micro-optparse
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionpack (7.1.3.2)
|
12
|
-
actionview (= 7.1.3.2)
|
13
|
-
activesupport (= 7.1.3.2)
|
14
|
-
nokogiri (>= 1.8.5)
|
15
|
-
racc
|
16
|
-
rack (>= 2.2.4)
|
17
|
-
rack-session (>= 1.0.1)
|
18
|
-
rack-test (>= 0.6.3)
|
19
|
-
rails-dom-testing (~> 2.2)
|
20
|
-
rails-html-sanitizer (~> 1.6)
|
21
|
-
actionview (7.1.3.2)
|
22
|
-
activesupport (= 7.1.3.2)
|
23
|
-
builder (~> 3.1)
|
24
|
-
erubi (~> 1.11)
|
25
|
-
rails-dom-testing (~> 2.2)
|
26
|
-
rails-html-sanitizer (~> 1.6)
|
27
|
-
activesupport (7.1.3.2)
|
28
|
-
base64
|
29
|
-
bigdecimal
|
30
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
31
|
-
connection_pool (>= 2.2.5)
|
32
|
-
drb
|
33
|
-
i18n (>= 1.6, < 2)
|
34
|
-
minitest (>= 5.1)
|
35
|
-
mutex_m
|
36
|
-
tzinfo (~> 2.0)
|
37
|
-
ast (2.4.2)
|
38
|
-
base64 (0.2.0)
|
39
|
-
bigdecimal (3.1.7)
|
40
|
-
builder (3.2.4)
|
41
|
-
concurrent-ruby (1.2.3)
|
42
|
-
connection_pool (2.4.1)
|
43
|
-
crass (1.0.6)
|
44
|
-
docile (1.4.0)
|
45
|
-
drb (2.2.1)
|
46
|
-
erubi (1.12.0)
|
47
|
-
ffi (1.16.3)
|
48
|
-
i18n (1.14.4)
|
49
|
-
concurrent-ruby (~> 1.0)
|
50
|
-
io-console (0.7.2)
|
51
|
-
irb (1.12.0)
|
52
|
-
rdoc
|
53
|
-
reline (>= 0.4.2)
|
54
|
-
json (2.7.1)
|
55
|
-
language_server-protocol (3.17.0.3)
|
56
|
-
lint_roller (1.1.0)
|
57
|
-
listen (3.9.0)
|
58
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
59
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
60
|
-
loofah (2.22.0)
|
61
|
-
crass (~> 1.0.2)
|
62
|
-
nokogiri (>= 1.12.0)
|
63
|
-
micro-optparse (1.2.1)
|
64
|
-
minitest (5.22.3)
|
65
|
-
minitest-spec-rails (7.2.0)
|
66
|
-
minitest (>= 5.0)
|
67
|
-
railties (>= 4.1)
|
68
|
-
mutex_m (0.2.0)
|
69
|
-
nokogiri (1.16.3-aarch64-linux)
|
70
|
-
racc (~> 1.4)
|
71
|
-
nokogiri (1.16.3-arm-linux)
|
72
|
-
racc (~> 1.4)
|
73
|
-
nokogiri (1.16.3-arm64-darwin)
|
74
|
-
racc (~> 1.4)
|
75
|
-
nokogiri (1.16.3-x86-linux)
|
76
|
-
racc (~> 1.4)
|
77
|
-
nokogiri (1.16.3-x86_64-darwin)
|
78
|
-
racc (~> 1.4)
|
79
|
-
nokogiri (1.16.3-x86_64-linux)
|
80
|
-
racc (~> 1.4)
|
81
|
-
parallel (1.24.0)
|
82
|
-
parser (3.3.0.5)
|
83
|
-
ast (~> 2.4.1)
|
84
|
-
racc
|
85
|
-
psych (5.1.2)
|
86
|
-
stringio
|
87
|
-
racc (1.7.3)
|
88
|
-
rack (3.0.9.1)
|
89
|
-
rack-session (2.0.0)
|
90
|
-
rack (>= 3.0.0)
|
91
|
-
rack-test (2.1.0)
|
92
|
-
rack (>= 1.3)
|
93
|
-
rackup (2.1.0)
|
94
|
-
rack (>= 3)
|
95
|
-
webrick (~> 1.8)
|
96
|
-
rails-dom-testing (2.2.0)
|
97
|
-
activesupport (>= 5.0.0)
|
98
|
-
minitest
|
99
|
-
nokogiri (>= 1.6)
|
100
|
-
rails-html-sanitizer (1.6.0)
|
101
|
-
loofah (~> 2.21)
|
102
|
-
nokogiri (~> 1.14)
|
103
|
-
railties (7.1.3.2)
|
104
|
-
actionpack (= 7.1.3.2)
|
105
|
-
activesupport (= 7.1.3.2)
|
106
|
-
irb
|
107
|
-
rackup (>= 1.0.0)
|
108
|
-
rake (>= 12.2)
|
109
|
-
thor (~> 1.0, >= 1.2.2)
|
110
|
-
zeitwerk (~> 2.6)
|
111
|
-
rainbow (3.1.1)
|
112
|
-
rake (13.1.0)
|
113
|
-
rb-fsevent (0.11.2)
|
114
|
-
rb-inotify (0.10.1)
|
115
|
-
ffi (~> 1.0)
|
116
|
-
rdoc (6.6.2)
|
117
|
-
psych (>= 4.0.0)
|
118
|
-
regexp_parser (2.9.0)
|
119
|
-
reline (0.4.3)
|
120
|
-
io-console (~> 0.5)
|
121
|
-
rexml (3.2.6)
|
122
|
-
ricecream (0.2.1)
|
123
|
-
rubocop (1.62.1)
|
124
|
-
json (~> 2.3)
|
125
|
-
language_server-protocol (>= 3.17.0)
|
126
|
-
parallel (~> 1.10)
|
127
|
-
parser (>= 3.3.0.2)
|
128
|
-
rainbow (>= 2.2.2, < 4.0)
|
129
|
-
regexp_parser (>= 1.8, < 3.0)
|
130
|
-
rexml (>= 3.2.5, < 4.0)
|
131
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
132
|
-
ruby-progressbar (~> 1.7)
|
133
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
134
|
-
rubocop-ast (1.31.2)
|
135
|
-
parser (>= 3.3.0.4)
|
136
|
-
rubocop-performance (1.20.2)
|
137
|
-
rubocop (>= 1.48.1, < 2.0)
|
138
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
139
|
-
ruby-progressbar (1.13.0)
|
140
|
-
simplecov (0.22.0)
|
141
|
-
docile (~> 1.1)
|
142
|
-
simplecov-html (~> 0.11)
|
143
|
-
simplecov_json_formatter (~> 0.1)
|
144
|
-
simplecov-html (0.12.3)
|
145
|
-
simplecov_json_formatter (0.1.4)
|
146
|
-
standard (1.35.1)
|
147
|
-
language_server-protocol (~> 3.17.0.2)
|
148
|
-
lint_roller (~> 1.0)
|
149
|
-
rubocop (~> 1.62.0)
|
150
|
-
standard-custom (~> 1.0.0)
|
151
|
-
standard-performance (~> 1.3)
|
152
|
-
standard-custom (1.0.2)
|
153
|
-
lint_roller (~> 1.0)
|
154
|
-
rubocop (~> 1.50)
|
155
|
-
standard-performance (1.3.1)
|
156
|
-
lint_roller (~> 1.1)
|
157
|
-
rubocop-performance (~> 1.20.2)
|
158
|
-
stringio (3.1.0)
|
159
|
-
thor (1.3.1)
|
160
|
-
tzinfo (2.0.6)
|
161
|
-
concurrent-ruby (~> 1.0)
|
162
|
-
unicode-display_width (2.5.0)
|
163
|
-
webrick (1.8.1)
|
164
|
-
zeitwerk (2.6.13)
|
165
|
-
|
166
|
-
PLATFORMS
|
167
|
-
aarch64-linux
|
168
|
-
arm-linux
|
169
|
-
arm64-darwin
|
170
|
-
x86-linux
|
171
|
-
x86_64-darwin
|
172
|
-
x86_64-linux
|
173
|
-
|
174
|
-
DEPENDENCIES
|
175
|
-
cuco!
|
176
|
-
minitest
|
177
|
-
minitest-spec-rails
|
178
|
-
rake
|
179
|
-
ricecream
|
180
|
-
simplecov
|
181
|
-
standard
|
182
|
-
|
183
|
-
BUNDLED WITH
|
184
|
-
2.5.6
|
data/Rakefile
DELETED
data/cuco.gemspec
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require File.expand_path("../lib/version", __FILE__)
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = "cuco"
|
5
|
-
s.version = Cuco::VERSION
|
6
|
-
s.summary = "A file watcher"
|
7
|
-
s.description = "A simple and flexible file watcher"
|
8
|
-
|
9
|
-
s.authors = ["Dittmar Krall"]
|
10
|
-
s.email = "dittmar.krall@matiq.de"
|
11
|
-
s.homepage = "http://www.matiq.de"
|
12
|
-
s.license = "MIT"
|
13
|
-
|
14
|
-
s.files = `git ls-files`.split("\n")
|
15
|
-
s.executables = `git ls-files -- bin/*`
|
16
|
-
.split("\n").map { |f| File.basename(f) }
|
17
|
-
s.require_paths = ["lib"]
|
18
|
-
|
19
|
-
s.add_dependency "micro-optparse"
|
20
|
-
s.add_dependency "listen"
|
21
|
-
|
22
|
-
s.add_development_dependency "minitest"
|
23
|
-
s.add_development_dependency "rake"
|
24
|
-
end
|
data/test/controller_test.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
describe Controller do
|
4
|
-
let(:cuco) { Controller.instance }
|
5
|
-
let(:regexp) { '.*\.rb' }
|
6
|
-
|
7
|
-
def setup
|
8
|
-
G.init({}, [])
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
cuco.stop
|
13
|
-
end
|
14
|
-
|
15
|
-
it "stops" do
|
16
|
-
cuco.stop
|
17
|
-
assert_nil cuco.listener
|
18
|
-
end
|
19
|
-
|
20
|
-
it "runs" do
|
21
|
-
assert_raises(Timeout::Error) do
|
22
|
-
Timeout.timeout(0.1) { cuco.run }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert cuco.listener
|
26
|
-
end
|
27
|
-
|
28
|
-
it "read .watchr" do
|
29
|
-
assert_raises(Timeout::Error) do
|
30
|
-
Timeout.timeout(0.1) { cuco.run }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "run" do
|
35
|
-
G.script = Script.new "watch('#{regexp}') { raise IOError }"
|
36
|
-
|
37
|
-
assert_raises(IOError) { cuco.file_run "a.rb" }
|
38
|
-
end
|
39
|
-
|
40
|
-
it "does not run" do
|
41
|
-
G.script = Script.new "watch('#{regexp}') { raise IOError }"
|
42
|
-
|
43
|
-
cuco.file_run "a.no"
|
44
|
-
end
|
45
|
-
|
46
|
-
it "receives a matchdata" do
|
47
|
-
G.script = Script.new "watch('ab(.)') { |m| [m[0], m[1]] }"
|
48
|
-
|
49
|
-
rule = G.script.__rules.last
|
50
|
-
assert_equal ["abc", "c"], cuco.match_run(rule, "abc")
|
51
|
-
end
|
52
|
-
end
|
data/test/cuco_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
describe Cuco do
|
4
|
-
it "usage" do
|
5
|
-
out, _err = capture_io do
|
6
|
-
puts `bin/cuco -h`
|
7
|
-
end
|
8
|
-
|
9
|
-
assert_match(/Usage/, out)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "options" do
|
13
|
-
options = {opt: 1234}
|
14
|
-
G.init options, []
|
15
|
-
|
16
|
-
assert_equal options, G.options
|
17
|
-
end
|
18
|
-
|
19
|
-
# it "coverage options debug" do
|
20
|
-
# out, _err = capture_io do
|
21
|
-
# puts `bin/cuco -d`
|
22
|
-
# Timeout::timeout(0.1) { puts `bin/cuco -d` }
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# assert_match(/:debug=>true/, out)
|
26
|
-
# assert_match(/scriptname <.watchr>/, out)
|
27
|
-
# assert_match(/pwd/, out)
|
28
|
-
# end
|
29
|
-
end
|
data/test/script_test.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
describe Script do
|
4
|
-
it "checks script" do
|
5
|
-
script = Script.new ""
|
6
|
-
assert script.instance_of?(Script)
|
7
|
-
assert_equal %i[watch __rules].sort, script.public_methods(false).sort
|
8
|
-
end
|
9
|
-
|
10
|
-
it "has no watcher" do
|
11
|
-
script = Script.new "n = 123"
|
12
|
-
assert_equal 0, script.__rules.size
|
13
|
-
end
|
14
|
-
|
15
|
-
it "has one watcher" do
|
16
|
-
script = Script.new "n = 456; watch('.rb') { }"
|
17
|
-
|
18
|
-
assert_equal 1, script.__rules.size
|
19
|
-
end
|
20
|
-
|
21
|
-
it "calls a watcher" do
|
22
|
-
pattern = '\.rb'
|
23
|
-
value = 123
|
24
|
-
script = Script.new "n = #{value}; watch('#{pattern}') { n }"
|
25
|
-
|
26
|
-
rule = script.__rules.last
|
27
|
-
assert_equal [pattern, value], [rule.pattern, rule.proc.call]
|
28
|
-
end
|
29
|
-
end
|
data/test/test_helper.rb
DELETED
File without changes
|
File without changes
|
File without changes
|