retest 1.1.0 → 1.2.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: 7cec5f35b345630339ca56cfd0c1bc88be03596ca4d8369695f2e87f66e7c608
4
- data.tar.gz: db0b1f966bb2ebe14183e17e93003c0d504881dc2a7d8fe2614f5c202b0fcf55
3
+ metadata.gz: 13ce5e74ba4682f3777259a6565c585271dd7db5f6d753c4e5d6836f5c457634
4
+ data.tar.gz: bfc62c5fd481982435b3ee8e372839b7678e489d8123bbcd629c5ba56c2b7012
5
5
  SHA512:
6
- metadata.gz: 2b191a17f73446b41fd5fdf9bc7495f4ea0535c05681e1d14e191cb62f6cadc83d09454ad501fc98ce503db6a169b628b6d205328ca4a236ddf56bbc75d78bff
7
- data.tar.gz: e1089b2d8c64c380c2fd08935f8b0ded1dee4ccb2f265ff20c6f12eeea91942ef0e4c9a6a154b48a270a4c3281fa2e3edf981925f50c6767c98a2bbcbd1cd6f3
6
+ metadata.gz: ef3ee2efb84b012c5b6ba340d81e578ec512960e7fc28516abbc23689c8ad43f3c3a5ecd1855d51df1bcee5a426fdd92aef3f460a65fbb7c39d35d83ad08c735
7
+ data.tar.gz: e5af1bbe78c6bfa347088fc0ec3c8e985a1dbad5393f47640b7885cf4a0bbdd5cbc8c8922f7b189794027af4e7091dc36fd81693e5d785cf11e330fd2ea78dc0
@@ -44,11 +44,12 @@ jobs:
44
44
  matrix:
45
45
  repo:
46
46
  - ruby-app
47
- - rails-app
47
+ - ruby-bare
48
+ - git-ruby
48
49
  - hanami-app
50
+ - rails-app
49
51
  - rspec-rails
50
52
  - rspec-ruby
51
- - git-ruby
52
53
  steps:
53
54
  - uses: actions/checkout@v2
54
55
  - name: Set up Ruby
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- retest (1.1.0)
4
+ retest (1.2.0)
5
5
  listen (~> 3.2)
6
6
  string-similarity (~> 2.1)
7
7
  tty-option (~> 0.1)
@@ -16,7 +16,7 @@ GEM
16
16
  rb-inotify (~> 0.9, >= 0.9.10)
17
17
  minitest (5.14.1)
18
18
  rake (12.3.3)
19
- rb-fsevent (0.10.4)
19
+ rb-fsevent (0.11.0)
20
20
  rb-inotify (0.10.1)
21
21
  ffi (~> 1.0)
22
22
  string-similarity (2.1.0)
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/retest.svg)](https://badge.fury.io/rb/retest)
2
+
1
3
  # Retest
2
4
 
3
5
  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)
@@ -13,6 +15,7 @@ Install it on your machine without adding it on a Gemfile:
13
15
  $ gem install retest
14
16
 
15
17
  ## Usage
18
+ ### Refactoring
16
19
 
17
20
  Launch `retest` in your terminal after accessing your ruby repository.
18
21
 
@@ -28,11 +31,10 @@ Few shortcut flags exist to avoid writing the full test command.
28
31
  $ retest --rails
29
32
  $ retest --rake --all
30
33
 
31
- Finally let retest automatically find your ruby setup and run the appropriate command using:
34
+ Or let retest find your ruby setup and run the appropriate command using:
32
35
 
33
36
  $ retest
34
- $ retest --auto
35
- $ retest --auto --all
37
+ $ retest --all
36
38
 
37
39
  The gem works as follows:
38
40
 
@@ -41,7 +43,15 @@ The gem works as follows:
41
43
  * When multiple matching test files are found, retest asks you to confirm the file and save the answer.
42
44
  * When a test file is not found, retest runs the last run command or throw a 404.
43
45
 
44
- See more example with `retest -h`
46
+ ### Diff Check
47
+
48
+ You can diff a branch and test all the relevant test files before pushing your branch and trigger the full CI suite.
49
+
50
+ $ retest --diff origin/main
51
+
52
+ ### Help
53
+
54
+ See more examples with `retest -h`
45
55
 
46
56
  ```
47
57
  Usage: retest [OPTIONS] [COMMAND]
@@ -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-bare/retest.gem
6
+ docker-compose -f features/ruby-bare/docker-compose.yml up --build --exit-code-from retest
data/lib/retest.rb CHANGED
@@ -9,6 +9,7 @@ require "retest/options"
9
9
  require "retest/version_control"
10
10
  require "retest/setup"
11
11
  require "retest/command"
12
+ require "retest/file_system"
12
13
 
13
14
  module Retest
14
15
  class Error < StandardError; end
@@ -1,8 +1,8 @@
1
1
  module Retest
2
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
3
+ Rails = Struct.new(:all, :file_system) do
4
+ def self.command(all:, file_system: FileSystem)
5
+ new(all, file_system).command
6
6
  end
7
7
 
8
8
  def command
@@ -13,7 +13,7 @@ module Retest
13
13
  private
14
14
 
15
15
  def root_command
16
- return 'bin/rails test' if bin_file
16
+ return 'bin/rails test' if file_system.exist? 'bin/rails'
17
17
 
18
18
  'bundle exec rails test'
19
19
  end
@@ -1,8 +1,8 @@
1
1
  module Retest
2
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
3
+ Rake = Struct.new(:all, :file_system) do
4
+ def self.command(all:, file_system: FileSystem)
5
+ new(all, file_system).command
6
6
  end
7
7
 
8
8
  def command
@@ -13,7 +13,7 @@ module Retest
13
13
  private
14
14
 
15
15
  def root_command
16
- return 'bin/rake test' if bin_file
16
+ return 'bin/rake test' if file_system.exist? 'bin/rake'
17
17
 
18
18
  'bundle exec rake test'
19
19
  end
@@ -1,8 +1,8 @@
1
1
  module Retest
2
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
3
+ Rspec = Struct.new(:all, :file_system) do
4
+ def self.command(all:, file_system: FileSystem)
5
+ new(all, file_system).command
6
6
  end
7
7
 
8
8
  def command
@@ -13,7 +13,7 @@ module Retest
13
13
  private
14
14
 
15
15
  def root_command
16
- return 'bin/rspec' if bin_file
16
+ return 'bin/rspec' if file_system.exist? 'bin/rspec'
17
17
 
18
18
  'bundle exec rspec'
19
19
  end
@@ -1,12 +1,14 @@
1
1
  module Retest
2
2
  class Command
3
- Ruby = Struct.new(:all, :bin_file) do
4
- def self.command(all: false, bin_file: false)
5
- new(false, false).command
6
- end
3
+ module Ruby
4
+ module_function
7
5
 
8
- def command
9
- 'bundle exec ruby <test>'
6
+ def command(all: false, file_system: FileSystem)
7
+ if file_system.exist? 'Gemfile.lock'
8
+ 'bundle exec ruby <test>'
9
+ else
10
+ 'ruby <test>'
11
+ end
10
12
  end
11
13
  end
12
14
  end
@@ -0,0 +1,9 @@
1
+ module Retest
2
+ module FileSystem
3
+ module_function
4
+
5
+ def exist?(value)
6
+ File.exist? value
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Retest
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  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: 1.1.0
4
+ version: 1.2.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-27 00:00:00.000000000 Z
11
+ date: 2021-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string-similarity
@@ -78,6 +78,7 @@ files:
78
78
  - bin/test/rspec-rails
79
79
  - bin/test/rspec-ruby
80
80
  - bin/test/ruby-app
81
+ - bin/test/ruby-bare
81
82
  - exe/retest
82
83
  - lib/retest.rb
83
84
  - lib/retest/command.rb
@@ -85,6 +86,7 @@ files:
85
86
  - lib/retest/command/rake.rb
86
87
  - lib/retest/command/rspec.rb
87
88
  - lib/retest/command/ruby.rb
89
+ - lib/retest/file_system.rb
88
90
  - lib/retest/options.rb
89
91
  - lib/retest/repository.rb
90
92
  - lib/retest/runner.rb