retest 1.0.0 → 1.1.0
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/Gemfile.lock +1 -1
- data/bin/debug +1 -1
- data/exe/retest +1 -1
- data/lib/retest.rb +1 -0
- data/lib/retest/command.rb +77 -0
- data/lib/retest/command/rails.rb +22 -0
- data/lib/retest/command/rake.rb +22 -0
- data/lib/retest/command/rspec.rb +22 -0
- data/lib/retest/command/ruby.rb +13 -0
- data/lib/retest/options.rb +7 -47
- data/lib/retest/setup.rb +1 -1
- data/lib/retest/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cec5f35b345630339ca56cfd0c1bc88be03596ca4d8369695f2e87f66e7c608
|
4
|
+
data.tar.gz: db0b1f966bb2ebe14183e17e93003c0d504881dc2a7d8fe2614f5c202b0fcf55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b191a17f73446b41fd5fdf9bc7495f4ea0535c05681e1d14e191cb62f6cadc83d09454ad501fc98ce503db6a169b628b6d205328ca4a236ddf56bbc75d78bff
|
7
|
+
data.tar.gz: e1089b2d8c64c380c2fd08935f8b0ded1dee4ccb2f265ff20c6f12eeea91942ef0e4c9a6a154b48a270a4c3281fa2e3edf981925f50c6767c98a2bbcbd1cd6f3
|
data/Gemfile.lock
CHANGED
data/bin/debug
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
|
16
16
|
program = Retest::Program.new(
|
17
17
|
repository: Retest::Repository.new(files: Retest::VersionControl.files),
|
18
|
-
runner: Retest::Runner.for(options
|
18
|
+
runner: Retest::Runner.for(Retest::Command.for_options(options))
|
19
19
|
)
|
20
20
|
|
21
21
|
if options.params[:diff]
|
data/exe/retest
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
|
14
14
|
program = Retest::Program.new(
|
15
15
|
repository: Retest::Repository.new(files: Retest::VersionControl.files),
|
16
|
-
runner: Retest::Runner.for(options
|
16
|
+
runner: Retest::Runner.for(Retest::Command.for_options(options))
|
17
17
|
)
|
18
18
|
|
19
19
|
if options.params[:diff]
|
data/lib/retest.rb
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
require_relative 'command/rails'
|
2
|
+
require_relative 'command/rake'
|
3
|
+
require_relative 'command/rspec'
|
4
|
+
require_relative 'command/ruby'
|
5
|
+
|
6
|
+
module Retest
|
7
|
+
class Command
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def self.for_options(options)
|
11
|
+
new(options: options).command
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.for_setup(setup)
|
15
|
+
new(setup: setup).command
|
16
|
+
end
|
17
|
+
|
18
|
+
def_delegator :setup, :type
|
19
|
+
def_delegators :options, :params, :full_suite?, :auto?
|
20
|
+
|
21
|
+
attr_accessor :options, :setup
|
22
|
+
def initialize(options: Options.new, setup: Setup.new, output_stream: STDOUT)
|
23
|
+
@options = options
|
24
|
+
@setup = setup
|
25
|
+
@output_stream = output_stream
|
26
|
+
end
|
27
|
+
|
28
|
+
def command
|
29
|
+
return default_command if auto?
|
30
|
+
options_command || default_command
|
31
|
+
end
|
32
|
+
|
33
|
+
def options_command
|
34
|
+
return params[:command] if params[:command]
|
35
|
+
|
36
|
+
if params[:rspec] then rspec_command
|
37
|
+
elsif params[:rails] then rails_command
|
38
|
+
elsif params[:ruby] then ruby_command
|
39
|
+
elsif params[:rake] then rake_command
|
40
|
+
else
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup_command
|
45
|
+
case type
|
46
|
+
when :rake then rake_command
|
47
|
+
when :rspec then rspec_command
|
48
|
+
when :rails then rails_command
|
49
|
+
when :ruby then ruby_command
|
50
|
+
else ruby_command
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def default_command
|
55
|
+
@output_stream.puts "Setup identified: [#{type.upcase}]. Using command: '#{setup_command}'"
|
56
|
+
setup_command
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def rspec_command
|
62
|
+
Rspec.command(all: full_suite?)
|
63
|
+
end
|
64
|
+
|
65
|
+
def rails_command
|
66
|
+
Rails.command(all: full_suite?)
|
67
|
+
end
|
68
|
+
|
69
|
+
def rake_command
|
70
|
+
Rake.command(all: full_suite?)
|
71
|
+
end
|
72
|
+
|
73
|
+
def ruby_command
|
74
|
+
Ruby.command(all: full_suite?)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Retest
|
2
|
+
class Command
|
3
|
+
Rails = Struct.new(:all, :bin_file) do
|
4
|
+
def self.command(all:, bin_file: File.exist?('bin/rails'))
|
5
|
+
new(all, bin_file).command
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
return "#{root_command} <test>" unless all
|
10
|
+
root_command
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def root_command
|
16
|
+
return 'bin/rails test' if bin_file
|
17
|
+
|
18
|
+
'bundle exec rails test'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Retest
|
2
|
+
class Command
|
3
|
+
Rake = Struct.new(:all, :bin_file) do
|
4
|
+
def self.command(all:, bin_file: File.exist?('bin/rake'))
|
5
|
+
new(all, bin_file).command
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
return "#{root_command} TEST=<test>" unless all
|
10
|
+
root_command
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def root_command
|
16
|
+
return 'bin/rake test' if bin_file
|
17
|
+
|
18
|
+
'bundle exec rake test'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Retest
|
2
|
+
class Command
|
3
|
+
Rspec = Struct.new(:all, :bin_file) do
|
4
|
+
def self.command(all:, bin_file: File.exist?('bin/rspec'))
|
5
|
+
new(all, bin_file).command
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
return "#{root_command} <test>" unless all
|
10
|
+
root_command
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def root_command
|
16
|
+
return 'bin/rspec' if bin_file
|
17
|
+
|
18
|
+
'bundle exec rspec'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/retest/options.rb
CHANGED
@@ -111,22 +111,8 @@ module Retest
|
|
111
111
|
new(args).command
|
112
112
|
end
|
113
113
|
|
114
|
-
def initialize(args = []
|
114
|
+
def initialize(args = [])
|
115
115
|
self.args = args
|
116
|
-
@output_stream = output_stream
|
117
|
-
@setup = setup
|
118
|
-
end
|
119
|
-
|
120
|
-
def command
|
121
|
-
return params[:command] if params[:command]
|
122
|
-
|
123
|
-
if params[:rspec] then rspec_command
|
124
|
-
elsif params[:rake] then rake_command
|
125
|
-
elsif params[:rails] then rails_command
|
126
|
-
elsif params[:ruby] then ruby_command
|
127
|
-
elsif params[:auto] then default_command
|
128
|
-
else default_command
|
129
|
-
end
|
130
116
|
end
|
131
117
|
|
132
118
|
def args=(args)
|
@@ -138,45 +124,19 @@ module Retest
|
|
138
124
|
params[:help]
|
139
125
|
end
|
140
126
|
|
141
|
-
private
|
142
|
-
|
143
127
|
def full_suite?
|
144
128
|
params[:all]
|
145
129
|
end
|
146
130
|
|
147
|
-
def
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
def command_for(type)
|
152
|
-
case type
|
153
|
-
when :rspec then rspec_command
|
154
|
-
when :rails then rails_command
|
155
|
-
when :rake then rake_command
|
156
|
-
when :ruby then ruby_command
|
157
|
-
else ruby_command
|
158
|
-
end
|
131
|
+
def auto?
|
132
|
+
return true if no_options_passed?
|
133
|
+
params[:auto]
|
159
134
|
end
|
160
135
|
|
161
|
-
|
162
|
-
@output_stream.puts "Setup identified: [#{type.upcase}]. Using command: '#{command}'"
|
163
|
-
command
|
164
|
-
end
|
165
|
-
|
166
|
-
def rspec_command
|
167
|
-
full_suite? ? ALL_RSPEC_COMMAND : RSPEC_COMMAND
|
168
|
-
end
|
169
|
-
|
170
|
-
def rails_command
|
171
|
-
full_suite? ? ALL_RAILS_COMMAND : RAILS_COMMAND
|
172
|
-
end
|
173
|
-
|
174
|
-
def rake_command
|
175
|
-
full_suite? ? ALL_RAKE_COMMAND : RAKE_COMMAND
|
176
|
-
end
|
136
|
+
private
|
177
137
|
|
178
|
-
def
|
179
|
-
|
138
|
+
def no_options_passed?
|
139
|
+
params.to_h.values.compact.uniq == [false]
|
180
140
|
end
|
181
141
|
end
|
182
142
|
end
|
data/lib/retest/setup.rb
CHANGED
data/lib/retest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: retest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Barret
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: string-similarity
|
@@ -80,6 +80,11 @@ files:
|
|
80
80
|
- bin/test/ruby-app
|
81
81
|
- exe/retest
|
82
82
|
- lib/retest.rb
|
83
|
+
- lib/retest/command.rb
|
84
|
+
- lib/retest/command/rails.rb
|
85
|
+
- lib/retest/command/rake.rb
|
86
|
+
- lib/retest/command/rspec.rb
|
87
|
+
- lib/retest/command/ruby.rb
|
83
88
|
- lib/retest/options.rb
|
84
89
|
- lib/retest/repository.rb
|
85
90
|
- lib/retest/runner.rb
|