gouteur 1.1.0 → 1.3.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: 56cca423043e101ebc4014b3b5bb4bc8edf1dd27ce25493b6ec918fe6da669c8
4
- data.tar.gz: a92f38d08ce56549acae5b6696e2519f0cbef9820750bb29cef419f867448ccc
3
+ metadata.gz: '00098007006dc0f35add3bdd75050030c58615b570c2ad2ac3e3000cba0262f4'
4
+ data.tar.gz: 5b946e3476cb6b41e8f28f9867993b7eaf5ff93e3cc3bfc2a9ad7ae971d6dc99
5
5
  SHA512:
6
- metadata.gz: 56dfc4cb69657e92322d1e7105bb8d2df73de9b230673758eb98842ec39b5033e56d7d7c6ba39a41a8149734c0db6898157844b7f3b31427febd9b5711cbef2b
7
- data.tar.gz: 9b5ceb4857337045681e84448301cafb8985f441816c8f9188706f70b5e95f736b62d739bc90d0abe9f46a4888ff6b59702d3c511e79b193d65ec8beaa337318
6
+ metadata.gz: bc3ca7b924e97d8d3853e0e6d172d7108e6fbadee6f9ea36387827236a4987fb3419774f6387a5795d2f99cd2d27c3ad672b9658a3318b057bb8afd94161e62f
7
+ data.tar.gz: 205d72b14399f22afa20c244f49d6cca3a0cb19706fd3e6aacbf85958df42ac534b914cdfe6d4ec92dcfec0eb0fae5a48614a5ee866bdbcb694707ed641dce78
@@ -8,10 +8,10 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby: [ '2.6', '3.0', 'ruby-head' ]
11
+ ruby: [ '3.4', '4.0' ]
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v2
14
+ - uses: actions/checkout@v4
15
15
  - name: Set up Ruby ${{ matrix.ruby }}
16
16
  uses: ruby/setup-ruby@v1
17
17
  with:
@@ -21,8 +21,12 @@ jobs:
21
21
  git config --global init.defaultBranch main
22
22
  git config --global user.email "testuser@example.com"
23
23
  git config --global user.name "Test User"
24
- gem install bundler -v 2.2.8
24
+ gem update --system
25
+ gem install bundler -v 4.0.9
25
26
  bundle install --jobs 4
26
- - name: Run the specs
27
+ BUNDLE_GEMFILE=spec/gouteur/example_repo/Gemfile bundle install --jobs 4
28
+ - name: Build
27
29
  run: |
28
- bundle exec rspec
30
+ bundle exec rake
31
+ - uses: codecov/codecov-action@v3
32
+ if: matrix.ruby == '4.0'
data/.gitignore CHANGED
@@ -13,5 +13,6 @@
13
13
 
14
14
  Gemfile.gouteur
15
15
  Gemfile.gouteur.lock
16
+ Gemfile.lock
16
17
 
17
18
  TODO
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.3.0] - 2026-11-17
4
+
5
+ ### Added
6
+
7
+ - `quick` flag to skip pre-test with old dependency code
8
+
9
+ ### Fixed
10
+
11
+ - respect `force` flag in yml config
12
+
13
+ ## [1.2.0] - 2026-04-04
14
+
15
+ ### Added
16
+
17
+ - Support for repos where the bundle is in a subdirectory
18
+
3
19
  ## [1.1.0] - 2023-02-21
4
20
 
5
21
  ### Added
data/Gemfile CHANGED
@@ -3,14 +3,12 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in gouteur.gemspec
4
4
  gemspec
5
5
 
6
+ gem 'debug'
7
+ gem 'example_repo', '0.1.0', path: './spec/gouteur/example_repo'
6
8
  gem 'rake', '~> 13.0'
7
-
9
+ gem 'relaxed-rubocop'
8
10
  gem 'rspec', '~> 3.0'
9
-
10
11
  gem 'rubocop', '~> 1.7'
11
-
12
- gem 'relaxed-rubocop'
13
-
14
- gem 'example_repo', '0.1.0', path: './spec/gouteur/example_repo'
15
-
16
- gem 'debug'
12
+ if RUBY_VERSION.to_f >= 3.0
13
+ gem "simplecov-cobertura"
14
+ end
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/gouteur.svg)](http://badge.fury.io/rb/gouteur)
4
4
  [![Build Status](https://github.com/jaynetics/gouteur/workflows/build/badge.svg)](https://github.com/jaynetics/gouteur/actions)
5
+ [![Coverage](https://codecov.io/gh/jaynetics/gouteur/branch/main/graph/badge.svg?token=519NAAEQFC)](https://codecov.io/gh/jaynetics/gouteur)
5
6
 
6
7
  Treat the people that use your gem like royalty! Send for a [gouteur](https://en.wikipedia.org/wiki/Food_taster) before serving them something new!
7
8
 
@@ -29,17 +30,12 @@ Add `gouteur` to the development dependencies of your gem.
29
30
 
30
31
  ### Recommended usage
31
32
 
32
- Create a `.gouteur.yml` in the root of your project:
33
+ Create a `.gouteur.yml` in the root of your project and add the gems you want to test against:
33
34
 
34
35
  ```yml
35
36
  repos:
36
37
  - uri: https://github.com/someone/some_gem
37
- ref: some_specific_branch # optional, default is the default branch
38
- before: setup_special_dependency # optional, bundle is always installed
39
- tasks: ['rspec', 'rake foo'] # optional, default is `rake`
40
- name: cool_gem # optional, defaults to repo name from uri, e.g. `some_gem`
41
- locked: true # optional, prevents setting an incompatible VERSION
42
- force: true # optional, forces test even if VERSION is incompatible
38
+ - uri: https://github.com/someone/another_gem
43
39
  ```
44
40
 
45
41
  Then simply `bundle exec gouteur` or add the rake task to your Rakefile:
@@ -52,13 +48,31 @@ Gouteur::RakeTask.new
52
48
  task default: %i[rspec gouteur]
53
49
  ```
54
50
 
55
- Pro tip: for large repos, running only relevant specs can speed up things a lot, e.g.:
51
+ Pro tip: gouteur executes the default rake task of each gem by default, but for large repos, running only relevant specs can speed up things a lot, e.g.:
56
52
 
57
53
  ```yml
58
- tasks: 'rspec spec/known_relevant_spec.rb'
54
+ repos:
55
+ - uri: some_gem_uri
56
+ tasks: 'rspec spec/known_relevant_spec.rb'
57
+ - uri: some_other_uri
58
+ tasks: 'rspec --pattern "**/{,*}{keyword1,keyword2}{,*,*/**/*}_spec.rb"'`
59
59
  ```
60
+
61
+ ### Other configuration options
62
+
63
+ There are many other configuration options. All except the `uri` are optional.
64
+
60
65
  ```yml
61
- tasks: 'rspec --pattern "**/{,*}{keyword1,keyword2}{,*,*/**/*}_spec.rb"'`
66
+ repos:
67
+ - uri: https://github.com/someone/some_gem
68
+ ref: some_specific_branch # default is the default branch
69
+ subdir: the_actual_gem # if gem is in a subdir of the repo
70
+ before: set_up_special_dependency # bundle is always installed
71
+ tasks: ['rspec', 'rake foo'] # default is `rake`
72
+ name: cool_gem # defaults to repo name from uri, e.g. `some_gem`
73
+ locked: true # prevents setting an incompatible VERSION
74
+ force: true # forces test even if VERSION is incompatible
75
+ quick: true # test only against changes, not the original code
62
76
  ```
63
77
 
64
78
  ### Manual usage
@@ -88,6 +102,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/jaynet
88
102
 
89
103
  Possible future improvements:
90
104
 
105
+ - verbose mode
91
106
  - consider caching of dependent repositories in CI, e.g. in GitHub workflows
92
107
  - support more sources of code, e.g. latest release, private GitHub repositories
93
108
  - improve performance by tracing & rerunning only specs/tests that use the gem
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rubocop/rake_task'
7
7
 
8
8
  RuboCop::RakeTask.new
9
9
 
10
- task default: %i[spec rubocop]
10
+ task default: %i[rubocop spec]
11
11
 
12
12
  require_relative 'lib/gouteur/rake_task'
13
13
  Gouteur::RakeTask.new
@@ -16,7 +16,7 @@ module Gouteur
16
16
  end
17
17
 
18
18
  def exec(task, env: {})
19
- name = task.sub(/bundle exec +/, '')
19
+ name = task.sub(/bundle +exec +/, '')
20
20
  Shell.run(%W[bundle exec #{name}], pwd: path, env: env)
21
21
  end
22
22
 
@@ -3,16 +3,17 @@ require 'yaml'
3
3
  module Gouteur
4
4
  # main process class
5
5
  class Checker
6
- attr_reader :repo, :force
6
+ attr_reader :repo, :force, :quick
7
7
 
8
- def self.call(repo, silent: false, force: repo&.force?)
9
- new(repo, silent: silent, force: force).call
8
+ def self.call(repo, silent: false, force: Null, quick: Null)
9
+ new(repo, silent: silent, force: force, quick: quick).call
10
10
  end
11
11
 
12
- def initialize(repo, silent: false, force: repo&.force?)
12
+ def initialize(repo, silent: false, force: Null, quick: Null)
13
13
  @repo = repo
14
14
  @silent = silent
15
- @force = force
15
+ @force = force.equal?(Null) ? repo&.force? : force
16
+ @quick = quick.equal?(Null) ? repo&.quick? : quick
16
17
  end
17
18
 
18
19
  def call
@@ -20,13 +21,9 @@ module Gouteur
20
21
  prepare
21
22
  check_dependence
22
23
 
23
- run_tasks(adapted: false)
24
+ pre_check_with_old_dependency_code
24
25
 
25
- repo.gemfile.create_adapted(drop_version_constraint: force)
26
- repo.remove_host_from_gemspecs if force
27
- install_adapted_bundle or return handle_incompatible_semver
28
-
29
- run_tasks(adapted: true)
26
+ inject_and_check_with_new_dependency_code
30
27
 
31
28
  [true, Message.success(repo: repo)]
32
29
  rescue Gouteur::Error => e
@@ -45,6 +42,18 @@ module Gouteur
45
42
  raise(Error, Message.no_dependence(repo: repo))
46
43
  end
47
44
 
45
+ def pre_check_with_old_dependency_code
46
+ run_tasks(adapted: false) unless quick
47
+ end
48
+
49
+ def inject_and_check_with_new_dependency_code
50
+ repo.gemfile.create_adapted(drop_version_constraint: force)
51
+ repo.remove_host_from_gemspecs if force
52
+ install_adapted_bundle or return handle_incompatible_semver
53
+
54
+ run_tasks(adapted: true)
55
+ end
56
+
48
57
  def run_tasks(adapted: false)
49
58
  repo.tasks.empty? && raise(Error, Message.no_tasks(repo: repo))
50
59
  repo.tasks.each { |task| run_task(task, adapted: adapted) }
data/lib/gouteur/cli.rb CHANGED
@@ -15,14 +15,15 @@ module Gouteur
15
15
  end
16
16
 
17
17
  repos.all? do |repo|
18
- success, message = Gouteur::Checker.call(repo, force: !!@force)
18
+ success, message = Checker.call(repo, force: @force, quick: @quick)
19
19
  puts '', message, ''
20
20
  success
21
21
  end
22
22
  end
23
23
 
24
24
  def option_parser
25
- @force = false
25
+ @force = Null
26
+ @quick = Null
26
27
 
27
28
  OptionParser.new do |opts|
28
29
  opts.banner = <<~SH
@@ -40,6 +41,10 @@ module Gouteur
40
41
  @force = true
41
42
  end
42
43
 
44
+ opts.on("-q", "--quick", "Test only changes, skip pre-test with original code") do
45
+ @quick = true
46
+ end
47
+
43
48
  opts.on("-v", "--version", "Show gouteur version") do
44
49
  puts "gouteur #{Gouteur::VERSION}"
45
50
  exit
@@ -60,7 +65,7 @@ module Gouteur
60
65
  if dotfile_repo = dotfile_repos.find { |r| r.name == arg }
61
66
  dotfile_repo
62
67
  else
63
- Gouteur::Repo.new(uri: arg)
68
+ Repo.new(uri: arg)
64
69
  end
65
70
  end
66
71
  end
@@ -14,7 +14,7 @@ module Gouteur
14
14
 
15
15
  def success(repo:)
16
16
  <<~MSG
17
- 👨‍🍳 #{random_word_for_tasty.capitalize}!
17
+ 👨‍🍳👍 #{random_word_for_tasty.capitalize}!
18
18
 
19
19
  Your changes to `#{Host.name}` are fine for `#{repo}`. All tasks succeeded.
20
20
  MSG
@@ -58,7 +58,7 @@ module Gouteur
58
58
 
59
59
  def broken_after_update(repo:, task:, output:, error:)
60
60
  <<~MSG
61
- 👨‍🍳 #{random_word_for_disgusting.capitalize}!
61
+ 👨‍🍳👎 #{random_word_for_disgusting.capitalize}!
62
62
 
63
63
  Task `#{task}` failed for `#{repo}` after inserting the new code of `#{Host.name}`.
64
64
 
@@ -0,0 +1,3 @@
1
+ module Gouteur
2
+ Null = Object.new # to indicate a not-given / undefined argument
3
+ end
data/lib/gouteur/repo.rb CHANGED
@@ -3,7 +3,7 @@ require 'uri'
3
3
  module Gouteur
4
4
  # a repository of code that depends on the library under test
5
5
  class Repo
6
- attr_reader :uri, :name, :ref, :tasks
6
+ attr_reader :uri, :name, :ref, :tasks, :subdir
7
7
  alias to_s name
8
8
 
9
9
  def initialize(
@@ -13,7 +13,9 @@ module Gouteur
13
13
  before: [],
14
14
  tasks: 'rake',
15
15
  locked: false,
16
- force: false
16
+ force: false,
17
+ subdir: nil,
18
+ quick: false
17
19
  )
18
20
  @uri = uri
19
21
  @name = name || extract_name_from_uri(uri)
@@ -22,10 +24,13 @@ module Gouteur
22
24
  @tasks = Array(tasks)
23
25
  @locked = !!locked
24
26
  @force = !!force
27
+ @subdir = subdir
28
+ @quick = !!quick
25
29
  end
26
30
 
27
31
  def fetch
28
32
  cloned? ? pull : clone
33
+ validate_subdir if subdir
29
34
  end
30
35
 
31
36
  def prepare
@@ -40,8 +45,12 @@ module Gouteur
40
45
  File.join(store_dir, name)
41
46
  end
42
47
 
48
+ def bundle_path
49
+ subdir ? File.join(clone_path, subdir) : clone_path
50
+ end
51
+
43
52
  def bundle
44
- @bundle ||= Gouteur::Bundle.new(clone_path)
53
+ @bundle ||= Gouteur::Bundle.new(bundle_path)
45
54
  end
46
55
 
47
56
  def gemfile
@@ -56,8 +65,12 @@ module Gouteur
56
65
  @force
57
66
  end
58
67
 
68
+ def quick?
69
+ @quick
70
+ end
71
+
59
72
  def remove_host_from_gemspecs
60
- Dir[File.join(clone_path, '*.gemspec')].each do |gemspec_path|
73
+ Dir[File.join(bundle_path, '*.gemspec')].each do |gemspec_path|
61
74
  content = File.read(gemspec_path)
62
75
  new_content = content.gsub(/^.+_dependency.+\b#{Host.name}\b.+$/, '')
63
76
  File.write(gemspec_path, new_content)
@@ -66,6 +79,11 @@ module Gouteur
66
79
 
67
80
  private
68
81
 
82
+ def validate_subdir
83
+ File.directory?(bundle_path) ||
84
+ raise(Error, "subdirectory `#{subdir}` not found in `#{name}`")
85
+ end
86
+
69
87
  def extract_name_from_uri(uri)
70
88
  uri[%r{git(?:hub|lab)\.com/[^/]+/([^/]+)}, 1] ||
71
89
  uri.split('/').last.to_s[/[a-z0-9\-_]+/i] ||
@@ -1,3 +1,3 @@
1
1
  module Gouteur
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.3.0'.freeze
3
3
  end
data/lib/gouteur.rb CHANGED
@@ -7,6 +7,7 @@ require 'gouteur/dotfile'
7
7
  require 'gouteur/gemfile'
8
8
  require 'gouteur/host'
9
9
  require 'gouteur/message'
10
+ require 'gouteur/null'
10
11
  require 'gouteur/repo'
11
12
  require 'gouteur/shell'
12
13
  require 'gouteur/version'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gouteur
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janosch Müller
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Run tests of dependent gems against your changes.
14
13
  email:
@@ -19,14 +18,12 @@ extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
20
  - ".github/workflows/build.yml"
22
- - ".github/workflows/lint.yml"
23
21
  - ".gitignore"
24
22
  - ".gouteur.yml"
25
23
  - ".rspec"
26
24
  - ".rubocop.yml"
27
25
  - CHANGELOG.md
28
26
  - Gemfile
29
- - Gemfile.lock
30
27
  - LICENSE.txt
31
28
  - README.md
32
29
  - Rakefile
@@ -42,6 +39,7 @@ files:
42
39
  - lib/gouteur/gemfile.rb
43
40
  - lib/gouteur/host.rb
44
41
  - lib/gouteur/message.rb
42
+ - lib/gouteur/null.rb
45
43
  - lib/gouteur/rake_task.rb
46
44
  - lib/gouteur/repo.rb
47
45
  - lib/gouteur/shell.rb
@@ -53,7 +51,6 @@ metadata:
53
51
  homepage_uri: https://github.com/jaynetics/gouteur
54
52
  source_code_uri: https://github.com/jaynetics/gouteur
55
53
  changelog_uri: https://github.com/jaynetics/gouteur/blob/master/CHANGELOG.md
56
- post_install_message:
57
54
  rdoc_options: []
58
55
  require_paths:
59
56
  - lib
@@ -68,8 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
65
  - !ruby/object:Gem::Version
69
66
  version: '0'
70
67
  requirements: []
71
- rubygems_version: 3.4.1
72
- signing_key:
68
+ rubygems_version: 4.0.23
73
69
  specification_version: 4
74
70
  summary: See if your lib is still digestible.
75
71
  test_files: []
@@ -1,29 +0,0 @@
1
- # based on https://github.com/rails/rails/blob/4a78dcb/.github/workflows/rubocop.yml
2
-
3
- name: rubocop linting
4
-
5
- on: [push, pull_request]
6
-
7
- jobs:
8
- build:
9
- runs-on: ubuntu-latest
10
-
11
- steps:
12
- - uses: actions/checkout@v2
13
- - name: Set up Ruby
14
- uses: ruby/setup-ruby@v1
15
- with:
16
- ruby-version: 3.0
17
- - name: Cache gems
18
- uses: actions/cache@v1
19
- with:
20
- path: vendor/bundle
21
- key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
22
- restore-keys: |
23
- ${{ runner.os }}-rubocop-
24
- - name: Install gems
25
- run: |
26
- bundle config path vendor/bundle
27
- bundle install --jobs 4 --retry 3
28
- - name: Run rubocop
29
- run: bundle exec rubocop
data/Gemfile.lock DELETED
@@ -1,74 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- gouteur (1.1.0)
5
-
6
- PATH
7
- remote: spec/gouteur/example_repo
8
- specs:
9
- example_repo (0.1.0)
10
-
11
- GEM
12
- remote: https://rubygems.org/
13
- specs:
14
- ast (2.4.2)
15
- debug (1.7.1)
16
- irb (>= 1.5.0)
17
- reline (>= 0.3.1)
18
- diff-lcs (1.5.0)
19
- io-console (0.6.0)
20
- irb (1.6.2)
21
- reline (>= 0.3.0)
22
- json (2.6.3)
23
- parallel (1.22.1)
24
- parser (3.2.1.0)
25
- ast (~> 2.4.1)
26
- rainbow (3.1.1)
27
- rake (13.0.6)
28
- regexp_parser (2.7.0)
29
- relaxed-rubocop (2.5)
30
- reline (0.3.2)
31
- io-console (~> 0.5)
32
- rexml (3.2.5)
33
- rspec (3.12.0)
34
- rspec-core (~> 3.12.0)
35
- rspec-expectations (~> 3.12.0)
36
- rspec-mocks (~> 3.12.0)
37
- rspec-core (3.12.1)
38
- rspec-support (~> 3.12.0)
39
- rspec-expectations (3.12.2)
40
- diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.12.0)
42
- rspec-mocks (3.12.3)
43
- diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.12.0)
45
- rspec-support (3.12.0)
46
- rubocop (1.45.1)
47
- json (~> 2.3)
48
- parallel (~> 1.10)
49
- parser (>= 3.2.0.0)
50
- rainbow (>= 2.2.2, < 4.0)
51
- regexp_parser (>= 1.8, < 3.0)
52
- rexml (>= 3.2.5, < 4.0)
53
- rubocop-ast (>= 1.24.1, < 2.0)
54
- ruby-progressbar (~> 1.7)
55
- unicode-display_width (>= 2.4.0, < 3.0)
56
- rubocop-ast (1.26.0)
57
- parser (>= 3.2.1.0)
58
- ruby-progressbar (1.11.0)
59
- unicode-display_width (2.4.2)
60
-
61
- PLATFORMS
62
- ruby
63
-
64
- DEPENDENCIES
65
- debug
66
- example_repo (= 0.1.0)!
67
- gouteur!
68
- rake (~> 13.0)
69
- relaxed-rubocop
70
- rspec (~> 3.0)
71
- rubocop (~> 1.7)
72
-
73
- BUNDLED WITH
74
- 2.2.8