retest 0.8.0.pre2 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29feb62794ace1a47231b253d503e737823254686ceaf0302a9fb71445e6dd50
4
- data.tar.gz: d80255a8de63fb600352be63ddf86874646925778f9aa3fd8f4cad57869af6c3
3
+ metadata.gz: 8df33036507fe29259ef99ac9fa574fdece9af4e69911f21125a1c4bbad7778c
4
+ data.tar.gz: a4bb2606b7373fb304638125be08d94c79a5dfb5e324cbf433848730cf08abe6
5
5
  SHA512:
6
- metadata.gz: 93deeb1a5c642cd2609a76ec757f075f8000a0000c1a5d8782e1f82ab1bd39ded13845470d65f15056def3c67af0fd5cc748b8471e2fca39490e3433604260d3
7
- data.tar.gz: 2759bb6b19546f7e3751d1e0a8242ac3e0e7057e25d7b434ecd0c572570fdd8fed31ce1a85073d58617bd2bf074b319cb4bfb68ce07bd956c86bfb179a42f10f
6
+ metadata.gz: ba3f7823d9789965dbd44d92ac40aeb1f6d3dd9f35f6e634f317949adf72ba672abb231f4603acfe1da2c766d3158da81ca1c538868ab8be8955bfdf443651b0
7
+ data.tar.gz: 74f1a43fc0b23d48bd9a7cdd53c8a57206cbf9cc3546f1a6d2d0609d7f837744f1f74162ced9f57661f6008237b039f32ba2454289d839314ecfae5bc4ce011f
@@ -14,7 +14,7 @@ on:
14
14
  branches: [ main ]
15
15
 
16
16
  jobs:
17
- test:
17
+ unit-tests:
18
18
  runs-on: ${{ matrix.os }}
19
19
  strategy:
20
20
  matrix:
@@ -36,4 +36,23 @@ jobs:
36
36
  bundler-cache: true
37
37
  - run: bundle install
38
38
  - run: bundle exec rake
39
- - run: CUCUMBER_PUBLISH_QUIET=true bundle exec cucumber
39
+
40
+ app-tests:
41
+ name: ${{ matrix.repo }} feature specs
42
+ runs-on: ubuntu-latest
43
+ strategy:
44
+ matrix:
45
+ repo:
46
+ - ruby-app
47
+ - rails-app
48
+ - hanami-app
49
+ - rspec-rails
50
+ - rspec-ruby
51
+ steps:
52
+ - uses: actions/checkout@v2
53
+ - name: Set up Ruby
54
+ uses: ruby/setup-ruby@v1
55
+ with:
56
+ ruby-version: 2.5
57
+ bundler-cache: true
58
+ - run: bin/test/${{ matrix.repo }}
data/Gemfile CHANGED
@@ -3,8 +3,6 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in retest.gemspec
4
4
  gemspec
5
5
 
6
- gem "cucumber", "~> 5.1"
7
- gem "aruba", "~> 1.0"
8
6
  gem "rake", "~> 12.0"
9
7
  gem "minitest", "~> 5.0"
10
8
  gem "byebug"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- retest (0.8.0.pre2)
4
+ retest (0.9.0)
5
5
  listen (~> 3.2)
6
6
  string-similarity (~> 2.1)
7
7
  tty-option (~> 0.1)
@@ -9,95 +9,24 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.3.2)
13
- concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.2)
18
- aruba (1.0.3)
19
- childprocess (>= 2.0, < 5.0)
20
- contracts (~> 0.16.0)
21
- cucumber (>= 2.4, < 6.0)
22
- ffi (~> 1.9)
23
- rspec-expectations (~> 3.4)
24
- thor (~> 1.0)
25
- builder (3.2.4)
26
12
  byebug (11.1.3)
27
- childprocess (4.0.0)
28
- concurrent-ruby (1.1.7)
29
- contracts (0.16.0)
30
- cucumber (5.1.0)
31
- builder (~> 3.2, >= 3.2.4)
32
- cucumber-core (~> 8.0, >= 8.0.1)
33
- cucumber-create-meta (~> 2.0, >= 2.0.1)
34
- cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
35
- cucumber-gherkin (~> 15.0, >= 15.0.2)
36
- cucumber-html-formatter (~> 9.0, >= 9.0.0)
37
- cucumber-messages (~> 13.0, >= 13.0.1)
38
- cucumber-wire (~> 4.0, >= 4.0.1)
39
- diff-lcs (~> 1.4, >= 1.4.4)
40
- multi_test (~> 0.1, >= 0.1.2)
41
- sys-uname (~> 1.2, >= 1.2.1)
42
- cucumber-core (8.0.1)
43
- cucumber-gherkin (~> 15.0, >= 15.0.2)
44
- cucumber-messages (~> 13.0, >= 13.0.1)
45
- cucumber-tag-expressions (~> 2.0, >= 2.0.4)
46
- cucumber-create-meta (2.0.1)
47
- cucumber-messages (~> 13.0, >= 13.0.1)
48
- sys-uname (~> 1.2, >= 1.2.1)
49
- cucumber-cucumber-expressions (10.3.0)
50
- cucumber-gherkin (15.0.2)
51
- cucumber-messages (~> 13.0, >= 13.0.1)
52
- cucumber-html-formatter (9.0.0)
53
- cucumber-messages (~> 13.0, >= 13.0.1)
54
- cucumber-messages (13.0.1)
55
- protobuf-cucumber (~> 3.10, >= 3.10.8)
56
- cucumber-tag-expressions (2.0.4)
57
- cucumber-wire (4.0.1)
58
- cucumber-core (~> 8.0, >= 8.0.1)
59
- cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
60
- cucumber-messages (~> 13.0, >= 13.0.1)
61
- diff-lcs (1.4.4)
62
- ffi (1.13.1)
63
- i18n (1.8.5)
64
- concurrent-ruby (~> 1.0)
13
+ ffi (1.15.0)
65
14
  listen (3.4.1)
66
15
  rb-fsevent (~> 0.10, >= 0.10.3)
67
16
  rb-inotify (~> 0.9, >= 0.9.10)
68
- middleware (0.1.0)
69
17
  minitest (5.14.1)
70
- multi_test (0.1.2)
71
- protobuf-cucumber (3.10.8)
72
- activesupport (>= 3.2)
73
- middleware
74
- thor
75
- thread_safe
76
18
  rake (12.3.3)
77
19
  rb-fsevent (0.10.4)
78
20
  rb-inotify (0.10.1)
79
21
  ffi (~> 1.0)
80
- rspec-expectations (3.9.2)
81
- diff-lcs (>= 1.2.0, < 2.0)
82
- rspec-support (~> 3.9.0)
83
- rspec-support (3.9.3)
84
22
  string-similarity (2.1.0)
85
- sys-uname (1.2.1)
86
- ffi (>= 1.0.0)
87
- thor (1.0.1)
88
- thread_safe (0.3.6)
89
23
  tty-option (0.1.0)
90
- tzinfo (1.2.7)
91
- thread_safe (~> 0.1)
92
- zeitwerk (2.4.0)
93
24
 
94
25
  PLATFORMS
95
26
  ruby
96
27
 
97
28
  DEPENDENCIES
98
- aruba (~> 1.0)
99
29
  byebug
100
- cucumber (~> 5.1)
101
30
  minitest (~> 5.0)
102
31
  rake (~> 12.0)
103
32
  retest!
data/README.md CHANGED
@@ -2,29 +2,46 @@
2
2
 
3
3
  Retest is a small command-line tool to help you refactor code by watching a file change and running its matching spec. Designed to be dev-centric and project independent, it can be used on the fly. No Gemfile updates, no commits to a repo or configuration files required to start refactoring. Works with every Ruby projects (at least that is the end goal)
4
4
 
5
- ## Why?
6
- It is advised to be one `cmd + z` away from green tests when refactoring. This means running tests after every line change. Let Retest rerun your tests after every file change you make.
7
-
8
- Retest gem is meant to be simple and follow testing conventions encountered in Ruby projects. Give it a go you can uninstall it easily. If you think the matching pattern could be improved please raise an issue.
9
-
10
- For fully fledged solutions, some cli tools already exists: [autotest](https://github.com/grosser/autotest), [guard](https://github.com/guard/guard), [zentest](https://github.com/seattlerb/zentest)
5
+ ## Demo
11
6
 
12
7
  ![demo](https://alexbarret.com/images/external/retest-demo-26bcad04.gif)
13
8
 
14
9
  ## Installation
15
10
 
16
- Install it on your machine with:
11
+ Install it on your machine without adding it on a Gemfile:
17
12
 
18
13
  $ gem install retest
19
- $ retest 'bundle exec rspec <test>'
20
14
 
21
15
  ## Usage
22
16
 
23
- Launch `retest` in your terminal after accessing your ruby project folder.
17
+ Launch `retest` in your terminal after accessing your ruby repository.
18
+
19
+ You can pass the test command surrounded by quotes and use the placeholder `<test>` to tell `retest` where to put test file in your command. Example:
20
+
21
+ $ retest 'bundle exec rspec <test>'
22
+
23
+ When a file is changed, the gem will find its matching test and run the test command with it.
24
+
25
+ Few shortcut flags exist to avoid writing the full test command.
26
+
27
+ $ retest --rspec
28
+ $ retest --rails
29
+ $ retest --rake --all
30
+
31
+ Finally let retest automatically find your ruby setup and run the appropriate command using:
32
+
33
+ $ retest
34
+ $ retest --auto
35
+ $ retest --auto --all
36
+
37
+ The gem works as follows:
24
38
 
25
- Pass the test command surrounded by quotes. Use the placeholder `<test>` in your command to tell `retest` where to put the path of the test file in your command. Example: `retest 'bundle exec rspec <test>'`. When a file is changed `retest` will find its matching test and run it.
39
+ * When a file is changed, retest will run its matching test.
40
+ * When a test files is changed, retest will run the test file.
41
+ * When multiple matching test files are found, retest asks you to confirm the file and save the answer.
42
+ * When a test file is not found, retest runs the last run command or throw a 404.
26
43
 
27
- Learn more by running `retest -h`
44
+ See more example with `retest -h`
28
45
 
29
46
  ```
30
47
  Usage: retest [OPTIONS] [COMMAND]
@@ -35,10 +52,11 @@ Arguments:
35
52
  COMMAND The test command to rerun when a file changes.
36
53
  Use <test> placeholder to tell retest where to put the matching
37
54
  spec.
38
-
55
+
39
56
 
40
57
  Options:
41
58
  --all Run all the specs of a specificied ruby setup
59
+ --auto Indentify repository setup and runs appropriate command
42
60
  -h, --help Print usage
43
61
  --rails Shortcut for 'bundle exec rails test <test>'
44
62
  --rake Shortcut for 'bundle exec rake test TEST=<test>'
@@ -56,16 +74,24 @@ Examples:
56
74
 
57
75
  Runs a hardcoded command after a file change
58
76
  $ retest 'ruby lib/bottles_test.rb'
77
+
78
+ Let retest identify which command to run
79
+ $ retest
80
+ $ retest --auto
81
+
82
+ Let retest identify which command to run for all tests
83
+ $ retest --all
84
+ $ retest --auto --all
59
85
  ```
60
86
 
61
- The gem works as follows:
87
+ ## Why?
88
+ It is advised to be one `cmd + z` away from green tests when refactoring. This means running tests after every line change. Let Retest rerun your tests after every file change you make.
62
89
 
63
- * When a file is changed, retest will run its matching file test.
64
- * When a test file is changed, retest will run the file test.
65
- * When multiple matching test files are found, retest asks you to confirm the file and save the answer.
66
- * When a test file is not found, retest runs the last run command or throw a 404.
90
+ Retest gem is meant to be simple and follow testing conventions encountered in Ruby projects. Give it a go you can uninstall it easily. If you think the matching pattern could be improved please raise an issue.
91
+
92
+ For fully fledged solutions, some cli tools already exists: [autotest](https://github.com/grosser/autotest), [guard](https://github.com/guard/guard), [zentest](https://github.com/seattlerb/zentest)
67
93
 
68
- ### Docker
94
+ ## Docker
69
95
 
70
96
  Retest works in Docker too. You can install the gem and launch retest in your container while refactoring.
71
97
  ```bash
@@ -74,7 +100,7 @@ $ gem install retest
74
100
  $ retest 'bundle exec rails test <test>'
75
101
  ```
76
102
 
77
- ### Disclaimer
103
+ ## Disclaimer
78
104
  * If an error comes in try using `bundle exec` like so: `$ retest 'bundle exec rake test <test>'`
79
105
  * Aliases saved on ~/.bashrc or ~/.zshrc cannot be run that way with the `retest` command
80
106
 
@@ -93,8 +119,6 @@ Retest supports ruby 2.4 and above.
93
119
  - [x] Rails
94
120
  - [x] Ad-hoc scripts
95
121
  - [x] Hanami
96
- - [ ] Sinatra
97
- - [ ] Cuba? Padrino?
98
122
  - [ ] Handle other languages: Elixir, Node, Python, PHP
99
123
  - [ ] Aliases from oh-my-zsh and bash profiles?
100
124
 
@@ -104,6 +128,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
104
128
 
105
129
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
106
130
 
131
+ To run integration tests on one setup (ex: hanami-app): `bin/test/hanami-app`
132
+
133
+ To access an app container (ex: ruby-app): `docker-compose -f features/ruby-app/docker-compose.yml run retest sh`
134
+
135
+
107
136
  ## Contributing
108
137
 
109
138
  Bug reports and pull requests are welcome on GitHub at https://github.com/alexb52/retest.
data/bin/debug ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "retest"
5
+ require "byebug"
6
+
7
+ $stdout.sync = true
8
+
9
+ options = Retest::Options.new(ARGV)
10
+
11
+ if options.help?
12
+ $stdout.puts options.help
13
+ return
14
+ end
15
+
16
+ Retest.start(options.command) # not blocking
17
+
18
+ sleep
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle install
4
+ bundle exec rake build
5
+ ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/hanami-app/retest.gem
6
+ docker-compose -f features/hanami-app/docker-compose.yml build
7
+ docker-compose -f features/hanami-app/docker-compose.yml run retest sh bin/test_setup
8
+ docker-compose -f features/hanami-app/docker-compose.yml up --exit-code-from retest
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle install
4
+ bundle exec rake build
5
+ ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rails-app/retest.gem
6
+ docker-compose -f features/rails-app/docker-compose.yml up --build --exit-code-from retest
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle install
4
+ bundle exec rake build
5
+ ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rspec-rails/retest.gem
6
+ docker-compose -f features/rspec-rails/docker-compose.yml up --build --exit-code-from retest
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle install
4
+ bundle exec rake build
5
+ ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/rspec-ruby/retest.gem
6
+ docker-compose -f features/rspec-ruby/docker-compose.yml up --build --exit-code-from retest
data/bin/test/ruby-app ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle install
4
+ bundle exec rake build
5
+ ls -t pkg | head -n1 | xargs -I {} mv pkg/{} features/ruby-app/retest.gem
6
+ docker-compose -f features/ruby-app/docker-compose.yml up --build --exit-code-from retest
data/exe/retest CHANGED
@@ -6,7 +6,10 @@ $stdout.sync = true
6
6
 
7
7
  options = Retest::Options.new(ARGV)
8
8
 
9
- return puts options.help if options.help?
9
+ if options.help?
10
+ $stdout.puts options.help
11
+ return
12
+ end
10
13
 
11
14
  Retest.start(options.command) # not blocking
12
15
 
data/lib/retest.rb CHANGED
@@ -7,6 +7,7 @@ require "retest/repository"
7
7
  require "retest/test_options"
8
8
  require "retest/options"
9
9
  require "retest/version_control"
10
+ require "retest/setup"
10
11
 
11
12
  module Retest
12
13
  class Error < StandardError; end
@@ -26,11 +27,12 @@ module Retest
26
27
  def build(runner:, repository:)
27
28
  Listen.to('.', only: /\.rb$/, relative: true) do |modified, added, removed|
28
29
  begin
29
- repository.remove(removed)
30
30
  repository.add(added)
31
+ repository.remove(removed)
32
+ runner.remove(removed)
31
33
  system('clear 2>/dev/null') || system('cls 2>/dev/null')
32
34
 
33
- runner.run repository.find_test (modified + added).first.strip
35
+ runner.run repository.find_test (modified + added).first
34
36
  rescue => e
35
37
  puts "Something went wrong: #{e.message}"
36
38
  end
@@ -8,7 +8,6 @@ module Retest
8
8
  RAILS_COMMAND = "bundle exec rails test <test>"
9
9
  RAKE_COMMAND = "bundle exec rake test TEST=<test>"
10
10
  RUBY_COMMAND = "bundle exec ruby <test>"
11
- NO_COMMAND = "echo You have no command assigned"
12
11
 
13
12
  ALL_RAKE_COMMAND = "bundle exec rake test"
14
13
  ALL_RAILS_COMMAND = "bundle exec rails test"
@@ -37,6 +36,18 @@ module Retest
37
36
  Runs a hardcoded command after a file change
38
37
  $ retest 'ruby lib/bottles_test.rb'
39
38
  EOS
39
+
40
+ example <<~EOS
41
+ Let retest identify which command to run
42
+ $ retest
43
+ $ retest --auto
44
+ EOS
45
+
46
+ example <<~EOS
47
+ Let retest identify which command to run for all tests
48
+ $ retest --all
49
+ $ retest --auto --all
50
+ EOS
40
51
  end
41
52
 
42
53
  argument :command do
@@ -52,6 +63,11 @@ module Retest
52
63
  desc "Run all the specs of a specificied ruby setup"
53
64
  end
54
65
 
66
+ flag :auto do
67
+ long "--auto"
68
+ desc "Indentify repository setup and runs appropriate command"
69
+ end
70
+
55
71
  flag :help do
56
72
  short "-h"
57
73
  long "--help"
@@ -84,21 +100,21 @@ module Retest
84
100
  new(args).command
85
101
  end
86
102
 
87
- def initialize(args = [])
103
+ def initialize(args = [], output_stream: STDOUT, setup: Setup)
88
104
  self.args = args
105
+ @output_stream = output_stream
106
+ @setup = setup
89
107
  end
90
108
 
91
109
  def command
92
- if params[:rspec]
93
- params[:all] ? ALL_RSPEC_COMMAND : RSPEC_COMMAND
94
- elsif params[:rake]
95
- params[:all] ? ALL_RAKE_COMMAND : RAKE_COMMAND
96
- elsif params[:rails]
97
- params[:all] ? ALL_RAILS_COMMAND : RAILS_COMMAND
98
- elsif params[:ruby]
99
- params[:all] ? NO_COMMAND : RUBY_COMMAND
100
- else
101
- params[:command] || NO_COMMAND
110
+ return params[:command] if params[:command]
111
+
112
+ if params[:rspec] then rspec_command
113
+ elsif params[:rake] then rake_command
114
+ elsif params[:rails] then rails_command
115
+ elsif params[:ruby] then ruby_command
116
+ elsif params[:auto] then default_command
117
+ else default_command
102
118
  end
103
119
  end
104
120
 
@@ -110,5 +126,46 @@ module Retest
110
126
  def help?
111
127
  params[:help]
112
128
  end
129
+
130
+ private
131
+
132
+ def full_suite?
133
+ params[:all]
134
+ end
135
+
136
+ def default_command
137
+ choose_command @setup.type, command_for(@setup.type)
138
+ end
139
+
140
+ def command_for(type)
141
+ case type
142
+ when :rspec then rspec_command
143
+ when :rails then rails_command
144
+ when :rake then rake_command
145
+ when :ruby then ruby_command
146
+ else ruby_command
147
+ end
148
+ end
149
+
150
+ def choose_command(type, command)
151
+ @output_stream.puts "Setup identified: [#{type.upcase}]. Using command: '#{command}'"
152
+ command
153
+ end
154
+
155
+ def rspec_command
156
+ full_suite? ? ALL_RSPEC_COMMAND : RSPEC_COMMAND
157
+ end
158
+
159
+ def rails_command
160
+ full_suite? ? ALL_RAILS_COMMAND : RAILS_COMMAND
161
+ end
162
+
163
+ def rake_command
164
+ full_suite? ? ALL_RAKE_COMMAND : RAKE_COMMAND
165
+ end
166
+
167
+ def ruby_command
168
+ RUBY_COMMAND
169
+ end
113
170
  end
114
171
  end
@@ -10,18 +10,21 @@ module Retest
10
10
  end
11
11
 
12
12
  def find_test(path)
13
+ return unless path
14
+ return if path.empty?
15
+
13
16
  cache[path] ||= select_from TestOptions.for(path, files: files)
14
17
  end
15
18
 
16
19
  def add(added)
17
- return if added && added.empty?
20
+ return if added&.empty?
18
21
 
19
22
  files.push(*added)
20
23
  files.sort!
21
24
  end
22
25
 
23
26
  def remove(removed)
24
- return if removed && removed.empty?
27
+ return if removed&.empty?
25
28
 
26
29
  if removed.is_a?(Array)
27
30
  removed.each { |file| files.delete(file) }
data/lib/retest/runner.rb CHANGED
@@ -20,10 +20,20 @@ module Retest
20
20
  command == obj.command
21
21
  end
22
22
 
23
+ def cached_test_file
24
+ @cached_test_file
25
+ end
26
+
27
+ def cached_test_file=(value)
28
+ @cached_test_file = value || @cached_test_file
29
+ end
30
+
23
31
  def run(test_file = nil)
24
- if @cached_test_file = test_file || @cached_test_file
25
- puts "Test File Selected: #{@cached_test_file}"
26
- system command.gsub('<test>', @cached_test_file)
32
+ self.cached_test_file = test_file
33
+
34
+ if cached_test_file
35
+ puts "Test File Selected: #{cached_test_file}"
36
+ system command.gsub('<test>', cached_test_file)
27
37
  else
28
38
  puts <<~ERROR
29
39
  404 - Test File Not Found
@@ -31,12 +41,30 @@ module Retest
31
41
  ERROR
32
42
  end
33
43
  end
44
+
45
+ def remove(purged)
46
+ return if purged.empty?
47
+
48
+ if purged.is_a? Array
49
+ purge_cache if purged.include? cached_test_file
50
+ elsif purged.is_a? String
51
+ purge_cache if purged == cached_test_file
52
+ end
53
+ end
54
+
55
+ private
56
+
57
+ def purge_cache
58
+ @cached_test_file = nil
59
+ end
34
60
  end
35
61
 
36
62
  HardcodedRunner = Struct.new(:command) do
37
63
  def run(_ = nil)
38
64
  system command
39
65
  end
66
+
67
+ def remove(_ = nil); end
40
68
  end
41
69
  end
42
70
  end
@@ -0,0 +1,45 @@
1
+ module Retest
2
+ class Setup
3
+ def self.type
4
+ new.type
5
+ end
6
+
7
+ def type
8
+ @type ||= begin
9
+ return :ruby unless has_gemfile?
10
+
11
+ if rspec?
12
+ :rspec
13
+ elsif rails?
14
+ :rails
15
+ elsif rake?
16
+ :rake
17
+ else
18
+ :ruby
19
+ end
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def has_gemfile?
26
+ File.exist? 'Gemfile'
27
+ end
28
+
29
+ def rspec?
30
+ has_gem? 'rspec'
31
+ end
32
+
33
+ def rails?
34
+ File.exist? 'bin/rails'
35
+ end
36
+
37
+ def rake?
38
+ has_gem? 'rake'
39
+ end
40
+
41
+ def has_gem?(gem_name)
42
+ !`cat Gemfile | grep #{gem_name}`.empty?
43
+ end
44
+ end
45
+ end
@@ -1,3 +1,3 @@
1
1
  module Retest
2
- VERSION = "0.8.0.pre2"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -31,7 +31,17 @@ module Retest
31
31
  end
32
32
 
33
33
  def files
34
- `git ls-files`.split("\n")
34
+ (untracked_files + tracked_files).sort
35
+ end
36
+
37
+ private
38
+
39
+ def untracked_files
40
+ `git ls-files --other --exclude-standard -z`.split("\x0")
41
+ end
42
+
43
+ def tracked_files
44
+ `git ls-files -z`.split("\x0")
35
45
  end
36
46
  end
37
47
  end
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: 0.8.0.pre2
4
+ version: 0.9.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-02-25 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string-similarity
@@ -70,12 +70,19 @@ files:
70
70
  - README/demo.gif
71
71
  - Rakefile
72
72
  - bin/console
73
+ - bin/debug
73
74
  - bin/setup
75
+ - bin/test/hanami-app
76
+ - bin/test/rails-app
77
+ - bin/test/rspec-rails
78
+ - bin/test/rspec-ruby
79
+ - bin/test/ruby-app
74
80
  - exe/retest
75
81
  - lib/retest.rb
76
82
  - lib/retest/options.rb
77
83
  - lib/retest/repository.rb
78
84
  - lib/retest/runner.rb
85
+ - lib/retest/setup.rb
79
86
  - lib/retest/test_options.rb
80
87
  - lib/retest/version.rb
81
88
  - lib/retest/version_control.rb
@@ -97,9 +104,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
104
  version: 2.3.0
98
105
  required_rubygems_version: !ruby/object:Gem::Requirement
99
106
  requirements:
100
- - - ">"
107
+ - - ">="
101
108
  - !ruby/object:Gem::Version
102
- version: 1.3.1
109
+ version: '0'
103
110
  requirements: []
104
111
  rubygems_version: 3.0.3
105
112
  signing_key: