retest 0.5.0 → 0.6.0.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea38c836b4be97b77f96d723e3b0e9baa2c123e9ce774ef903afab933c8b35e3
4
- data.tar.gz: 863765b458c1f4dae039dd308152716fafaacc87a1cc81ad871dd1b18d86c093
3
+ metadata.gz: 6d366f005d9765a2da827543e444b70898d9a7f94f5fd8c2ca5782b3fa5a0058
4
+ data.tar.gz: de7a1863a92188221e05955fa518a54c4f73fe3468ca15c47b7a6aa36f1baa66
5
5
  SHA512:
6
- metadata.gz: ed8aef268501000e89fc6547b5fcb7ea19bde847801ac6157342c649493d662767b7156ef1337ddb67e8e2863b7504736ecc8696f74da697e29f991a92bf085d
7
- data.tar.gz: e1a5736f8a40d3288cfc586d5615d714919c1e1c9dc58f9b854bad02869639ecfbe9295d5ab51bd72cb615af4cfbcff5d0151b4d5c45e3bf5f498ac5b1495246
6
+ metadata.gz: 3277b79fce91040aac14f7e4980dc3687d6f02caed5ba47d629b106371780c65378e5dc1ecdcfa149c51e00f23022897aadb2c1cc249f3ca209ef267691f6f73
7
+ data.tar.gz: f8de2fc0468a666afe0e526b334147c5c32dbcb42a0621dbf7a0e7af084806500cba083dc19833174c6a3862715e2ed046dbe032576ef844823e1cdbd763153a
@@ -0,0 +1,35 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby:
22
+ - 2.5
23
+ - 2.6
24
+ - 2.7
25
+ name: Ruby ${{ matrix.ruby }} test
26
+ steps:
27
+ - uses: actions/checkout@v2
28
+ - name: Set up Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby }}
32
+ bundler-cache: true
33
+ - run: bundle install
34
+ - run: bundle exec rake
35
+ - run: bundle exec cucumber
@@ -0,0 +1 @@
1
+ 2.6.6
data/Gemfile CHANGED
@@ -3,6 +3,8 @@ 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"
6
8
  gem "rake", "~> 12.0"
7
9
  gem "minitest", "~> 5.0"
8
10
  gem "byebug"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- retest (0.5.0)
4
+ retest (0.6.0.pre)
5
5
  listen (~> 3.2)
6
6
  string-similarity (~> 2.1)
7
7
 
@@ -61,7 +61,7 @@ GEM
61
61
  ffi (1.13.1)
62
62
  i18n (1.8.5)
63
63
  concurrent-ruby (~> 1.0)
64
- listen (3.2.1)
64
+ listen (3.3.1)
65
65
  rb-fsevent (~> 0.10, >= 0.10.3)
66
66
  rb-inotify (~> 0.9, >= 0.9.10)
67
67
  middleware (0.1.0)
@@ -93,9 +93,9 @@ PLATFORMS
93
93
  ruby
94
94
 
95
95
  DEPENDENCIES
96
- aruba
96
+ aruba (~> 1.0)
97
97
  byebug
98
- cucumber
98
+ cucumber (~> 5.1)
99
99
  minitest (~> 5.0)
100
100
  rake (~> 12.0)
101
101
  retest!
data/README.md CHANGED
@@ -63,6 +63,10 @@ $ retest 'bundle exec rails test <test>'
63
63
  * If an error comes in try using `bundle exec` like so: `$ retest 'bundle exec rake test <test>'`
64
64
  * Aliases saved on ~/.bashrc or ~/.zshrc cannot be run that way with the `retest` command
65
65
 
66
+ ## Ruby Support
67
+
68
+ Retest supports ruby 2.5 and above.
69
+
66
70
  ## Roadmap
67
71
 
68
72
  - [x] MVP
@@ -73,7 +77,7 @@ $ retest 'bundle exec rails test <test>'
73
77
  - [x] Bundler Gem
74
78
  - [x] Rails
75
79
  - [x] Ad-hoc scripts
76
- - [ ] Hanami
80
+ - [x] Hanami
77
81
  - [ ] Sinatra
78
82
  - [ ] Cuba? Padrino?
79
83
  - [ ] Handle other languages: Elixir, Node, Python, PHP
data/exe/retest CHANGED
@@ -1,21 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'retest'
4
- require 'listen'
5
4
 
6
- puts "Launching Retest..."
5
+ Retest.logger = STDOUT
7
6
 
8
- command = Retest::Command.for(ARGV.join)
7
+ Retest.log "Launching Retest..."
9
8
 
10
- listener = Listen.to('.', Retest::ListenOptions.to_h) do |modified, added, removed|
11
- if modified.any?
12
- system("clear") || system("cls")
13
- command.run(modified.first.strip)
14
- end
15
- rescue => e
16
- puts "Something went wrong: #{e.message}"
17
- end
9
+ Retest
10
+ .build(command: Retest::Command.for(ARGV.join))
11
+ .start # not blocking
12
+
13
+ Retest.log "Ready to refactor! You can make file changes now"
18
14
 
19
- listener.start # not blocking
20
- puts "Ready to refactor! You can make file changes now"
21
15
  sleep
@@ -1,10 +1,27 @@
1
+ require 'listen'
2
+ require 'string/similarity'
3
+
1
4
  require "retest/version"
2
5
  require "retest/command"
3
6
  require "retest/repository"
4
7
  require "retest/test_options"
5
8
  require "retest/listen_options"
6
- require 'string/similarity'
9
+ require "retest/concerns/configurable"
7
10
 
8
11
  module Retest
12
+ include Configurable
9
13
  class Error < StandardError; end
14
+
15
+ def self.build(command:, clear_window: true)
16
+ Listen.to('.', ListenOptions.to_h) do |modified, added, removed|
17
+ begin
18
+ if modified.any?
19
+ system("clear") || system("cls") if clear_window
20
+ command.run(modified.first.strip)
21
+ end
22
+ rescue => e
23
+ puts "Something went wrong: #{e.message}"
24
+ end
25
+ end
26
+ end
10
27
  end
@@ -1,3 +1,5 @@
1
+ require 'open3'
2
+
1
3
  module Retest
2
4
  class Command
3
5
  def self.for(test_command)
@@ -22,10 +24,11 @@ module Retest
22
24
 
23
25
  def run(file_changed)
24
26
  if @cached_test_file = test_file(file_changed)
25
- puts "Test File Selected: #{cached_test_file}"
26
- system command.gsub('<test>', cached_test_file)
27
+ stdout_and_stderr_str, _ = Open3.capture2e command.gsub('<test>', cached_test_file)
28
+ Retest.log "Test File Selected: #{cached_test_file}"
29
+ Retest.log stdout_and_stderr_str
27
30
  else
28
- puts <<~ERROR
31
+ Retest.log <<~ERROR
29
32
  404 - Test File Not Found
30
33
  Retest could not find a matching test file to run.
31
34
  ERROR
@@ -39,7 +42,8 @@ module Retest
39
42
 
40
43
  HardcodedCommand = Struct.new(:command) do
41
44
  def run(_)
42
- system command
45
+ stdout_and_stderr_str, _ = Open3.capture2e(command)
46
+ Retest.log stdout_and_stderr_str
43
47
  end
44
48
  end
45
49
  end
@@ -0,0 +1,30 @@
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
@@ -26,7 +26,7 @@ module Retest
26
26
  end
27
27
 
28
28
  def installed?
29
- !`command -v #{self}`.empty?
29
+ system "git -C . rev-parse 2>&1"
30
30
  end
31
31
 
32
32
  def files
@@ -1,12 +1,11 @@
1
1
  module Retest
2
2
  class Repository
3
- attr_accessor :files, :cache, :input_stream, :output_stream
3
+ attr_accessor :files, :cache, :input_stream
4
4
 
5
- def initialize(files: nil, cache: {}, input_stream: nil, output_stream: nil)
5
+ def initialize(files: nil, cache: {}, input_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
10
9
  end
11
10
 
12
11
  def find_test(path)
@@ -30,7 +29,7 @@ module Retest
30
29
  end
31
30
 
32
31
  def ask_question(tests)
33
- output_stream.puts <<~QUESTION
32
+ Retest.log <<~QUESTION
34
33
  We found few tests matching:
35
34
  #{list_options(tests)}
36
35
 
@@ -1,3 +1,3 @@
1
1
  module Retest
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0.pre"
3
3
  end
File without changes
@@ -27,6 +27,4 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.add_runtime_dependency "string-similarity", ["~> 2.1"]
29
29
  spec.add_runtime_dependency "listen", ["~> 3.2"]
30
- spec.add_development_dependency "cucumber"
31
- spec.add_development_dependency "aruba"
32
30
  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.5.0
4
+ version: 0.6.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Barret
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-06 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string-similarity
@@ -38,34 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
- - !ruby/object:Gem::Dependency
42
- name: cucumber
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: aruba
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
41
  description:
70
42
  email:
71
43
  - alex@abletech.nz
@@ -74,8 +46,9 @@ executables:
74
46
  extensions: []
75
47
  extra_rdoc_files: []
76
48
  files:
49
+ - ".github/workflows/ci.yml"
77
50
  - ".gitignore"
78
- - ".travis.yml"
51
+ - ".ruby-version"
79
52
  - Gemfile
80
53
  - Gemfile.lock
81
54
  - LICENSE.txt
@@ -87,10 +60,12 @@ files:
87
60
  - exe/retest
88
61
  - lib/retest.rb
89
62
  - lib/retest/command.rb
63
+ - lib/retest/concerns/configurable.rb
90
64
  - lib/retest/listen_options.rb
91
65
  - lib/retest/repository.rb
92
66
  - lib/retest/test_options.rb
93
67
  - lib/retest/version.rb
68
+ - output.log
94
69
  - retest.gemspec
95
70
  homepage: https://github.com/AlexB52/retest
96
71
  licenses:
@@ -109,11 +84,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
84
  version: 2.3.0
110
85
  required_rubygems_version: !ruby/object:Gem::Requirement
111
86
  requirements:
112
- - - ">="
87
+ - - ">"
113
88
  - !ruby/object:Gem::Version
114
- version: '0'
89
+ version: 1.3.1
115
90
  requirements: []
116
- rubygems_version: 3.1.2
91
+ rubygems_version: 3.0.3
117
92
  signing_key:
118
93
  specification_version: 4
119
94
  summary: A simple command line tool to watch file change and run its matching spec.
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.4