appraisal2 3.0.6 → 3.0.8
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +106 -4
- data/CITATION.cff +20 -0
- data/CODE_OF_CONDUCT.md +3 -4
- data/CONTRIBUTING.md +153 -48
- data/FUNDING.md +74 -0
- data/LICENSE.md +49 -0
- data/README.md +233 -737
- data/RUBOCOP.md +71 -0
- data/SECURITY.md +2 -2
- data/certs/pboling.pem +27 -0
- data/lib/appraisal/appraisal.rb +1 -1
- data/lib/appraisal/bundler_dsl.rb +12 -12
- data/lib/appraisal/command.rb +32 -30
- data/lib/appraisal/customize.rb +1 -1
- data/lib/appraisal/gem_manager/factory.rb +1 -1
- data/lib/appraisal/gemspec.rb +1 -1
- data/lib/appraisal/version.rb +1 -1
- data/lib/appraisal2/version.rb +8 -0
- data/lib/appraisal2.rb +7 -0
- data/sig/appraisal2/version.rbs +6 -0
- data.tar.gz.sig +0 -0
- metadata +111 -78
- metadata.gz.sig +0 -0
- data/LICENSE.txt +0 -22
data/RUBOCOP.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# RuboCop Usage Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A tale of two RuboCop plugin gems.
|
|
6
|
+
|
|
7
|
+
### RuboCop Gradual
|
|
8
|
+
|
|
9
|
+
This project uses `rubocop_gradual` instead of vanilla RuboCop for code style checking. The `rubocop_gradual` tool allows for gradual adoption of RuboCop rules by tracking violations in a lock file.
|
|
10
|
+
|
|
11
|
+
### RuboCop LTS
|
|
12
|
+
|
|
13
|
+
This project uses `rubocop-lts` to ensure, on a best-effort basis, compatibility with Ruby >= 1.9.2.
|
|
14
|
+
RuboCop rules are meticulously configured by the `rubocop-lts` family of gems to ensure that a project is compatible with a specific version of Ruby. See: https://rubocop-lts.gitlab.io for more.
|
|
15
|
+
|
|
16
|
+
## Checking RuboCop Violations
|
|
17
|
+
|
|
18
|
+
To check for RuboCop violations in this project, always use:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
bundle exec rake rubocop_gradual:check
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Do not use** the standard RuboCop commands like:
|
|
25
|
+
- `bundle exec rubocop`
|
|
26
|
+
- `rubocop`
|
|
27
|
+
|
|
28
|
+
## Understanding the Lock File
|
|
29
|
+
|
|
30
|
+
The `.rubocop_gradual.lock` file tracks all current RuboCop violations in the project. This allows the team to:
|
|
31
|
+
|
|
32
|
+
1. Prevent new violations while gradually fixing existing ones
|
|
33
|
+
2. Track progress on code style improvements
|
|
34
|
+
3. Ensure CI builds don't fail due to pre-existing violations
|
|
35
|
+
|
|
36
|
+
## Common Commands
|
|
37
|
+
|
|
38
|
+
- **Check violations**
|
|
39
|
+
- `bundle exec rake rubocop_gradual`
|
|
40
|
+
- `bundle exec rake rubocop_gradual:check`
|
|
41
|
+
- **(Safe) Autocorrect violations, and update lockfile if no new violations**
|
|
42
|
+
- `bundle exec rake rubocop_gradual:autocorrect`
|
|
43
|
+
- **Force update the lock file (w/o autocorrect) to match violations present in code**
|
|
44
|
+
- `bundle exec rake rubocop_gradual:force_update`
|
|
45
|
+
|
|
46
|
+
## Workflow
|
|
47
|
+
|
|
48
|
+
1. Before submitting a PR, run `bundle exec rake rubocop_gradual:autocorrect`
|
|
49
|
+
a. or just the default `bundle exec rake`, as autocorrection is a pre-requisite of the default task.
|
|
50
|
+
2. If there are new violations, either:
|
|
51
|
+
- Fix them in your code
|
|
52
|
+
- Run `bundle exec rake rubocop_gradual:force_update` to update the lock file (only for violations you can't fix immediately)
|
|
53
|
+
3. Commit the updated `.rubocop_gradual.lock` file along with your changes
|
|
54
|
+
|
|
55
|
+
## Never add inline RuboCop disables
|
|
56
|
+
|
|
57
|
+
Do not add inline `rubocop:disable` / `rubocop:enable` comments anywhere in the codebase (including specs, except when following the few existing `rubocop:disable` patterns for a rule already being disabled elsewhere in the code). We handle exceptions in two supported ways:
|
|
58
|
+
|
|
59
|
+
- Permanent/structural exceptions: prefer adjusting the RuboCop configuration (e.g., in `.rubocop.yml`) to exclude a rule for a path or file pattern when it makes sense project-wide.
|
|
60
|
+
- Temporary exceptions while improving code: record the current violations in `.rubocop_gradual.lock` via the gradual workflow:
|
|
61
|
+
- `bundle exec rake rubocop_gradual:autocorrect` (preferred; will autocorrect what it can and update the lock only if no new violations were introduced)
|
|
62
|
+
- If needed, `bundle exec rake rubocop_gradual:force_update` (as a last resort when you cannot fix the newly reported violations immediately)
|
|
63
|
+
|
|
64
|
+
In general, treat the rules as guidance to follow; fix violations rather than ignore them. For example, RSpec conventions in this project expect `described_class` to be used in specs that target a specific class under test.
|
|
65
|
+
|
|
66
|
+
## Benefits of rubocop_gradual
|
|
67
|
+
|
|
68
|
+
- Allows incremental adoption of code style rules
|
|
69
|
+
- Prevents CI failures due to pre-existing violations
|
|
70
|
+
- Provides a clear record of code style debt
|
|
71
|
+
- Enables focused efforts on improving code quality over time
|
data/SECURITY.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Supported |
|
|
6
6
|
|----------|-----------|
|
|
7
|
-
|
|
|
7
|
+
| 3.0.latest | ✅ |
|
|
8
8
|
|
|
9
9
|
## Security contact information
|
|
10
10
|
|
|
@@ -18,4 +18,4 @@ If you are interested in support for versions older than the latest release,
|
|
|
18
18
|
please consider sponsoring the project / maintainer @ https://liberapay.com/pboling/donate,
|
|
19
19
|
or find other sponsorship links in the [README].
|
|
20
20
|
|
|
21
|
-
[README]: README.md
|
|
21
|
+
[README]: README.md
|
data/certs/pboling.pem
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
|
2
|
+
MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
|
|
3
|
+
ci5ib2xpbm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GVyLmJvbGluZ0BnbWFpbC5jb20wDQYJKoZIhvcNAQELBQAD
|
|
18
|
+
ggGBAJbnUwfJQFPkBgH9cL7hoBfRtmWiCvdqdjeTmi04u8zVNCUox0A4gT982DE9
|
|
19
|
+
wmuN12LpdajxZONqbXuzZvc+nb0StFwmFYZG6iDwaf4BPywm2e/Vmq0YG45vZXGR
|
|
20
|
+
L8yMDSK1cQXjmA+ZBKOHKWavxP6Vp7lWvjAhz8RFwqF9GuNIdhv9NpnCAWcMZtpm
|
|
21
|
+
GUPyIWw/Cw/2wZp74QzZj6Npx+LdXoLTF1HMSJXZ7/pkxLCsB8m4EFVdb/IrW/0k
|
|
22
|
+
kNSfjtAfBHO8nLGuqQZVH9IBD1i9K6aSs7pT6TW8itXUIlkIUI2tg5YzW6OFfPzq
|
|
23
|
+
QekSkX3lZfY+HTSp/o+YvKkqWLUV7PQ7xh1ZYDtocpaHwgxe/j3bBqHE+CUPH2vA
|
|
24
|
+
0V/FwdTRWcwsjVoOJTrYcff8pBZ8r2MvtAc54xfnnhGFzeRHfcltobgFxkAXdE6p
|
|
25
|
+
DVjBtqT23eugOqQ73umLcYDZkc36vnqGxUBSsXrzY9pzV5gGr2I8YUxMqf6ATrZt
|
|
26
|
+
L9nRqA==
|
|
27
|
+
-----END CERTIFICATE-----
|
data/lib/appraisal/appraisal.rb
CHANGED
|
@@ -7,18 +7,18 @@ module Appraisal
|
|
|
7
7
|
class BundlerDSL
|
|
8
8
|
attr_reader :dependencies
|
|
9
9
|
|
|
10
|
-
PARTS =
|
|
11
|
-
source
|
|
12
|
-
ruby_version
|
|
13
|
-
gits
|
|
14
|
-
paths
|
|
15
|
-
dependencies
|
|
16
|
-
groups
|
|
17
|
-
platforms
|
|
18
|
-
source_blocks
|
|
19
|
-
install_if
|
|
20
|
-
gemspec
|
|
21
|
-
eval_gemfile
|
|
10
|
+
PARTS = [
|
|
11
|
+
"source",
|
|
12
|
+
"ruby_version",
|
|
13
|
+
"gits",
|
|
14
|
+
"paths",
|
|
15
|
+
"dependencies",
|
|
16
|
+
"groups",
|
|
17
|
+
"platforms",
|
|
18
|
+
"source_blocks",
|
|
19
|
+
"install_if",
|
|
20
|
+
"gemspec",
|
|
21
|
+
"eval_gemfile"
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
def initialize
|
data/lib/appraisal/command.rb
CHANGED
|
@@ -17,21 +17,20 @@ module Appraisal
|
|
|
17
17
|
# - Bundler automatically infers lockfile from BUNDLE_GEMFILE (e.g., foo.gemfile -> foo.gemfile.lock)
|
|
18
18
|
# - Forcing BUNDLE_LOCKFILE breaks appraisal's ability to create per-gemfile lockfiles
|
|
19
19
|
# - Each appraisal needs its own lockfile, not the root Gemfile.lock
|
|
20
|
-
PRESERVED_BUNDLE_VARS =
|
|
21
|
-
BUNDLE_GEMFILE
|
|
22
|
-
BUNDLE_APP_CONFIG
|
|
23
|
-
BUNDLE_PATH
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
BUNDLE_DISABLE_SHARED_GEMS
|
|
20
|
+
PRESERVED_BUNDLE_VARS = [
|
|
21
|
+
"BUNDLE_GEMFILE",
|
|
22
|
+
"BUNDLE_APP_CONFIG",
|
|
23
|
+
"BUNDLE_PATH",
|
|
24
|
+
"BUNDLE_USER_CONFIG",
|
|
25
|
+
"BUNDLE_USER_CACHE",
|
|
26
|
+
"BUNDLE_USER_PLUGIN",
|
|
27
|
+
"BUNDLE_IGNORE_FUNDING_REQUESTS",
|
|
28
|
+
"BUNDLE_DISABLE_SHARED_GEMS"
|
|
30
29
|
].freeze
|
|
31
30
|
|
|
32
|
-
PRESERVED_RUNTIME_VARS =
|
|
33
|
-
PATH
|
|
34
|
-
GEM_PATH
|
|
31
|
+
PRESERVED_RUNTIME_VARS = [
|
|
32
|
+
"PATH",
|
|
33
|
+
"GEM_PATH"
|
|
35
34
|
].freeze
|
|
36
35
|
|
|
37
36
|
def initialize(command, options = {})
|
|
@@ -47,14 +46,15 @@ module Appraisal
|
|
|
47
46
|
if @skip_bundle_exec
|
|
48
47
|
execute(run_env)
|
|
49
48
|
else
|
|
50
|
-
# For bundler version switching to work
|
|
51
|
-
#
|
|
49
|
+
# For bundler version switching to work reliably, we need to preserve
|
|
50
|
+
# the appraisal Gemfile while avoiding the active parent Bundler process.
|
|
52
51
|
# However, we still need to isolate from the parent's bundler state
|
|
53
52
|
# to avoid conflicts.
|
|
54
53
|
#
|
|
55
54
|
# Solution: Use a selective environment approach instead of with_original_env,
|
|
56
55
|
# which strips all BUNDLE_* variables and breaks version switching.
|
|
57
56
|
with_bundler_env do
|
|
57
|
+
apply_run_env(run_env)
|
|
58
58
|
ensure_bundler_is_available
|
|
59
59
|
ensure_locked_bundler_is_available
|
|
60
60
|
execute(run_env)
|
|
@@ -64,8 +64,8 @@ module Appraisal
|
|
|
64
64
|
|
|
65
65
|
private
|
|
66
66
|
|
|
67
|
-
# Provide a clean environment while preserving
|
|
68
|
-
# and test isolation settings.
|
|
67
|
+
# Provide a clean environment while preserving Bundler's version switching
|
|
68
|
+
# inputs and test isolation settings.
|
|
69
69
|
#
|
|
70
70
|
# The current Ruby process has bundler activated, which adds bundler/setup to RUBYOPT.
|
|
71
71
|
# When we run a subprocess, we need to remove that activation so the subprocess bundler
|
|
@@ -96,7 +96,10 @@ module Appraisal
|
|
|
96
96
|
clean_env["RUBYOPT"] = rubyopt.join(" ") unless rubyopt.empty?
|
|
97
97
|
end
|
|
98
98
|
|
|
99
|
-
# Remove
|
|
99
|
+
# Remove Bundler activation markers from the subprocess environment.
|
|
100
|
+
# BUNDLE_BIN_PATH pins the already-active Bundler executable, so keeping
|
|
101
|
+
# it would bypass the BUNDLED WITH version selected below.
|
|
102
|
+
clean_env.delete("BUNDLE_BIN_PATH")
|
|
100
103
|
clean_env.delete("BUNDLER_SETUP")
|
|
101
104
|
clean_env.delete("BUNDLER_VERSION")
|
|
102
105
|
|
|
@@ -112,6 +115,9 @@ module Appraisal
|
|
|
112
115
|
announce
|
|
113
116
|
|
|
114
117
|
ENV["BUNDLE_GEMFILE"] = gemfile
|
|
118
|
+
if (bundler_version = locked_bundler_version)
|
|
119
|
+
ENV["BUNDLER_VERSION"] = bundler_version
|
|
120
|
+
end
|
|
115
121
|
ENV["APPRAISAL_INITIALIZED"] = "1"
|
|
116
122
|
run_env.each_pair do |key, value|
|
|
117
123
|
ENV[key] = value
|
|
@@ -120,6 +126,12 @@ module Appraisal
|
|
|
120
126
|
exit(1) unless Kernel.system(command_as_string)
|
|
121
127
|
end
|
|
122
128
|
|
|
129
|
+
def apply_run_env(run_env)
|
|
130
|
+
run_env.each_pair do |key, value|
|
|
131
|
+
ENV[key] = value
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
123
135
|
def ensure_bundler_is_available
|
|
124
136
|
# Check if any version of bundler is available
|
|
125
137
|
return if system(%(gem list --silent -i bundler))
|
|
@@ -139,10 +151,6 @@ manually.
|
|
|
139
151
|
end
|
|
140
152
|
|
|
141
153
|
def ensure_locked_bundler_is_available
|
|
142
|
-
# Bundler 2.2+ already switches to the lockfile version automatically.
|
|
143
|
-
# Only install the locked version as a fallback for older Bundler releases.
|
|
144
|
-
return if bundler_handles_lockfile_version?
|
|
145
|
-
|
|
146
154
|
locked_version = locked_bundler_version
|
|
147
155
|
return unless locked_version
|
|
148
156
|
|
|
@@ -161,12 +169,6 @@ manually.
|
|
|
161
169
|
exit(1)
|
|
162
170
|
end
|
|
163
171
|
|
|
164
|
-
def bundler_handles_lockfile_version?
|
|
165
|
-
return false unless defined?(Bundler::VERSION)
|
|
166
|
-
|
|
167
|
-
Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2.2.0")
|
|
168
|
-
end
|
|
169
|
-
|
|
170
172
|
def locked_bundler_version
|
|
171
173
|
return unless gemfile
|
|
172
174
|
|
|
@@ -198,7 +200,7 @@ manually.
|
|
|
198
200
|
if command_starts_with_bundle?(original_command)
|
|
199
201
|
original_command
|
|
200
202
|
elsif original_command.is_a?(Array)
|
|
201
|
-
|
|
203
|
+
["bundle", "exec"] + original_command
|
|
202
204
|
else
|
|
203
205
|
"bundle exec #{original_command}"
|
|
204
206
|
end
|
|
@@ -217,7 +219,7 @@ manually.
|
|
|
217
219
|
|
|
218
220
|
{
|
|
219
221
|
"GEM_HOME" => ENV["GEM_HOME"],
|
|
220
|
-
"GEM_PATH" => ""
|
|
222
|
+
"GEM_PATH" => ""
|
|
221
223
|
}
|
|
222
224
|
end
|
|
223
225
|
end
|
data/lib/appraisal/customize.rb
CHANGED
|
@@ -40,7 +40,7 @@ module Appraisal
|
|
|
40
40
|
:lockfile => "#{gemfile.send(:gemfile_name)}.lock",
|
|
41
41
|
:lockfile_path => gemfile.send(:lockfile_path),
|
|
42
42
|
:relative_gemfile_path => gemfile.relative_gemfile_path,
|
|
43
|
-
:relative_lockfile_path => "#{gemfile.relative_gemfile_path}.lock"
|
|
43
|
+
:relative_lockfile_path => "#{gemfile.relative_gemfile_path}.lock"
|
|
44
44
|
)
|
|
45
45
|
end
|
|
46
46
|
end
|
data/lib/appraisal/gemspec.rb
CHANGED
data/lib/appraisal/version.rb
CHANGED
data/lib/appraisal2.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|