joi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-tests.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/README.md +3 -0
- data/lib/joi/cli.rb +4 -3
- data/lib/joi/presets/default.rb +13 -6
- data/lib/joi/runner.rb +15 -5
- data/lib/joi/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6c04eeb7bc068e1f782ab77368df567c7978ba971a9da566b488c838d8a22a
|
4
|
+
data.tar.gz: 73791ad41fd9e8db850a98f286407b97a23fc6f99bc6ae7f3991e4b27e198e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17635fc54038b47297d1b51e403d14f39bb956095149c407964c17b76d6eed95fe71a83e4c7c6dd04365ab9b40ddd610b43a7cb5e162312014fc34705eaa4589
|
7
|
+
data.tar.gz: 7523240dcb28b9b7b51d42e4bfcfb6f12e2888c0b05ff68afc3b2d0d49bc9ceb23038de9441b3791d6158001df5fa1b1ae8bb349f57e83da4a817fe3377ba50b
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,11 @@ Prefix your message with one of the following:
|
|
11
11
|
- [Security] in case of vulnerabilities.
|
12
12
|
-->
|
13
13
|
|
14
|
+
## v0.0.2
|
15
|
+
|
16
|
+
- [Changed] SIGINT (ctrl-c) will run all tests.
|
17
|
+
- [Added] SIGQUIT (ctrl-\\) will stop joi.
|
18
|
+
|
14
19
|
## v0.0.1
|
15
20
|
|
16
21
|
- Initial release.
|
data/README.md
CHANGED
@@ -35,6 +35,9 @@ will run only matching test files (e.g. `app/models/user.rb` changes will run
|
|
35
35
|
tests are executed. Any `.rb` file that's either created or removed file will
|
36
36
|
also trigger a full suite run.
|
37
37
|
|
38
|
+
You can use `SIGINT` (ctrl-c) to run all tests. To stop joi, use `SIGQUIT`
|
39
|
+
(ctrl-\\).
|
40
|
+
|
38
41
|
Joi is even more useful if you use
|
39
42
|
[test_notifier](https://github.com/fnando/test_notifier).
|
40
43
|
|
data/lib/joi/cli.rb
CHANGED
@@ -36,11 +36,12 @@ module Joi
|
|
36
36
|
|
37
37
|
parser.parse!(argv)
|
38
38
|
|
39
|
-
runner = Runner.new
|
39
|
+
runner = Runner.new(options: options)
|
40
40
|
|
41
|
-
trap("
|
41
|
+
trap("INT") { runner.run_all }
|
42
|
+
trap("QUIT") { exit! }
|
42
43
|
|
43
|
-
runner.start
|
44
|
+
runner.start
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
data/lib/joi/presets/default.rb
CHANGED
@@ -3,7 +3,14 @@
|
|
3
3
|
module Joi
|
4
4
|
module Presets
|
5
5
|
class Default
|
6
|
-
|
6
|
+
attr_reader :options, :runner
|
7
|
+
|
8
|
+
def initialize(runner, options)
|
9
|
+
@runner = runner
|
10
|
+
@options = options
|
11
|
+
end
|
12
|
+
|
13
|
+
def run_all
|
7
14
|
if options[:rails]
|
8
15
|
run_rails_test(options, [])
|
9
16
|
else
|
@@ -11,7 +18,7 @@ module Joi
|
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
|
-
def
|
21
|
+
def register
|
15
22
|
run = lambda do |paths|
|
16
23
|
system("clear")
|
17
24
|
|
@@ -54,7 +61,7 @@ module Joi
|
|
54
61
|
)
|
55
62
|
end
|
56
63
|
|
57
|
-
def
|
64
|
+
def run_rails_test(options, test_paths)
|
58
65
|
command = []
|
59
66
|
command += %w[bundle exec] if options[:bundler]
|
60
67
|
command += %w[rails test]
|
@@ -63,7 +70,7 @@ module Joi
|
|
63
70
|
run(nil, command)
|
64
71
|
end
|
65
72
|
|
66
|
-
def
|
73
|
+
def run_rake_test(options, test_paths)
|
67
74
|
command = []
|
68
75
|
command += %w[bundle exec] if options[:bundler]
|
69
76
|
command += %w[rake test]
|
@@ -77,7 +84,7 @@ module Joi
|
|
77
84
|
end
|
78
85
|
end
|
79
86
|
|
80
|
-
def
|
87
|
+
def env_vars(env)
|
81
88
|
return unless env
|
82
89
|
|
83
90
|
env
|
@@ -85,7 +92,7 @@ module Joi
|
|
85
92
|
.join(" ")
|
86
93
|
end
|
87
94
|
|
88
|
-
def
|
95
|
+
def run(env, command)
|
89
96
|
puts [
|
90
97
|
"\e[37m$",
|
91
98
|
*command.map {|arg| Shellwords.shellescape(arg) },
|
data/lib/joi/runner.rb
CHANGED
@@ -2,16 +2,26 @@
|
|
2
2
|
|
3
3
|
module Joi
|
4
4
|
class Runner
|
5
|
-
attr_reader :root_dir, :watchers
|
5
|
+
attr_reader :root_dir, :watchers, :preset
|
6
6
|
|
7
|
-
def initialize(
|
7
|
+
def initialize(
|
8
|
+
options:,
|
9
|
+
root_dir: Dir.pwd,
|
10
|
+
preset: Presets::Default.new(self, options)
|
11
|
+
)
|
8
12
|
@root_dir = Pathname.new(root_dir)
|
9
13
|
@watchers = []
|
14
|
+
@preset = preset
|
10
15
|
end
|
11
16
|
|
12
|
-
def
|
13
|
-
|
14
|
-
preset.run_all
|
17
|
+
def run_all
|
18
|
+
watchers.each {|watcher| watcher[:thread]&.kill }
|
19
|
+
preset.run_all
|
20
|
+
end
|
21
|
+
|
22
|
+
def start
|
23
|
+
preset.register
|
24
|
+
run_all
|
15
25
|
|
16
26
|
listener = Listen.to(
|
17
27
|
root_dir.to_s,
|
data/lib/joi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|
@@ -163,10 +163,10 @@ metadata:
|
|
163
163
|
rubygems_mfa_required: 'true'
|
164
164
|
homepage_uri: https://github.com/fnando/joi
|
165
165
|
bug_tracker_uri: https://github.com/fnando/joi/issues
|
166
|
-
source_code_uri: https://github.com/fnando/joi/tree/v0.0.
|
167
|
-
changelog_uri: https://github.com/fnando/joi/tree/v0.0.
|
168
|
-
documentation_uri: https://github.com/fnando/joi/tree/v0.0.
|
169
|
-
license_uri: https://github.com/fnando/joi/tree/v0.0.
|
166
|
+
source_code_uri: https://github.com/fnando/joi/tree/v0.0.2
|
167
|
+
changelog_uri: https://github.com/fnando/joi/tree/v0.0.2/CHANGELOG.md
|
168
|
+
documentation_uri: https://github.com/fnando/joi/tree/v0.0.2/README.md
|
169
|
+
license_uri: https://github.com/fnando/joi/tree/v0.0.2/LICENSE.md
|
170
170
|
post_install_message:
|
171
171
|
rdoc_options: []
|
172
172
|
require_paths:
|