rails-conflicted-credentials 0.1.2
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 +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +413 -0
- data/CHANGELOG.md +10 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +80 -0
- data/Rakefile +12 -0
- data/lib/rails/commands/conflicted_credentials/conflicted_credentials_command/conflicted_credentials.rb +168 -0
- data/lib/rails/commands/conflicted_credentials/conflicted_credentials_command.rb +37 -0
- data/lib/rails/conflicted/credentials/version.rb +9 -0
- data/lib/rails/conflicted/credentials.rb +11 -0
- data/sig/rails/conflicted/credentials.rbs +8 -0
- metadata +69 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 276f84be9c79524d035e6198602bfd1dd2690cd8240cfefa0e323c6f79eec37f
|
4
|
+
data.tar.gz: f76789a7b44815f04881fbc81306dea9194baf11ac879785e483468fbc9035fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad3bc8d7bf87652ea98202c00e64bf27e843c10a4a3e9c5ef7d1f44a4e6a9ffd21535ce4b7d5b5a39a0ea18aa17abf93de913bb3fd64acf76be2398bb53366c8
|
7
|
+
data.tar.gz: 135d224ebb19b65d9ebfac59b3ac3c87ab95945a71b90f5873ba210d5a87035dbc35fd84fff34ed981132f00878cee04317fe24eb24838930b7559132821e28d
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,413 @@
|
|
1
|
+
plugins:
|
2
|
+
- rubocop-minitest
|
3
|
+
- rubocop-packaging
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rails
|
6
|
+
- rubocop-md
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
10
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
11
|
+
DisabledByDefault: true
|
12
|
+
SuggestExtensions: false
|
13
|
+
Exclude:
|
14
|
+
- '**/tmp/**/*'
|
15
|
+
- '**/templates/**/*'
|
16
|
+
- '**/vendor/**/*'
|
17
|
+
- 'actionmailbox/test/dummy/**/*'
|
18
|
+
- 'activestorage/test/dummy/**/*'
|
19
|
+
- 'actiontext/test/dummy/**/*'
|
20
|
+
- 'tools/rail_inspector/test/fixtures/*'
|
21
|
+
- guides/source/debugging_rails_applications.md
|
22
|
+
- guides/source/active_support_instrumentation.md
|
23
|
+
- '**/node_modules/**/*'
|
24
|
+
- '**/CHANGELOG.md'
|
25
|
+
- '**/2_*_release_notes.md'
|
26
|
+
- '**/3_*_release_notes.md'
|
27
|
+
- '**/4_*_release_notes.md'
|
28
|
+
- '**/5_*_release_notes.md'
|
29
|
+
- '**/6_*_release_notes.md'
|
30
|
+
|
31
|
+
|
32
|
+
Performance:
|
33
|
+
Exclude:
|
34
|
+
- '**/test/**/*'
|
35
|
+
|
36
|
+
# Prefer assert_not over assert !
|
37
|
+
Rails/AssertNot:
|
38
|
+
Include:
|
39
|
+
- '**/test/**/*'
|
40
|
+
|
41
|
+
# Prefer assert_not_x over refute_x
|
42
|
+
Rails/RefuteMethods:
|
43
|
+
Include:
|
44
|
+
- '**/test/**/*'
|
45
|
+
|
46
|
+
Rails/IndexBy:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
Rails/IndexWith:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
# Prefer &&/|| over and/or.
|
53
|
+
Style/AndOr:
|
54
|
+
Enabled: true
|
55
|
+
|
56
|
+
Layout/ClosingHeredocIndentation:
|
57
|
+
Enabled: true
|
58
|
+
|
59
|
+
Layout/ClosingParenthesisIndentation:
|
60
|
+
Enabled: true
|
61
|
+
|
62
|
+
# Align comments with method definitions.
|
63
|
+
Layout/CommentIndentation:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Layout/DefEndAlignment:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Layout/ElseAlignment:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
# Align `end` with the matching keyword or starting expression except for
|
73
|
+
# assignments, where it should be aligned with the LHS.
|
74
|
+
Layout/EndAlignment:
|
75
|
+
Enabled: true
|
76
|
+
EnforcedStyleAlignWith: variable
|
77
|
+
AutoCorrect: true
|
78
|
+
|
79
|
+
Layout/EndOfLine:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
Layout/EmptyLineAfterMagicComment:
|
83
|
+
Enabled: true
|
84
|
+
|
85
|
+
Layout/EmptyLinesAroundAccessModifier:
|
86
|
+
Enabled: true
|
87
|
+
EnforcedStyle: only_before
|
88
|
+
|
89
|
+
Layout/EmptyLinesAroundBlockBody:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
# In a regular class definition, no empty lines around the body.
|
93
|
+
Layout/EmptyLinesAroundClassBody:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
# In a regular method definition, no empty lines around the body.
|
97
|
+
Layout/EmptyLinesAroundMethodBody:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
# In a regular module definition, no empty lines around the body.
|
101
|
+
Layout/EmptyLinesAroundModuleBody:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
105
|
+
Style/HashSyntax:
|
106
|
+
Enabled: true
|
107
|
+
EnforcedShorthandSyntax: either
|
108
|
+
|
109
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
110
|
+
# extra level of indentation.
|
111
|
+
Layout/IndentationConsistency:
|
112
|
+
Enabled: true
|
113
|
+
EnforcedStyle: indented_internal_methods
|
114
|
+
Exclude:
|
115
|
+
- '**/*.md'
|
116
|
+
|
117
|
+
# Two spaces, no tabs (for indentation).
|
118
|
+
Layout/IndentationWidth:
|
119
|
+
Enabled: true
|
120
|
+
|
121
|
+
Layout/LeadingCommentSpace:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
Layout/SpaceAfterColon:
|
125
|
+
Enabled: true
|
126
|
+
|
127
|
+
Layout/SpaceAfterComma:
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
Layout/SpaceAfterSemicolon:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
134
|
+
Enabled: true
|
135
|
+
|
136
|
+
Layout/SpaceAroundKeyword:
|
137
|
+
Enabled: true
|
138
|
+
|
139
|
+
Layout/SpaceAroundOperators:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
Layout/SpaceBeforeComma:
|
143
|
+
Enabled: true
|
144
|
+
|
145
|
+
Layout/SpaceBeforeComment:
|
146
|
+
Enabled: true
|
147
|
+
|
148
|
+
Layout/SpaceBeforeFirstArg:
|
149
|
+
Enabled: true
|
150
|
+
|
151
|
+
Style/DefWithParentheses:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
# Defining a method with parameters needs parentheses.
|
155
|
+
Style/MethodDefParentheses:
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
Style/ExplicitBlockArgument:
|
159
|
+
Enabled: true
|
160
|
+
|
161
|
+
Style/FrozenStringLiteralComment:
|
162
|
+
Enabled: true
|
163
|
+
EnforcedStyle: always
|
164
|
+
Exclude:
|
165
|
+
- 'actionview/test/**/*.builder'
|
166
|
+
- 'actionview/test/**/*.ruby'
|
167
|
+
- 'actionpack/test/**/*.builder'
|
168
|
+
- 'actionpack/test/**/*.ruby'
|
169
|
+
- 'activestorage/db/migrate/**/*.rb'
|
170
|
+
- 'activestorage/db/update_migrate/**/*.rb'
|
171
|
+
- 'actionmailbox/db/migrate/**/*.rb'
|
172
|
+
- 'actiontext/db/migrate/**/*.rb'
|
173
|
+
- '**/*.md'
|
174
|
+
|
175
|
+
Style/MapToHash:
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
Style/RedundantFreeze:
|
179
|
+
Enabled: true
|
180
|
+
|
181
|
+
# Use `foo {}` not `foo{}`.
|
182
|
+
Layout/SpaceBeforeBlockBraces:
|
183
|
+
Enabled: true
|
184
|
+
|
185
|
+
# Use `foo { bar }` not `foo {bar}`.
|
186
|
+
Layout/SpaceInsideBlockBraces:
|
187
|
+
Enabled: true
|
188
|
+
EnforcedStyleForEmptyBraces: space
|
189
|
+
|
190
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
191
|
+
Layout/SpaceInsideHashLiteralBraces:
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
Layout/SpaceInsideParens:
|
195
|
+
Enabled: true
|
196
|
+
|
197
|
+
# Check quotes usage according to lint rule below.
|
198
|
+
Style/StringLiterals:
|
199
|
+
Enabled: true
|
200
|
+
EnforcedStyle: double_quotes
|
201
|
+
|
202
|
+
Style/StringLiteralsInInterpolation:
|
203
|
+
EnforcedStyle: double_quotes
|
204
|
+
|
205
|
+
# Detect hard tabs, no hard tabs.
|
206
|
+
Layout/IndentationStyle:
|
207
|
+
Enabled: true
|
208
|
+
|
209
|
+
# Empty lines should not have any spaces.
|
210
|
+
Layout/TrailingEmptyLines:
|
211
|
+
Enabled: true
|
212
|
+
|
213
|
+
# No trailing whitespace.
|
214
|
+
Layout/TrailingWhitespace:
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
# Use quotes for string literals when they are enough.
|
218
|
+
Style/RedundantPercentQ:
|
219
|
+
Enabled: true
|
220
|
+
|
221
|
+
Lint/NestedMethodDefinition:
|
222
|
+
Enabled: true
|
223
|
+
|
224
|
+
Lint/AmbiguousOperator:
|
225
|
+
Enabled: true
|
226
|
+
|
227
|
+
Lint/AmbiguousRegexpLiteral:
|
228
|
+
Enabled: true
|
229
|
+
|
230
|
+
Lint/Debugger:
|
231
|
+
Enabled: true
|
232
|
+
DebuggerRequires:
|
233
|
+
- debug
|
234
|
+
|
235
|
+
Lint/DuplicateRequire:
|
236
|
+
Enabled: true
|
237
|
+
|
238
|
+
Lint/DuplicateMagicComment:
|
239
|
+
Enabled: true
|
240
|
+
|
241
|
+
Lint/DuplicateMethods:
|
242
|
+
Enabled: true
|
243
|
+
|
244
|
+
Lint/ErbNewArguments:
|
245
|
+
Enabled: true
|
246
|
+
|
247
|
+
Lint/EnsureReturn:
|
248
|
+
Enabled: true
|
249
|
+
|
250
|
+
Lint/MissingCopEnableDirective:
|
251
|
+
Enabled: true
|
252
|
+
|
253
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
254
|
+
Lint/RequireParentheses:
|
255
|
+
Enabled: true
|
256
|
+
|
257
|
+
Lint/RedundantCopDisableDirective:
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Lint/RedundantCopEnableDirective:
|
261
|
+
Enabled: true
|
262
|
+
|
263
|
+
Lint/RedundantRequireStatement:
|
264
|
+
Enabled: true
|
265
|
+
|
266
|
+
Lint/RedundantStringCoercion:
|
267
|
+
Enabled: true
|
268
|
+
|
269
|
+
Lint/RedundantSafeNavigation:
|
270
|
+
Enabled: true
|
271
|
+
|
272
|
+
Lint/UriEscapeUnescape:
|
273
|
+
Enabled: true
|
274
|
+
|
275
|
+
Lint/UselessAssignment:
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
Lint/DeprecatedClassMethods:
|
279
|
+
Enabled: true
|
280
|
+
|
281
|
+
Lint/InterpolationCheck:
|
282
|
+
Enabled: true
|
283
|
+
Exclude:
|
284
|
+
- '**/test/**/*'
|
285
|
+
|
286
|
+
Lint/SafeNavigationChain:
|
287
|
+
Enabled: true
|
288
|
+
|
289
|
+
Style/EvalWithLocation:
|
290
|
+
Enabled: true
|
291
|
+
Exclude:
|
292
|
+
- '**/test/**/*'
|
293
|
+
|
294
|
+
Style/ParenthesesAroundCondition:
|
295
|
+
Enabled: true
|
296
|
+
|
297
|
+
Style/HashTransformKeys:
|
298
|
+
Enabled: true
|
299
|
+
|
300
|
+
Style/HashTransformValues:
|
301
|
+
Enabled: true
|
302
|
+
|
303
|
+
Style/RedundantBegin:
|
304
|
+
Enabled: true
|
305
|
+
|
306
|
+
Style/RedundantReturn:
|
307
|
+
Enabled: true
|
308
|
+
AllowMultipleReturnValues: true
|
309
|
+
|
310
|
+
Style/RedundantRegexpEscape:
|
311
|
+
Enabled: true
|
312
|
+
|
313
|
+
Style/Semicolon:
|
314
|
+
Enabled: true
|
315
|
+
AllowAsExpressionSeparator: true
|
316
|
+
|
317
|
+
# Prefer Foo.method over Foo::method
|
318
|
+
Style/ColonMethodCall:
|
319
|
+
Enabled: true
|
320
|
+
|
321
|
+
Style/TrivialAccessors:
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
# Prefer a = b || c over a = b ? b : c
|
325
|
+
Style/RedundantCondition:
|
326
|
+
Enabled: true
|
327
|
+
|
328
|
+
Style/RedundantDoubleSplatHashBraces:
|
329
|
+
Enabled: true
|
330
|
+
|
331
|
+
Style/OpenStructUse:
|
332
|
+
Enabled: true
|
333
|
+
|
334
|
+
Style/ArrayIntersect:
|
335
|
+
Enabled: true
|
336
|
+
|
337
|
+
Style/KeywordArgumentsMerging:
|
338
|
+
Enabled: true
|
339
|
+
|
340
|
+
Performance/BindCall:
|
341
|
+
Enabled: true
|
342
|
+
|
343
|
+
Performance/FlatMap:
|
344
|
+
Enabled: true
|
345
|
+
|
346
|
+
Performance/MapCompact:
|
347
|
+
Enabled: true
|
348
|
+
|
349
|
+
Performance/SelectMap:
|
350
|
+
Enabled: true
|
351
|
+
|
352
|
+
Performance/RedundantMerge:
|
353
|
+
Enabled: true
|
354
|
+
|
355
|
+
Performance/StartWith:
|
356
|
+
Enabled: true
|
357
|
+
|
358
|
+
Performance/EndWith:
|
359
|
+
Enabled: true
|
360
|
+
|
361
|
+
Performance/RegexpMatch:
|
362
|
+
Enabled: true
|
363
|
+
|
364
|
+
Performance/ReverseEach:
|
365
|
+
Enabled: true
|
366
|
+
|
367
|
+
Performance/StringReplacement:
|
368
|
+
Enabled: true
|
369
|
+
|
370
|
+
Performance/DeletePrefix:
|
371
|
+
Enabled: true
|
372
|
+
|
373
|
+
Performance/DeleteSuffix:
|
374
|
+
Enabled: true
|
375
|
+
|
376
|
+
Performance/InefficientHashSearch:
|
377
|
+
Enabled: true
|
378
|
+
|
379
|
+
Performance/ConstantRegexp:
|
380
|
+
Enabled: true
|
381
|
+
|
382
|
+
Performance/RedundantStringChars:
|
383
|
+
Enabled: true
|
384
|
+
|
385
|
+
Performance/StringInclude:
|
386
|
+
Enabled: true
|
387
|
+
|
388
|
+
Minitest/AssertNil:
|
389
|
+
Enabled: true
|
390
|
+
|
391
|
+
Minitest/AssertRaisesWithRegexpArgument:
|
392
|
+
Enabled: true
|
393
|
+
|
394
|
+
Minitest/AssertWithExpectedArgument:
|
395
|
+
Enabled: true
|
396
|
+
|
397
|
+
Minitest/LiteralAsActualArgument:
|
398
|
+
Enabled: true
|
399
|
+
|
400
|
+
Minitest/NonExecutableTestMethod:
|
401
|
+
Enabled: true
|
402
|
+
|
403
|
+
Minitest/SkipEnsure:
|
404
|
+
Enabled: true
|
405
|
+
|
406
|
+
Minitest/UnreachableAssertion:
|
407
|
+
Enabled: true
|
408
|
+
|
409
|
+
Markdown:
|
410
|
+
# Whether to run RuboCop against non-valid snippets
|
411
|
+
WarnInvalid: true
|
412
|
+
# Whether to lint codeblocks without code attributes
|
413
|
+
Autodetect: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## [0.1.2] - 2025-07-01
|
4
|
+
|
5
|
+
* Fix edit command to work with saved internal conflicts [\#2](https://github.com/sixis/rails-conflicted-credentials/pull/2) ([SixiS](https://github.com/sixis))
|
6
|
+
* Fix edit command to work without manual env option [\#1](https://github.com/sixis/rails-conflicted-credentials/pull/1) ([SixiS](https://github.com/sixis))
|
7
|
+
|
8
|
+
## [0.1.0] - 2025-06-28
|
9
|
+
|
10
|
+
* Initial release copied out of rails fork
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Matthew Hirst
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Matthew Hirst
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
[](https://badge.fury.io/rb/rails-conflicted-credentials)
|
2
|
+
[](https://github.com/SixiS/rails-conflicted-credentials/actions/workflows/ci.yml)
|
3
|
+
|
4
|
+
# Rails::Conflicted::Credentials
|
5
|
+
|
6
|
+
A gem to help editing rails credentials files with git merge conflicts.
|
7
|
+
|
8
|
+
## Pitch:
|
9
|
+
|
10
|
+
Are your rails credentials stuck looking like:
|
11
|
+
```
|
12
|
+
<<<<<<< HEAD
|
13
|
+
axssa4Lio6dTXKohAxnb9xGK47iD2tPguExc10WG--it7a+imKmhi2/oHn--SYem69mNPcb4PRLVghntzw==
|
14
|
+
=======
|
15
|
+
gg3TRVAh5NYnGx7Vwu8KpfmrspG75Oh0WSTFW9QC--3WhE+IKJeq4ZNPEv--BOT8y29V6OL9D8A4oN9FLg==
|
16
|
+
>>>>>>> @{-1}
|
17
|
+
```
|
18
|
+
|
19
|
+
and you wish they could be edited like:
|
20
|
+
```
|
21
|
+
baz: foo
|
22
|
+
<<<<<<< HEAD
|
23
|
+
foo: bar
|
24
|
+
=======
|
25
|
+
foo: baz
|
26
|
+
>>>>>>> @{-1}
|
27
|
+
bar: baz
|
28
|
+
```
|
29
|
+
|
30
|
+
Then this is the gem for you!
|
31
|
+
Simply install the gem and use the new command `rails conflicted_credentials:edit`
|
32
|
+
|
33
|
+
## Installation
|
34
|
+
|
35
|
+
Add this line to your application's Gemfile:
|
36
|
+
```ruby
|
37
|
+
gem "rails-conflicted-credentials"
|
38
|
+
```
|
39
|
+
And then execute:
|
40
|
+
|
41
|
+
$ bundle
|
42
|
+
|
43
|
+
Or install it yourself as:
|
44
|
+
|
45
|
+
$ gem install rails-conflicted-credentials
|
46
|
+
|
47
|
+
## Usage
|
48
|
+
|
49
|
+
This gem contains one new rails command:
|
50
|
+
|
51
|
+
```bash
|
52
|
+
rails conflicted_credentials:edit
|
53
|
+
```
|
54
|
+
|
55
|
+
It works with all the same options as `rails credentials:edit`.
|
56
|
+
```bash
|
57
|
+
Options:
|
58
|
+
-e, [--environment=ENVIRONMENT] # The environment to run `credentials` in (e.g. test / development / production).
|
59
|
+
```
|
60
|
+
|
61
|
+
More info:
|
62
|
+
```bash
|
63
|
+
rails credentials:help
|
64
|
+
```
|
65
|
+
|
66
|
+
## Development
|
67
|
+
|
68
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
|
70
|
+
## Contributing
|
71
|
+
|
72
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sixis/rails-conflicted-credentials. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/sixis/rails-conflicted-credentials/blob/master/CODE_OF_CONDUCT.md).
|
73
|
+
|
74
|
+
## License
|
75
|
+
|
76
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
77
|
+
|
78
|
+
## Code of Conduct
|
79
|
+
|
80
|
+
Everyone interacting in the Rails::Conflicted::Credentials project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sixis/rails-conflicted-credentials/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tempfile"
|
4
|
+
|
5
|
+
module Rails
|
6
|
+
module Command
|
7
|
+
class ConflictedCredentialsCommand
|
8
|
+
class ConflictedCredentials
|
9
|
+
GIT_CONFLICT_MARKER = /^<{7} (?:(?!={7})[\s\S])*={7}(?:(?!>{7} \w+)[\s\S])*>{7} .+/
|
10
|
+
|
11
|
+
def initialize(content_path, key_path)
|
12
|
+
@content_path = content_path
|
13
|
+
@key_path = key_path
|
14
|
+
return if content_path.blank? || !File.exist?(content_path)
|
15
|
+
|
16
|
+
@file_data = File.binread(content_path).strip
|
17
|
+
end
|
18
|
+
|
19
|
+
def conflicts?
|
20
|
+
return false if @file_data.nil?
|
21
|
+
|
22
|
+
@file_data.match?(GIT_CONFLICT_MARKER)
|
23
|
+
end
|
24
|
+
|
25
|
+
def internalise_conflicts
|
26
|
+
left_unencrypted_string, right_unencrypted_string = decrypt_individual_files
|
27
|
+
return if right_unencrypted_string.nil?
|
28
|
+
|
29
|
+
conflicted_unencrypted_string = merge_conflicted_strings(
|
30
|
+
left_unencrypted_string,
|
31
|
+
right_unencrypted_string
|
32
|
+
)
|
33
|
+
|
34
|
+
ActiveSupport::EncryptedFile.new(
|
35
|
+
content_path: @content_path,
|
36
|
+
key_path: @key_path,
|
37
|
+
env_key: "RAILS_MASTER_KEY",
|
38
|
+
raise_if_missing_key: true
|
39
|
+
).write(conflicted_unencrypted_string)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def decrypt_individual_files
|
44
|
+
left_encrypted_string, right_encrypted_string = split_conflict(@file_data)
|
45
|
+
return nil if right_encrypted_string.nil?
|
46
|
+
|
47
|
+
left_encrypted_file = Tempfile.new("encrypted-left")
|
48
|
+
left_encrypted_file.write(left_encrypted_string)
|
49
|
+
left_encrypted_file.close
|
50
|
+
|
51
|
+
right_encrypted_file = Tempfile.new("encrypted-right")
|
52
|
+
right_encrypted_file.write(right_encrypted_string)
|
53
|
+
right_encrypted_file.close
|
54
|
+
|
55
|
+
unencrypted_left_string = ActiveSupport::EncryptedFile.new(
|
56
|
+
content_path: left_encrypted_file.path,
|
57
|
+
key_path: @key_path,
|
58
|
+
env_key: "RAILS_MASTER_KEY",
|
59
|
+
raise_if_missing_key: true
|
60
|
+
).read
|
61
|
+
|
62
|
+
unencrypted_right_string = ActiveSupport::EncryptedFile.new(
|
63
|
+
content_path: right_encrypted_file.path,
|
64
|
+
key_path: @key_path,
|
65
|
+
env_key: "RAILS_MASTER_KEY",
|
66
|
+
raise_if_missing_key: true
|
67
|
+
).read
|
68
|
+
|
69
|
+
[unencrypted_left_string, unencrypted_right_string]
|
70
|
+
ensure
|
71
|
+
[left_encrypted_file, right_encrypted_file].each do |f|
|
72
|
+
f.unlink if f&.path && File.exist?(f.path)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def split_conflict(content)
|
77
|
+
if content.match?(GIT_CONFLICT_MARKER)
|
78
|
+
@conflict_type = :git
|
79
|
+
split_git_conflict(content)
|
80
|
+
else
|
81
|
+
@conflict_type = :unknown
|
82
|
+
[content, nil]
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def split_git_conflict(content)
|
87
|
+
left_lines = []
|
88
|
+
right_lines = []
|
89
|
+
|
90
|
+
state = :common
|
91
|
+
content.each_line do |line|
|
92
|
+
if line.start_with?("<<<<<<< ")
|
93
|
+
@head_left ||= line.split("<<<<<<< ").last.strip
|
94
|
+
state = :in_left
|
95
|
+
elsif line.start_with?("=======")
|
96
|
+
state = :in_right
|
97
|
+
elsif line.start_with?(">>>>>>> ")
|
98
|
+
@head_right ||= line.split(">>>>>>> ").last.strip
|
99
|
+
state = :common
|
100
|
+
elsif state == :in_left
|
101
|
+
left_lines << line
|
102
|
+
elsif state == :in_right
|
103
|
+
right_lines << line
|
104
|
+
else
|
105
|
+
left_lines << line
|
106
|
+
right_lines << line
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
[left_lines.join.strip, right_lines.join.strip]
|
111
|
+
end
|
112
|
+
|
113
|
+
def merge_conflicted_strings(left_string, right_string)
|
114
|
+
if @conflict_type == :git
|
115
|
+
git_merge_strings(left_string, right_string)
|
116
|
+
else
|
117
|
+
default_merge_strings(left_string, right_string)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def git_merge_strings(local_str, remote_str, base_str = "")
|
122
|
+
base_file = Tempfile.new("git-merge-base")
|
123
|
+
base_file.write(base_str)
|
124
|
+
base_file.close
|
125
|
+
local_file = Tempfile.new("git-merge-local")
|
126
|
+
local_file.write(local_str)
|
127
|
+
local_file.close
|
128
|
+
remote_file = Tempfile.new("git-merge-remote")
|
129
|
+
remote_file.write(remote_str)
|
130
|
+
remote_file.close
|
131
|
+
|
132
|
+
cmd = [
|
133
|
+
"git merge-file -p",
|
134
|
+
local_file.path,
|
135
|
+
base_file.path,
|
136
|
+
remote_file.path,
|
137
|
+
"2>&1"
|
138
|
+
].join(" ")
|
139
|
+
|
140
|
+
merged = `#{cmd}`
|
141
|
+
status = $?
|
142
|
+
|
143
|
+
unless status.success? || status.exitstatus == 1
|
144
|
+
return default_merge_strings(local_str, remote_str)
|
145
|
+
end
|
146
|
+
|
147
|
+
merged.strip
|
148
|
+
.gsub(local_file.path, @head_left)
|
149
|
+
.gsub(remote_file.path, @head_right)
|
150
|
+
ensure
|
151
|
+
[base_file, local_file, remote_file].each do |f|
|
152
|
+
f.unlink if f&.path && File.exist?(f.path)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def default_merge_strings(local_str, remote_str)
|
157
|
+
[
|
158
|
+
"<<<<<<< #{@head_left}",
|
159
|
+
local_str,
|
160
|
+
"=======",
|
161
|
+
remote_str,
|
162
|
+
">>>>>> #{@head_right}"
|
163
|
+
].compact.join("\n")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/command"
|
4
|
+
require "rails/commands/credentials/credentials_command"
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
module Command
|
8
|
+
class ConflictedCredentialsCommand < ::Rails::Command::CredentialsCommand
|
9
|
+
require_relative "conflicted_credentials_command/conflicted_credentials"
|
10
|
+
|
11
|
+
desc "edit", "Open the decrypted credentials in `$VISUAL` or `$EDITOR` for editing even if there are conflicts"
|
12
|
+
def edit
|
13
|
+
begin
|
14
|
+
load_environment_config!
|
15
|
+
rescue ActiveSupport::MessageEncryptor::InvalidMessage, ActiveSupport::EncryptedConfiguration::InvalidContentError
|
16
|
+
# It's ok because they were conflicted
|
17
|
+
end
|
18
|
+
|
19
|
+
load_generators
|
20
|
+
|
21
|
+
if environment_specified?
|
22
|
+
@content_path = "config/credentials/#{environment}.yml.enc" unless config.overridden?(:content_path)
|
23
|
+
@key_path = "config/credentials/#{environment}.key" unless config.overridden?(:key_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
conflicted_credentials = ConflictedCredentials.new(content_path, key_path)
|
27
|
+
conflicted_credentials.internalise_conflicts if conflicted_credentials.conflicts?
|
28
|
+
|
29
|
+
ensure_encryption_key_has_been_added
|
30
|
+
ensure_credentials_have_been_added
|
31
|
+
ensure_diffing_driver_is_configured
|
32
|
+
|
33
|
+
change_credentials_in_system_editor
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-conflicted-credentials
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthew Hirst
|
8
|
+
bindir: exe
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: rails
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '7.0'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '7.0'
|
26
|
+
email:
|
27
|
+
- hirst.mat@gmail.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- ".rspec"
|
33
|
+
- ".rubocop.yml"
|
34
|
+
- CHANGELOG.md
|
35
|
+
- CODE_OF_CONDUCT.md
|
36
|
+
- LICENSE
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- lib/rails/commands/conflicted_credentials/conflicted_credentials_command.rb
|
41
|
+
- lib/rails/commands/conflicted_credentials/conflicted_credentials_command/conflicted_credentials.rb
|
42
|
+
- lib/rails/conflicted/credentials.rb
|
43
|
+
- lib/rails/conflicted/credentials/version.rb
|
44
|
+
- sig/rails/conflicted/credentials.rbs
|
45
|
+
homepage: https://github.com/SixiS/rails-conflicted-credentials
|
46
|
+
licenses:
|
47
|
+
- MIT
|
48
|
+
metadata:
|
49
|
+
homepage_uri: https://github.com/SixiS/rails-conflicted-credentials
|
50
|
+
source_code_uri: https://github.com/SixiS/rails-conflicted-credentials
|
51
|
+
changelog_uri: https://github.com/SixiS/rails-conflicted-credentials/blob/main/CHANGELOG.md
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 3.0.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.6.9
|
67
|
+
specification_version: 4
|
68
|
+
summary: A gem to help editing rails credentials files with git merge conflicts.
|
69
|
+
test_files: []
|