gouteur 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/gouteur/checker.rb +20 -17
- data/lib/gouteur/message.rb +13 -5
- data/lib/gouteur/version.rb +1 -1
- 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: 174d0cdcc37fbca2d808a91be97a17feb70140ef403de6f95f91b0ce74e8beda
|
4
|
+
data.tar.gz: 6f886d8d85c43065b821371a916e44414580a5e5ead255d811916942d9387b70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7806e1a42dacd49fa222c7eb9c73f21373786540c7a8d2c06ae8bba06dfb71a5d98e8e81ff6bfcda063da86b91d377c7a2b01ab2a5ee4e6bf0fdeac638a472b6
|
7
|
+
data.tar.gz: 84c3649159b02083c7ac31d94e14657a04807cc05f99f41cea3ea35939106394e88337118ce2c72a384fa6ec0c41f83d3c92bf3ccd9ff980c6fcdde9b4e9b571
|
data/CHANGELOG.md
CHANGED
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
|
|
data/lib/gouteur/checker.rb
CHANGED
@@ -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
|
-
|
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
|
101
|
-
|
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 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,
|
data/lib/gouteur/message.rb
CHANGED
@@ -14,7 +14,7 @@ module Gouteur
|
|
14
14
|
|
15
15
|
def success(repo:)
|
16
16
|
<<~MSG
|
17
|
-
👨🍳
|
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
|
-
👨🍳
|
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
|
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/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.1
|
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-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Run tests of dependent gems against your changes.
|
14
14
|
email:
|