retest 0.6.0.pre → 0.6.0.pre2
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/.github/workflows/ci.yml +1 -1
 - data/Gemfile.lock +1 -1
 - data/exe/retest +3 -3
 - data/lib/retest.rb +2 -4
 - data/lib/retest/command.rb +4 -8
 - data/lib/retest/repository.rb +4 -3
 - data/lib/retest/version.rb +1 -1
 - metadata +6 -8
 - data/lib/retest/concerns/configurable.rb +0 -30
 - data/output.log +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d55eddf3b57a090756f298ddef8ee56e5fb1fda5cf418eeef09e439ef17735a4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0a24792e30b8954c09614460d0bb5a94ff1ae796da17fe66da1a499bfac7422c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 335d9c2089ee743e55d3e2f16494cdb566314f072cfea689c03f2c08f7e8df08d9911eebce490fa621aaa654ebbcac61e9972d69eee24e9d660bb6093a17ef82
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 433796d6539aca269288e5d7923207fbc96f3ab70fdea5ac8464f8f179973c5cf106786cb507c5bc4e6dabba242b201b18197911dc8899a11d3c038dd64f5cf1
         
     | 
    
        data/.github/workflows/ci.yml
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/exe/retest
    CHANGED
    
    | 
         @@ -2,14 +2,14 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'retest'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            $stdout.sync = true
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
            puts "Launching Retest..."
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            Retest
         
     | 
| 
       10 
10 
     | 
    
         
             
              .build(command: Retest::Command.for(ARGV.join))
         
     | 
| 
       11 
11 
     | 
    
         
             
              .start # not blocking
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            puts "Ready to refactor! You can make file changes now"
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            sleep
         
     | 
    
        data/lib/retest.rb
    CHANGED
    
    | 
         @@ -6,17 +6,15 @@ require "retest/command" 
     | 
|
| 
       6 
6 
     | 
    
         
             
            require "retest/repository"
         
     | 
| 
       7 
7 
     | 
    
         
             
            require "retest/test_options"
         
     | 
| 
       8 
8 
     | 
    
         
             
            require "retest/listen_options"
         
     | 
| 
       9 
     | 
    
         
            -
            require "retest/concerns/configurable"
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
10 
     | 
    
         
             
            module Retest
         
     | 
| 
       12 
     | 
    
         
            -
              include Configurable
         
     | 
| 
       13 
11 
     | 
    
         
             
              class Error < StandardError; end
         
     | 
| 
       14 
12 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
              def self.build(command 
     | 
| 
      
 13 
     | 
    
         
            +
              def self.build(command:)
         
     | 
| 
       16 
14 
     | 
    
         
             
                Listen.to('.', ListenOptions.to_h) do |modified, added, removed|
         
     | 
| 
       17 
15 
     | 
    
         
             
                  begin
         
     | 
| 
       18 
16 
     | 
    
         
             
                    if modified.any?
         
     | 
| 
       19 
     | 
    
         
            -
                       
     | 
| 
      
 17 
     | 
    
         
            +
                      `clear 2>&1` || `cls 2>&1`
         
     | 
| 
       20 
18 
     | 
    
         
             
                      command.run(modified.first.strip)
         
     | 
| 
       21 
19 
     | 
    
         
             
                    end
         
     | 
| 
       22 
20 
     | 
    
         
             
                  rescue => e
         
     | 
    
        data/lib/retest/command.rb
    CHANGED
    
    | 
         @@ -1,5 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'open3'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            module Retest
         
     | 
| 
       4 
2 
     | 
    
         
             
              class Command
         
     | 
| 
       5 
3 
     | 
    
         
             
                def self.for(test_command)
         
     | 
| 
         @@ -24,11 +22,10 @@ module Retest 
     | 
|
| 
       24 
22 
     | 
    
         | 
| 
       25 
23 
     | 
    
         
             
                  def run(file_changed)
         
     | 
| 
       26 
24 
     | 
    
         
             
                    if @cached_test_file = test_file(file_changed)
         
     | 
| 
       27 
     | 
    
         
            -
                       
     | 
| 
       28 
     | 
    
         
            -
                       
     | 
| 
       29 
     | 
    
         
            -
                      Retest.log stdout_and_stderr_str
         
     | 
| 
      
 25 
     | 
    
         
            +
                      puts "Test File Selected: #{cached_test_file}"
         
     | 
| 
      
 26 
     | 
    
         
            +
                      system command.gsub('<test>', cached_test_file)
         
     | 
| 
       30 
27 
     | 
    
         
             
                    else
         
     | 
| 
       31 
     | 
    
         
            -
                       
     | 
| 
      
 28 
     | 
    
         
            +
                      puts <<~ERROR
         
     | 
| 
       32 
29 
     | 
    
         
             
                        404 - Test File Not Found
         
     | 
| 
       33 
30 
     | 
    
         
             
                        Retest could not find a matching test file to run.
         
     | 
| 
       34 
31 
     | 
    
         
             
                      ERROR
         
     | 
| 
         @@ -42,8 +39,7 @@ module Retest 
     | 
|
| 
       42 
39 
     | 
    
         | 
| 
       43 
40 
     | 
    
         
             
                HardcodedCommand = Struct.new(:command) do
         
     | 
| 
       44 
41 
     | 
    
         
             
                  def run(_)
         
     | 
| 
       45 
     | 
    
         
            -
                     
     | 
| 
       46 
     | 
    
         
            -
                    Retest.log stdout_and_stderr_str
         
     | 
| 
      
 42 
     | 
    
         
            +
                    system command
         
     | 
| 
       47 
43 
     | 
    
         
             
                  end
         
     | 
| 
       48 
44 
     | 
    
         
             
                end
         
     | 
| 
       49 
45 
     | 
    
         
             
              end
         
     | 
    
        data/lib/retest/repository.rb
    CHANGED
    
    | 
         @@ -1,11 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Retest
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Repository
         
     | 
| 
       3 
     | 
    
         
            -
                attr_accessor :files, :cache, :input_stream
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_accessor :files, :cache, :input_stream, :output_stream
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
                def initialize(files: nil, cache: {}, input_stream: nil)
         
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(files: nil, cache: {}, input_stream: nil, output_stream: nil)
         
     | 
| 
       6 
6 
     | 
    
         
             
                  @cache         = cache
         
     | 
| 
       7 
7 
     | 
    
         
             
                  @files         = files || default_files
         
     | 
| 
       8 
8 
     | 
    
         
             
                  @input_stream  = input_stream || STDIN
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @output_stream = output_stream|| STDOUT
         
     | 
| 
       9 
10 
     | 
    
         
             
                end
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
                def find_test(path)
         
     | 
| 
         @@ -29,7 +30,7 @@ module Retest 
     | 
|
| 
       29 
30 
     | 
    
         
             
                end
         
     | 
| 
       30 
31 
     | 
    
         | 
| 
       31 
32 
     | 
    
         
             
                def ask_question(tests)
         
     | 
| 
       32 
     | 
    
         
            -
                   
     | 
| 
      
 33 
     | 
    
         
            +
                  output_stream.puts <<~QUESTION
         
     | 
| 
       33 
34 
     | 
    
         
             
                    We found few tests matching:
         
     | 
| 
       34 
35 
     | 
    
         
             
                    #{list_options(tests)}
         
     | 
| 
       35 
36 
     | 
    
         | 
    
        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: 0.6.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.0.pre2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alexandre Barret
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire:
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-11-17 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: string-similarity
         
     | 
| 
         @@ -38,7 +38,7 @@ dependencies: 
     | 
|
| 
       38 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
40 
     | 
    
         
             
                    version: '3.2'
         
     | 
| 
       41 
     | 
    
         
            -
            description:
         
     | 
| 
      
 41 
     | 
    
         
            +
            description: 
         
     | 
| 
       42 
42 
     | 
    
         
             
            email:
         
     | 
| 
       43 
43 
     | 
    
         
             
            - alex@abletech.nz
         
     | 
| 
       44 
44 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -60,12 +60,10 @@ files: 
     | 
|
| 
       60 
60 
     | 
    
         
             
            - exe/retest
         
     | 
| 
       61 
61 
     | 
    
         
             
            - lib/retest.rb
         
     | 
| 
       62 
62 
     | 
    
         
             
            - lib/retest/command.rb
         
     | 
| 
       63 
     | 
    
         
            -
            - lib/retest/concerns/configurable.rb
         
     | 
| 
       64 
63 
     | 
    
         
             
            - lib/retest/listen_options.rb
         
     | 
| 
       65 
64 
     | 
    
         
             
            - lib/retest/repository.rb
         
     | 
| 
       66 
65 
     | 
    
         
             
            - lib/retest/test_options.rb
         
     | 
| 
       67 
66 
     | 
    
         
             
            - lib/retest/version.rb
         
     | 
| 
       68 
     | 
    
         
            -
            - output.log
         
     | 
| 
       69 
67 
     | 
    
         
             
            - retest.gemspec
         
     | 
| 
       70 
68 
     | 
    
         
             
            homepage: https://github.com/AlexB52/retest
         
     | 
| 
       71 
69 
     | 
    
         
             
            licenses:
         
     | 
| 
         @@ -73,7 +71,7 @@ licenses: 
     | 
|
| 
       73 
71 
     | 
    
         
             
            metadata:
         
     | 
| 
       74 
72 
     | 
    
         
             
              homepage_uri: https://github.com/AlexB52/retest
         
     | 
| 
       75 
73 
     | 
    
         
             
              source_code_uri: https://github.com/AlexB52/retest
         
     | 
| 
       76 
     | 
    
         
            -
            post_install_message:
         
     | 
| 
      
 74 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
       77 
75 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       78 
76 
     | 
    
         
             
            require_paths:
         
     | 
| 
       79 
77 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -89,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       89 
87 
     | 
    
         
             
                  version: 1.3.1
         
     | 
| 
       90 
88 
     | 
    
         
             
            requirements: []
         
     | 
| 
       91 
89 
     | 
    
         
             
            rubygems_version: 3.0.3
         
     | 
| 
       92 
     | 
    
         
            -
            signing_key:
         
     | 
| 
      
 90 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
       93 
91 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       94 
92 
     | 
    
         
             
            summary: A simple command line tool to watch file change and run its matching spec.
         
     | 
| 
       95 
93 
     | 
    
         
             
            test_files: []
         
     | 
| 
         @@ -1,30 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Configurable
         
     | 
| 
       2 
     | 
    
         
            -
              def self.included(base)
         
     | 
| 
       3 
     | 
    
         
            -
                base.extend ClassMethods
         
     | 
| 
       4 
     | 
    
         
            -
              end
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
              class Configuration
         
     | 
| 
       7 
     | 
    
         
            -
                extend Forwardable
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                attr_accessor :logger
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                def_delegator :logger, :puts
         
     | 
| 
       12 
     | 
    
         
            -
                alias :log :puts
         
     | 
| 
       13 
     | 
    
         
            -
              end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
              module ClassMethods
         
     | 
| 
       16 
     | 
    
         
            -
                extend Forwardable
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                attr_writer :configuration
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                def_delegators :configuration, :log, :logger, :logger=
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                def configuration
         
     | 
| 
       23 
     | 
    
         
            -
                  @configuration ||= Configuration.new
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                def configure
         
     | 
| 
       27 
     | 
    
         
            -
                  yield configuration
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
              end
         
     | 
| 
       30 
     | 
    
         
            -
            end
         
     | 
    
        data/output.log
    DELETED
    
    | 
         
            File without changes
         
     |