cuco 0.1.1 → 0.1.3
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 +3 -1
- data/bin/cuco +3 -3
- data/lib/{controller.rb → cuco/controller.rb} +2 -2
- data/lib/{version.rb → cuco/version.rb} +3 -1
- metadata +11 -28
- 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/LICENSE-MIT +0 -22
- data/Rakefile +0 -11
- data/cuco.gemspec +0 -24
- data/test/controller2_test.rb +0 -59
- data/test/controller_test.rb +0 -45
- data/test/coverage_test.rb +0 -19
- data/test/cuco_test.rb +0 -34
- data/test/script_test.rb +0 -29
- data/test/test_helper.rb +0 -15
- /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: a205d602df0235b22b900b23517b92876a23d9aac9b8121b470974f67f9818ee
|
4
|
+
data.tar.gz: 8202c78ccba777e5a58c0c30aae23fc314e1428024b3808a4df517a6b3fb6bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa1ce876e2f3778c38efe814be152e273595eabe6a36e84dba47aeeb7788977ebc0a47219d770fb6bd2fcd4a3b755c0a024c05e55c8a97f155bb69cf8059b84
|
7
|
+
data.tar.gz: f046e9ac6869be3ce66e3c165d0b8ab418aa420c5b8e508cde85599787eb3735103f2a1916e54ae1d517977a6b7d1bee49aa7a224a5d457b31791ad592b8c1bc
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Cuco
|
2
2
|
|
3
|
-
[](http://badge.fury.io/rb/cuco)
|
4
4
|
[](https://rubygems.org/gems/cuco)
|
5
5
|
[](http://choosealicense.com/licenses/mit/)
|
6
6
|
|
@@ -72,6 +72,8 @@ since the whole command is custom.
|
|
72
72
|
The above actions could just as easily call "jruby", "ruby --rubygems",
|
73
73
|
"ruby -I lib", etc. or any combination of these.
|
74
74
|
|
75
|
+
See directory _scripts_ for samples.
|
76
|
+
|
75
77
|
## Miscellaneous
|
76
78
|
|
77
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|
|
metadata
CHANGED
@@ -1,17 +1,16 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
13
|
+
name: listen
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
@@ -25,7 +24,7 @@ dependencies:
|
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0'
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
27
|
+
name: micro-optparse
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
@@ -71,34 +70,19 @@ email: dittmar.krall@matiq.de
|
|
71
70
|
executables:
|
72
71
|
- cuco
|
73
72
|
extensions: []
|
74
|
-
extra_rdoc_files:
|
73
|
+
extra_rdoc_files:
|
74
|
+
- README.md
|
75
75
|
files:
|
76
|
-
- ".github/workflows/rake.yml"
|
77
|
-
- ".ruby-gemset"
|
78
|
-
- ".ruby-version"
|
79
|
-
- ".watchr"
|
80
|
-
- Gemfile
|
81
|
-
- Gemfile.lock
|
82
|
-
- LICENSE-MIT
|
83
76
|
- README.md
|
84
|
-
- Rakefile
|
85
77
|
- bin/cuco
|
86
|
-
- cuco.
|
87
|
-
- lib/
|
88
|
-
- lib/cuco.rb
|
89
|
-
- lib/
|
90
|
-
- lib/version.rb
|
91
|
-
- test/controller2_test.rb
|
92
|
-
- test/controller_test.rb
|
93
|
-
- test/coverage_test.rb
|
94
|
-
- test/cuco_test.rb
|
95
|
-
- test/script_test.rb
|
96
|
-
- test/test_helper.rb
|
78
|
+
- lib/cuco/controller.rb
|
79
|
+
- lib/cuco/cuco.rb
|
80
|
+
- lib/cuco/script.rb
|
81
|
+
- lib/cuco/version.rb
|
97
82
|
homepage: http://www.matiq.de
|
98
83
|
licenses:
|
99
84
|
- MIT
|
100
85
|
metadata: {}
|
101
|
-
post_install_message:
|
102
86
|
rdoc_options: []
|
103
87
|
require_paths:
|
104
88
|
- lib
|
@@ -113,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
97
|
- !ruby/object:Gem::Version
|
114
98
|
version: '0'
|
115
99
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
117
|
-
signing_key:
|
100
|
+
rubygems_version: 3.6.7
|
118
101
|
specification_version: 4
|
119
102
|
summary: A file watcher
|
120
103
|
test_files: []
|
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.1)
|
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.10)
|
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.3.1)
|
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/LICENSE-MIT
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2024 Dittmar Krall (www.matiq.com)
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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_runtime_dependency "micro-optparse"
|
20
|
-
s.add_runtime_dependency "listen"
|
21
|
-
|
22
|
-
s.add_development_dependency "minitest"
|
23
|
-
s.add_development_dependency "rake"
|
24
|
-
end
|
data/test/controller2_test.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class R
|
4
|
-
class << self
|
5
|
-
attr_accessor :acc
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
describe Controller do
|
10
|
-
let(:cntrl) { Controller.instance }
|
11
|
-
|
12
|
-
def setup
|
13
|
-
R.acc = ""
|
14
|
-
G.init({}, [])
|
15
|
-
G.script = Script.new <<~EOS
|
16
|
-
watch('file') { R.acc << "n" }
|
17
|
-
watch('file', :added) { R.acc << "a" }
|
18
|
-
watch('file', :modified) { R.acc << "m" }
|
19
|
-
EOS
|
20
|
-
end
|
21
|
-
|
22
|
-
def teardown
|
23
|
-
cntrl.stop
|
24
|
-
end
|
25
|
-
|
26
|
-
it "fails with unknown what pattern" do
|
27
|
-
cntrl.file_run("fail", nil)
|
28
|
-
assert_equal "", R.acc
|
29
|
-
end
|
30
|
-
|
31
|
-
it "considers event_type nil" do
|
32
|
-
check nil, "n"
|
33
|
-
end
|
34
|
-
|
35
|
-
it "considers event_type :added" do
|
36
|
-
check :added, "an"
|
37
|
-
end
|
38
|
-
|
39
|
-
it "considers event_type :modified" do
|
40
|
-
check :modified, "mn"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "receives a matchdata" do
|
44
|
-
G.script = Script.new "watch('ab(.)') { |m|
|
45
|
-
R.acc << m[0]
|
46
|
-
R.acc << m[1]
|
47
|
-
}"
|
48
|
-
|
49
|
-
cntrl.file_run("abc", nil)
|
50
|
-
assert_equal "abcc", R.acc
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def check(type, expected)
|
56
|
-
cntrl.file_run("file", type)
|
57
|
-
assert_equal expected, R.acc
|
58
|
-
end
|
59
|
-
end
|
data/test/controller_test.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
describe Controller do
|
4
|
-
let(:cntrl) { Controller.instance }
|
5
|
-
let(:regexp) { '.*\.rb' }
|
6
|
-
|
7
|
-
def setup
|
8
|
-
G.init({}, [])
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
cntrl.stop
|
13
|
-
end
|
14
|
-
|
15
|
-
it "stops" do
|
16
|
-
cntrl.stop
|
17
|
-
assert_nil cntrl.listener
|
18
|
-
end
|
19
|
-
|
20
|
-
it "runs" do
|
21
|
-
assert_raises(Timeout::Error) do
|
22
|
-
Timeout.timeout(0.1) { cntrl.run }
|
23
|
-
end
|
24
|
-
|
25
|
-
assert cntrl.listener
|
26
|
-
end
|
27
|
-
|
28
|
-
it "read .watchr" do
|
29
|
-
assert_raises(Timeout::Error) do
|
30
|
-
Timeout.timeout(0.1) { cntrl.run }
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "run" do
|
35
|
-
G.script = Script.new "watch('#{regexp}') { raise IOError }"
|
36
|
-
|
37
|
-
assert_raises(IOError) { cntrl.file_run "a.rb" }
|
38
|
-
end
|
39
|
-
|
40
|
-
it "does not run" do
|
41
|
-
G.script = Script.new "watch('#{regexp}') { raise IOError }"
|
42
|
-
|
43
|
-
cntrl.file_run "a.no"
|
44
|
-
end
|
45
|
-
end
|
data/test/coverage_test.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
describe "Coverage" do
|
4
|
-
let(:cntrl) { Controller.instance }
|
5
|
-
|
6
|
-
def setup
|
7
|
-
G.init({}, [])
|
8
|
-
end
|
9
|
-
|
10
|
-
it "coverage run files" do
|
11
|
-
names = []
|
12
|
-
cntrl.run_files(names, nil)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "coverage run files script" do
|
16
|
-
names = [G.scriptname]
|
17
|
-
cntrl.run_files(names, nil)
|
18
|
-
end
|
19
|
-
end
|
data/test/cuco_test.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
describe Cuco do
|
4
|
-
def setup
|
5
|
-
G.init({}, [])
|
6
|
-
end
|
7
|
-
|
8
|
-
it "usage" do
|
9
|
-
out, _err = capture_io do
|
10
|
-
puts `bin/cuco -h`
|
11
|
-
end
|
12
|
-
|
13
|
-
assert_match(/Usage/, out)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "coverage G.print " do
|
17
|
-
out, err = capture_io do
|
18
|
-
G.print
|
19
|
-
end
|
20
|
-
|
21
|
-
assert out
|
22
|
-
assert_equal "", err
|
23
|
-
assert_match(/scriptname/, out)
|
24
|
-
assert_match(/.watchr/, out)
|
25
|
-
assert_match(/pwd/, out)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "options" do
|
29
|
-
options = {opt: 1234}
|
30
|
-
G.init options, []
|
31
|
-
|
32
|
-
assert_equal options, G.options
|
33
|
-
end
|
34
|
-
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
|