retest 1.6.1 → 1.8.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/exe/retest +9 -4
- data/lib/retest/command.rb +0 -1
- data/lib/retest/options.rb +22 -22
- data/lib/retest/runners/variable_runner.rb +1 -1
- data/lib/retest/sounds.rb +19 -1
- data/lib/retest/version.rb +1 -1
- data/lib/retest.rb +6 -0
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 89898cfd99c7a977326f854924113de57fe34273748eaabadae36ebf8a9995db
         | 
| 4 | 
            +
              data.tar.gz: cbdd88f75d340d6ea46bc878ee9083a4b335b25c0014d3cf72de18dbe1bb3b2a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: cac17fe3587fa15b76f6c6fc13463bc5b9d5d3cfe2ca8d8ca57e67b7a5cbdb630905f3d74ddbeea00c1a3b16a176928222db29b10ecf6ad684020718519966e5
         | 
| 7 | 
            +
              data.tar.gz: 3f6b4e80e958f5de28fd35e2c0c32954d96061729190d9d88228c7fd0c1cdf8c176afcf3f45cbd9e7f48cfead91834cd5fe4f8ba26db6a804b9f163fafd6a32c
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/exe/retest
    CHANGED
    
    | @@ -16,7 +16,7 @@ command    = Retest::Command.for_options(options) | |
| 16 16 | 
             
            runner     = Retest::Runners.runner_for(command.to_s)
         | 
| 17 17 | 
             
            sounds     = Retest::Sounds.for(options)
         | 
| 18 18 |  | 
| 19 | 
            -
            sounds.play(: | 
| 19 | 
            +
            sounds.play(:start)
         | 
| 20 20 | 
             
            runner.add_observer(sounds)
         | 
| 21 21 |  | 
| 22 22 | 
             
            program = Retest::Program.new(
         | 
| @@ -30,16 +30,21 @@ if options.params[:diff] | |
| 30 30 | 
             
              return
         | 
| 31 31 | 
             
            end
         | 
| 32 32 |  | 
| 33 | 
            +
            launching_message = "Launching Retest..."
         | 
| 34 | 
            +
            if options.force_polling?
         | 
| 35 | 
            +
              launching_message = "Launching Retest with polling method..."
         | 
| 36 | 
            +
            end
         | 
| 37 | 
            +
             | 
| 33 38 | 
             
            # Main action
         | 
| 34 39 |  | 
| 35 | 
            -
            $stdout.puts  | 
| 36 | 
            -
             | 
| 40 | 
            +
            $stdout.puts launching_message
         | 
| 41 | 
            +
            Retest.listen(options) do |modified, added, removed|
         | 
| 37 42 | 
             
              begin
         | 
| 38 43 | 
             
                program.run(modified, added, removed)
         | 
| 39 44 | 
             
              rescue => e
         | 
| 40 45 | 
             
                $stdout.puts "Something went wrong: #{e.message}"
         | 
| 41 46 | 
             
              end
         | 
| 42 | 
            -
            end | 
| 47 | 
            +
            end
         | 
| 43 48 | 
             
            $stdout.puts "Ready to refactor! You can make file changes now"
         | 
| 44 49 |  | 
| 45 50 | 
             
            # not blocking
         | 
    
        data/lib/retest/command.rb
    CHANGED
    
    
    
        data/lib/retest/options.rb
    CHANGED
    
    | @@ -13,13 +13,18 @@ module Retest | |
| 13 13 |  | 
| 14 14 | 
             
                  example <<~EOS
         | 
| 15 15 | 
             
                  Runs a matching rails test after a file change
         | 
| 16 | 
            -
                    $ retest ' | 
| 16 | 
            +
                    $ retest 'bin/rails test <test>'
         | 
| 17 17 | 
             
                    $ retest --rails
         | 
| 18 18 | 
             
                  EOS
         | 
| 19 19 |  | 
| 20 | 
            +
                  example <<~EOS
         | 
| 21 | 
            +
                  Runs rubocop and matching rails test after a file change
         | 
| 22 | 
            +
                    $ retest 'rubocop <changed> && bin/rails test <test>'
         | 
| 23 | 
            +
                  EOS
         | 
| 24 | 
            +
             | 
| 20 25 | 
             
                  example <<~EOS
         | 
| 21 26 | 
             
                  Runs all rails tests after a file change
         | 
| 22 | 
            -
                    $ retest ' | 
| 27 | 
            +
                    $ retest 'bin/rails test'
         | 
| 23 28 | 
             
                    $ retest --rails --all
         | 
| 24 29 | 
             
                  EOS
         | 
| 25 30 |  | 
| @@ -31,19 +36,17 @@ module Retest | |
| 31 36 | 
             
                  example <<~EOS
         | 
| 32 37 | 
             
                  Let retest identify which command to run
         | 
| 33 38 | 
             
                    $ retest
         | 
| 34 | 
            -
                    $ retest --auto
         | 
| 35 39 | 
             
                  EOS
         | 
| 36 40 |  | 
| 37 41 | 
             
                  example <<~EOS
         | 
| 38 42 | 
             
                  Let retest identify which command to run for all tests
         | 
| 39 43 | 
             
                    $ retest --all
         | 
| 40 | 
            -
                    $ retest --auto --all
         | 
| 41 44 | 
             
                  EOS
         | 
| 42 45 |  | 
| 43 46 | 
             
                  example <<~EOS
         | 
| 44 47 | 
             
                  Run a sanity check on changed files from a branch
         | 
| 48 | 
            +
                    $ retest --diff main
         | 
| 45 49 | 
             
                    $ retest --diff origin/main --rails
         | 
| 46 | 
            -
                    $ retest --diff main --auto
         | 
| 47 50 | 
             
                  EOS
         | 
| 48 51 | 
             
                end
         | 
| 49 52 |  | 
| @@ -51,7 +54,7 @@ module Retest | |
| 51 54 | 
             
                  optional
         | 
| 52 55 | 
             
                  desc <<~EOS
         | 
| 53 56 | 
             
                  The test command to rerun when a file changes.
         | 
| 54 | 
            -
                  Use <test>  | 
| 57 | 
            +
                  Use <test> or <changed> placeholders to tell retest where to reference the matching spec or the changed file in the command.
         | 
| 55 58 | 
             
                  EOS
         | 
| 56 59 | 
             
                end
         | 
| 57 60 |  | 
| @@ -71,11 +74,6 @@ module Retest | |
| 71 74 | 
             
                  desc "Run all the specs of a specificied ruby setup"
         | 
| 72 75 | 
             
                end
         | 
| 73 76 |  | 
| 74 | 
            -
                flag :auto do
         | 
| 75 | 
            -
                  long "--auto"
         | 
| 76 | 
            -
                  desc "Indentify repository setup and runs appropriate command"
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
             | 
| 79 77 | 
             
                flag :notify do
         | 
| 80 78 | 
             
                  long "--notify"
         | 
| 81 79 | 
             
                  desc "Play a sound when specs pass or fail (macOS only)"
         | 
| @@ -87,6 +85,15 @@ module Retest | |
| 87 85 | 
             
                  desc "Print usage"
         | 
| 88 86 | 
             
                end
         | 
| 89 87 |  | 
| 88 | 
            +
                option :polling do
         | 
| 89 | 
            +
                  long '--polling'
         | 
| 90 | 
            +
                  desc <<~DESC.strip
         | 
| 91 | 
            +
                    Use polling method when listening to file changes
         | 
| 92 | 
            +
                    Some filesystems won't work without it
         | 
| 93 | 
            +
                    VM/Vagrant Shared folders, NFS, Samba, sshfs...
         | 
| 94 | 
            +
                  DESC
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 90 97 | 
             
                flag :rspec do
         | 
| 91 98 | 
             
                  long "--rspec"
         | 
| 92 99 | 
             
                  desc "Shortcut for a standard RSpec setup"
         | 
| @@ -130,23 +137,16 @@ module Retest | |
| 130 137 | 
             
                  params[:all]
         | 
| 131 138 | 
             
                end
         | 
| 132 139 |  | 
| 133 | 
            -
                def auto?
         | 
| 134 | 
            -
                  return true if no_options_passed?
         | 
| 135 | 
            -
                  params[:auto]
         | 
| 136 | 
            -
                end
         | 
| 137 | 
            -
             | 
| 138 140 | 
             
                def notify?
         | 
| 139 141 | 
             
                  params[:notify]
         | 
| 140 142 | 
             
                end
         | 
| 141 143 |  | 
| 142 | 
            -
                def  | 
| 143 | 
            -
                   | 
| 144 | 
            +
                def force_polling?
         | 
| 145 | 
            +
                  params[:polling]
         | 
| 144 146 | 
             
                end
         | 
| 145 147 |  | 
| 146 | 
            -
                 | 
| 147 | 
            -
             | 
| 148 | 
            -
                def no_options_passed?
         | 
| 149 | 
            -
                  params.to_h.values.compact.uniq == ["\\.rb$", false]
         | 
| 148 | 
            +
                def extension
         | 
| 149 | 
            +
                  Regexp.new(params[:ext])
         | 
| 150 150 | 
             
                end
         | 
| 151 151 | 
             
              end
         | 
| 152 152 | 
             
            end
         | 
    
        data/lib/retest/sounds.rb
    CHANGED
    
    | @@ -24,6 +24,8 @@ module Retest | |
| 24 24 | 
             
                      ['afplay', '/System/Library/Sounds/Sosumi.aiff']
         | 
| 25 25 | 
             
                    when :tests_pass
         | 
| 26 26 | 
             
                      ['afplay', '/System/Library/Sounds/Funk.aiff']
         | 
| 27 | 
            +
                    when :start
         | 
| 28 | 
            +
                      ['afplay', '/System/Library/Sounds/Blow.aiff']
         | 
| 27 29 | 
             
                    else
         | 
| 28 30 | 
             
                      raise ArgumentError.new("No sounds were found for type: #{sound}.")
         | 
| 29 31 | 
             
                    end
         | 
| @@ -33,4 +35,20 @@ module Retest | |
| 33 35 | 
             
                  alias update play
         | 
| 34 36 | 
             
                end
         | 
| 35 37 | 
             
              end
         | 
| 36 | 
            -
            end
         | 
| 38 | 
            +
            end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            # List of Mac Audio Files:
         | 
| 41 | 
            +
            # afplay /System/Library/Sounds/Basso.aiff
         | 
| 42 | 
            +
            # afplay /System/Library/Sounds/Bottle.aiff
         | 
| 43 | 
            +
            # afplay /System/Library/Sounds/Funk.aiff
         | 
| 44 | 
            +
            # afplay /System/Library/Sounds/Hero.aiff
         | 
| 45 | 
            +
            # afplay /System/Library/Sounds/Ping.aiff
         | 
| 46 | 
            +
            # afplay /System/Library/Sounds/Purr.aiff
         | 
| 47 | 
            +
            # afplay /System/Library/Sounds/Submarine.aiff
         | 
| 48 | 
            +
            # afplay /System/Library/Sounds/Blow.aiff
         | 
| 49 | 
            +
            # afplay /System/Library/Sounds/Frog.aiff
         | 
| 50 | 
            +
            # afplay /System/Library/Sounds/Glass.aiff
         | 
| 51 | 
            +
            # afplay /System/Library/Sounds/Morse.aiff
         | 
| 52 | 
            +
            # afplay /System/Library/Sounds/Pop.aiff
         | 
| 53 | 
            +
            # afplay /System/Library/Sounds/Sosumi.aiff
         | 
| 54 | 
            +
            # afplay /System/Library/Sounds/Tink.aiff
         | 
    
        data/lib/retest/version.rb
    CHANGED
    
    
    
        data/lib/retest.rb
    CHANGED
    
    | @@ -16,4 +16,10 @@ require "retest/sounds" | |
| 16 16 |  | 
| 17 17 | 
             
            module Retest
         | 
| 18 18 | 
             
              class Error < StandardError; end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def self.listen(options, listener: Listen)
         | 
| 21 | 
            +
                listener.to('.', only: options.extension, relative: true, force_polling: options.force_polling?) do |modified, added, removed|
         | 
| 22 | 
            +
                  yield modified, added, removed
         | 
| 23 | 
            +
                end.start
         | 
| 24 | 
            +
              end
         | 
| 19 25 | 
             
            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. | 
| 4 | 
            +
              version: 1.8.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: 2022- | 
| 11 | 
            +
            date: 2022-07-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: string-similarity
         |