gouteur 1.0.0 → 1.0.2

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: 001d0213cebc3a146615388dff657d573cc671395e2e8d62995e11b3b3a84f6e
4
- data.tar.gz: 45ed7d535d16effa0c9ad2bd6044e973257d08a111e606beb6b65dd2e7483b83
3
+ metadata.gz: 9cced511802f382d5ebaf4035fd7b06e98f0eca07e72e29c08ddae2b8de01d2f
4
+ data.tar.gz: 2854883c107ac874febb0e1aeb1c939d5c621bffed23feb38f22a63e1aaa0d0d
5
5
  SHA512:
6
- metadata.gz: 2664a0c872fbd8da4b638841454904ae43015652c10e3d2fabbd52f7c5f15fb2f5541eb677954952228e48153ca4ef6f6d85cac5ca3b7ca5abbbac07c11a67a2
7
- data.tar.gz: 1befe751c803a11255163d29ef64b37ce143381c11b197c9826ee1f020e249bace18fb597a318840293c7b2d72fac78e3a42b86a99be059db7d8eb5628270a02
6
+ metadata.gz: 34a5301cfb9d2c421079334b0426763c70aeeffcd9e1f270385979403e0506d7753d7e1eba9db1a3741b636154861fb0833c3945a6c1fe60c0bf0ecf3d5410c6
7
+ data.tar.gz: 066d049552256df89bede60548f584e5806cfbe4f6d0a470f23ed40d5fb8c0c1554c7f9ef6cf75c6360e7c77d21adc2ac2d4c22e15df71c94d82cb9a8811ce95
@@ -8,7 +8,7 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby: [ '2.5', '3.0', 'ruby-head' ]
11
+ ruby: [ '2.6', '3.0', 'ruby-head' ]
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v2
data/.rubocop.yml CHANGED
@@ -6,11 +6,20 @@ AllCops:
6
6
  SuggestExtensions: false
7
7
  TargetRubyVersion: 2.5
8
8
 
9
+ Gemspec/RequireMFA:
10
+ Enabled: false
11
+
9
12
  Layout/LineLength:
10
13
  Max: 80
11
14
 
12
15
  Lint/AmbiguousBlockAssociation:
13
16
  Enabled: false
14
17
 
18
+ Lint/AmbiguousOperatorPrecedence:
19
+ Enabled: false
20
+
21
+ Style/FetchEnvVar:
22
+ Enabled: false
23
+
15
24
  Style/FrozenStringLiteralComment:
16
25
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.2] - 2022-09-24
4
+
5
+ ### Fixed
6
+
7
+ - Fixed error message when a repo's `before` task fails
8
+ - Fixed dependency version mismatch detection for recent bundler versions
9
+
10
+ ## [1.0.1] - 2021-03-09
11
+
12
+ ### Fixed
13
+
14
+ - Fixed error when a task failed with the old code
15
+
3
16
  ## [1.0.0] - 2021-02-08
4
17
 
5
18
  - Initial release
data/Gemfile CHANGED
@@ -13,4 +13,4 @@ gem 'relaxed-rubocop'
13
13
 
14
14
  gem 'example_repo', '0.1.0', path: './spec/gouteur/example_repo'
15
15
 
16
- gem 'byebug'
16
+ gem 'debug'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gouteur (1.0.0)
4
+ gouteur (1.0.2)
5
5
 
6
6
  PATH
7
7
  remote: spec/gouteur/example_repo
@@ -12,48 +12,57 @@ GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
14
  ast (2.4.2)
15
- byebug (11.1.3)
16
- diff-lcs (1.4.4)
17
- parallel (1.20.1)
18
- parser (3.0.0.0)
15
+ debug (1.6.2)
16
+ irb (>= 1.3.6)
17
+ reline (>= 0.3.1)
18
+ diff-lcs (1.5.0)
19
+ io-console (0.5.11)
20
+ irb (1.4.1)
21
+ reline (>= 0.3.0)
22
+ json (2.6.2)
23
+ parallel (1.22.1)
24
+ parser (3.1.2.1)
19
25
  ast (~> 2.4.1)
20
- rainbow (3.0.0)
21
- rake (13.0.3)
22
- regexp_parser (2.0.3)
26
+ rainbow (3.1.1)
27
+ rake (13.0.6)
28
+ regexp_parser (2.5.0)
23
29
  relaxed-rubocop (2.5)
24
- rexml (3.2.4)
25
- rspec (3.10.0)
26
- rspec-core (~> 3.10.0)
27
- rspec-expectations (~> 3.10.0)
28
- rspec-mocks (~> 3.10.0)
29
- rspec-core (3.10.1)
30
- rspec-support (~> 3.10.0)
31
- rspec-expectations (3.10.1)
30
+ reline (0.3.1)
31
+ io-console (~> 0.5)
32
+ rexml (3.2.5)
33
+ rspec (3.11.0)
34
+ rspec-core (~> 3.11.0)
35
+ rspec-expectations (~> 3.11.0)
36
+ rspec-mocks (~> 3.11.0)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.1)
32
40
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.10.0)
34
- rspec-mocks (3.10.2)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.1)
35
43
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.10.0)
37
- rspec-support (3.10.2)
38
- rubocop (1.9.1)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.1)
46
+ rubocop (1.36.0)
47
+ json (~> 2.3)
39
48
  parallel (~> 1.10)
40
- parser (>= 3.0.0.0)
49
+ parser (>= 3.1.2.1)
41
50
  rainbow (>= 2.2.2, < 4.0)
42
51
  regexp_parser (>= 1.8, < 3.0)
43
- rexml
44
- rubocop-ast (>= 1.2.0, < 2.0)
52
+ rexml (>= 3.2.5, < 4.0)
53
+ rubocop-ast (>= 1.20.1, < 2.0)
45
54
  ruby-progressbar (~> 1.7)
46
55
  unicode-display_width (>= 1.4.0, < 3.0)
47
- rubocop-ast (1.4.1)
48
- parser (>= 2.7.1.5)
56
+ rubocop-ast (1.21.0)
57
+ parser (>= 3.1.1.0)
49
58
  ruby-progressbar (1.11.0)
50
- unicode-display_width (2.0.0)
59
+ unicode-display_width (2.3.0)
51
60
 
52
61
  PLATFORMS
53
62
  ruby
54
63
 
55
64
  DEPENDENCIES
56
- byebug
65
+ debug
57
66
  example_repo (= 0.1.0)!
58
67
  gouteur!
59
68
  rake (~> 13.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ When you release a new version of your gem, these projects might break.
17
17
 
18
18
  [Semantic versioning](https://semver.org) obviously helps. People make mistakes, though. The boundary between public and private APIs can also be fuzzy, particularly in an open language like Ruby.
19
19
 
20
- Thus, when you update your gem, you might feel as if you should check whether things that depend on it will keep working.
20
+ Thus, when you update your gem, you might feel as if you should check whether things that depend on it will keep working before you release the new version.
21
21
 
22
22
  Gouteur automates this step.
23
23
 
@@ -22,9 +22,7 @@ module Gouteur
22
22
  run_tasks(adapted: false)
23
23
 
24
24
  create_adapted_gemfile
25
- install_adapted_bundle or return [
26
- true, Message.skipped_incompatible(repo: repo)
27
- ]
25
+ install_adapted_bundle or return handle_incompatible_semver
28
26
 
29
27
  run_tasks(adapted: true)
30
28
 
@@ -52,7 +50,8 @@ module Gouteur
52
50
 
53
51
  def run_task(task, adapted: false)
54
52
  puts("Running `#{task}` with #{adapted ? :new : :old} `#{Host.name}`...")
55
- result = repo.bundle.exec(task, env: adapted ? adaptation_env : {})
53
+ env = adapted ? adaptation_env : {}
54
+ result = repo.bundle.exec(task, env: env)
56
55
  result.success? or raise Error, Message.send(
57
56
  adapted ? :broken_after_update : :broken,
58
57
  repo: repo, task: task, output: result.stdout, error: result.stderr
@@ -89,28 +88,32 @@ module Gouteur
89
88
  "#{repo.bundle.gemfile_path}.gouteur"
90
89
  end
91
90
 
92
- BUNDLER_INCOMPATIBLE_VERSION_CODE = 6
93
- BUNDLER_GEM_NOT_FOUND_CODE = 7 # includes some incompatibility cases
94
-
95
91
  def install_adapted_bundle
96
92
  result = repo.bundle.install(env: adaptation_env)
97
-
98
93
  if result.success?
99
94
  true
100
- elsif result.exitstatus == BUNDLER_INCOMPATIBLE_VERSION_CODE ||
101
- result.exitstatus == BUNDLER_GEM_NOT_FOUND_CODE &&
102
- result.stderr =~ /following version/
103
- if repo.locked?
104
- raise Error,
105
- Message.incompatible_failure(repo: repo, error: result.stderr)
106
- else
107
- false
108
- end
95
+ elsif indicates_incompatible_semver?(result)
96
+ false
109
97
  else
110
98
  raise Error, result.full_error
111
99
  end
112
100
  end
113
101
 
102
+ BUNDLER_INCOMPATIBLE_VERSION_CODE = 6
103
+ BUNDLER_GEM_NOT_FOUND_CODE = 7 # includes some incompatibility cases
104
+
105
+ def indicates_incompatible_semver?(result)
106
+ result.exitstatus == BUNDLER_INCOMPATIBLE_VERSION_CODE ||
107
+ result.exitstatus == BUNDLER_GEM_NOT_FOUND_CODE &&
108
+ result.stderr =~ /following gems matching|following version/
109
+ end
110
+
111
+ def handle_incompatible_semver
112
+ raise Error, Message.incompatible_failure(repo: repo) if repo.locked?
113
+
114
+ [true, Message.skipped_incompatible(repo: repo)]
115
+ end
116
+
114
117
  def adaptation_env
115
118
  {
116
119
  'BUNDLE_GEMFILE' => adapted_gemfile_path,
@@ -14,7 +14,7 @@ module Gouteur
14
14
 
15
15
  def success(repo:)
16
16
  <<~MSG
17
- 👨‍🍳 Délicieux!
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
@@ -44,20 +44,21 @@ module Gouteur
44
44
  MSG
45
45
  end
46
46
 
47
- def broken(repo:, task:, error:)
47
+ def broken(repo:, task:, output:, error:)
48
48
  <<~MSG
49
49
  👨‍🍳 Zut alors!
50
50
 
51
51
  Task `#{task}` failed for `#{repo}` even before inserting the new code of `#{Host.name}`.
52
52
 
53
53
  This likely means the task is broken or does not exist.
54
+ #{original_output_part(output)}
54
55
  #{original_error_part(error)}
55
56
  MSG
56
57
  end
57
58
 
58
59
  def broken_after_update(repo:, task:, output:, error:)
59
60
  <<~MSG
60
- 👨‍🍳 Répugnant!
61
+ 👨‍🍳 #{random_word_for_disgusting.capitalize}!
61
62
 
62
63
  Task `#{task}` failed for `#{repo}` after inserting the new code of `#{Host.name}`.
63
64
 
@@ -77,14 +78,13 @@ module Gouteur
77
78
  MSG
78
79
  end
79
80
 
80
- def incompatible_failure(repo:, error:)
81
+ def incompatible_failure(repo:)
81
82
  <<~MSG
82
83
  👨‍🍳 Zut alors!
83
84
 
84
85
  The new version number of `#{Host.name}` is incompatible with the version requirements specified by `#{repo}`.
85
86
 
86
87
  Incompatible version numbers can be allowed by removing the `locked` flag. This will make gouteur SKIP the tasks in this case.
87
- #{original_error_part(error)}
88
88
  MSG
89
89
  end
90
90
 
@@ -101,5 +101,13 @@ module Gouteur
101
101
  def strip(string)
102
102
  string.to_s.gsub(/\A\s+|\s+\z/, '')
103
103
  end
104
+
105
+ def random_word_for_tasty
106
+ %w[délectable délicieux savoureux succulent].sample
107
+ end
108
+
109
+ def random_word_for_disgusting
110
+ %w[dégoûtant immangeable répugnant].sample
111
+ end
104
112
  end
105
113
  end
data/lib/gouteur/shell.rb CHANGED
@@ -29,7 +29,7 @@ module Gouteur
29
29
  attr_reader :stdout, :stderr, :exitstatus
30
30
 
31
31
  def initialize(args:, pwd:, stdout:, stderr:, status:)
32
- @args = args
32
+ @args = Array(args)
33
33
  @pwd = pwd
34
34
  @stdout = stdout
35
35
  @stderr = stderr
@@ -1,3 +1,3 @@
1
1
  module Gouteur
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gouteur
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janosch Müller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2022-09-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Run tests of dependent gems against your changes.
14
14
  email:
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.2.3
70
+ rubygems_version: 3.4.0.dev
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: See if your lib is still digestible.