easy_command 1.0.0.pre.rc1

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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/.github/CODEOWNERS +5 -0
  3. data/.github/workflows/ci.yaml +52 -0
  4. data/.github/workflows/lint.yaml +38 -0
  5. data/.github/workflows/release.yml +43 -0
  6. data/.gitignore +14 -0
  7. data/.release-please-manifest.json +3 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +14 -0
  10. data/.rubocop_maintainer_style.yml +34 -0
  11. data/.rubocop_style.yml +142 -0
  12. data/.rubocop_todo.yml +453 -0
  13. data/.ruby-version +1 -0
  14. data/CHANGELOG.md +89 -0
  15. data/Gemfile +19 -0
  16. data/LICENSE.txt +22 -0
  17. data/README.md +736 -0
  18. data/easy_command.gemspec +26 -0
  19. data/lib/easy_command/chainable.rb +16 -0
  20. data/lib/easy_command/errors.rb +85 -0
  21. data/lib/easy_command/result.rb +53 -0
  22. data/lib/easy_command/ruby-2-7-specific.rb +49 -0
  23. data/lib/easy_command/ruby-2-specific.rb +53 -0
  24. data/lib/easy_command/ruby-3-specific.rb +49 -0
  25. data/lib/easy_command/spec_helpers/command_matchers.rb +89 -0
  26. data/lib/easy_command/spec_helpers/mock_command_helper.rb +89 -0
  27. data/lib/easy_command/spec_helpers.rb +2 -0
  28. data/lib/easy_command/version.rb +3 -0
  29. data/lib/easy_command.rb +94 -0
  30. data/locales/en.yml +2 -0
  31. data/release-please-config.json +11 -0
  32. data/spec/easy_command/errors_spec.rb +121 -0
  33. data/spec/easy_command/result_spec.rb +176 -0
  34. data/spec/easy_command_spec.rb +298 -0
  35. data/spec/factories/addition_command.rb +12 -0
  36. data/spec/factories/callback_command.rb +20 -0
  37. data/spec/factories/failure_command.rb +12 -0
  38. data/spec/factories/missed_call_command.rb +7 -0
  39. data/spec/factories/multiplication_command.rb +12 -0
  40. data/spec/factories/sub_command.rb +19 -0
  41. data/spec/factories/subcommand_command.rb +14 -0
  42. data/spec/factories/success_command.rb +11 -0
  43. data/spec/spec_helper.rb +16 -0
  44. metadata +102 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d66c45b6c43c30c4ad20b1e649abdf0551f6321969cdaafab0d6631f9c94a215
4
+ data.tar.gz: 670f4bd6b092b745992cf17bbeb74d7924c4e5aed9700b85425d978df6554ee7
5
+ SHA512:
6
+ metadata.gz: 01376a81eb36ef32aee7cc9f1445620369c65d51b0059abf3104f798eebac44722cf8d322594471c7cf005bb71497adb67d7b43543e64327e6fe5eb9a9540787
7
+ data.tar.gz: 4f64119cfbbb4f5e9b5cea8d735daefb8b6e0de100e9ad7e1bceb011aeb515ba9e885036d671735b0e8f84a834f2edc88d5fa9917398561d856860379d44bd2c
@@ -0,0 +1,5 @@
1
+ # Feature team that owns the code (can be several teams when it is a shared asset)
2
+ * @Swile/easy_command-maintainers
3
+
4
+ # MUST BE THE LAST LINE IN THIS FILE - Team that is responsible and control CODEOWNERS file
5
+ CODEOWNERS @Swile/easy_command-maintainers
@@ -0,0 +1,52 @@
1
+ # .github/workflows/ci.yaml
2
+ name: ci
3
+
4
+ on:
5
+ pull_request:
6
+ types:
7
+ - opened
8
+ - reopened
9
+ - synchronize
10
+
11
+ permissions:
12
+ contents: read
13
+ packages: read
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ ci:
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os: [ubuntu-latest]
25
+ ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
26
+ runs-on: ubuntu-latest
27
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ bundler-cache: true
34
+
35
+ - run: bundle install --jobs 4
36
+
37
+ - run: |
38
+ bundle exec rspec
39
+ check_future_compatibility:
40
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: ruby/setup-ruby@v1
45
+ with:
46
+ ruby-version: head
47
+ bundler-cache: true
48
+
49
+ - run: bundle install --jobs 4
50
+
51
+ - run: |
52
+ bundle exec rspec
@@ -0,0 +1,38 @@
1
+ # .github/workflows/ci.yaml
2
+ name: lint
3
+
4
+ on:
5
+ pull_request:
6
+ types:
7
+ - opened
8
+ - reopened
9
+ - synchronize
10
+
11
+ permissions:
12
+ contents: read
13
+ packages: read
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17
+ cancel-in-progress: true
18
+
19
+ jobs:
20
+ lint:
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os: [ubuntu-latest]
25
+ ruby: ['2.7']
26
+ runs-on: ubuntu-latest
27
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby }}
33
+ bundler-cache: true
34
+
35
+ - run: bundle install --jobs 4
36
+
37
+ - run: |
38
+ bundle exec rubocop
@@ -0,0 +1,43 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ checks: write
10
+ statuses: write
11
+ contents: write
12
+ packages: write
13
+ pull-requests: write
14
+ id-token: write
15
+
16
+ jobs:
17
+ release:
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - name: release please
22
+ id: release
23
+ uses: googleapis/release-please-action@v4
24
+
25
+ - name: clone repository
26
+ if: ${{ steps.release.outputs.releases_created == 'true' }}
27
+ uses: actions/checkout@v4
28
+
29
+ - name: setup ruby
30
+ if: ${{ steps.release.outputs.releases_created == 'true' }}
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ bundler-cache: false
34
+
35
+ - name: Configure trusted publishing credentials
36
+ if: ${{ steps.release.outputs.releases_created == 'true' }}
37
+ uses: rubygems/configure-rubygems-credentials@v1.0.0
38
+
39
+ - name: build and publish to Github Package Registry
40
+ if: ${{ steps.release.outputs.releases_created == 'true' }}
41
+ run: |
42
+ gem build *.gemspec
43
+ gem push *.gem
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
14
+ Gemfile.lock
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.0.0-rc1"
3
+ }
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ inherit_from:
2
+ - .rubocop_style.yml
3
+ - .rubocop_maintainer_style.yml
4
+ - .rubocop_todo.yml
5
+
6
+ require:
7
+ - rubocop-rspec
8
+
9
+ inherit_mode:
10
+ merge:
11
+ - Exclude
12
+
13
+ AllCops:
14
+ TargetRubyVersion: 2.7
@@ -0,0 +1,34 @@
1
+ # This is an ovverride of the usual style config at Swile this is in part
2
+ # because the actual rubocop config from Swile is not publically referenceable
3
+ # but also to allow for some flexibility in the maintenance and in eventual
4
+ # external contributions.
5
+ # Feel free to adapt or remove it as needed.
6
+
7
+ Layout/MultilineMethodCallIndentation:
8
+ EnforcedStyle: indented
9
+ Layout/SingleLineBlockChain:
10
+ Enabled: false
11
+
12
+ Metrics/MethodLength:
13
+ Enabled: false
14
+
15
+ RSpec/StubbedMock:
16
+ Enabled: false
17
+ RSpec/BeEq:
18
+ Enabled: false
19
+ RSpec/MessageExpectation:
20
+ Enabled: false
21
+ RSpec/MessageSpies:
22
+ EnforcedStyle: receive
23
+
24
+ Style/Alias:
25
+ EnforcedStyle: prefer_alias_method
26
+ Style/BlockComments:
27
+ Enabled: false
28
+ Style/BlockDelimiters:
29
+ AllowedPatterns:
30
+ - let
31
+ Style/MethodCallWithArgsParentheses:
32
+ Enabled: false
33
+ Style/SingleLineMethods:
34
+ Enabled: false
@@ -0,0 +1,142 @@
1
+ AllCops:
2
+ EnabledByDefault: true
3
+ SuggestExtensions: false
4
+ Exclude:
5
+ # This is not our code.
6
+ - bin/**/*
7
+
8
+ # https://github.com/TheMenu/rubocop-config/issues/17
9
+ Layout/ArgumentAlignment:
10
+ EnforcedStyle: with_fixed_indentation
11
+ # https://github.com/TheMenu/rubocop-config/issues/2
12
+ Layout/ClassStructure:
13
+ Enabled: false
14
+ # To be able to copy paste multiple lines into a pry console.
15
+ Layout/DotPosition:
16
+ EnforcedStyle: trailing
17
+ # Because on a 2 lines method, we do not want to be forced to add a 3rd empty line.
18
+ Layout/EmptyLineAfterGuardClause:
19
+ Enabled: false
20
+ # Disable rule for comments.
21
+ Layout/LineLength:
22
+ AllowedPatterns: ['\A#']
23
+ # Allow expressions on multiple lines even if they could fit on a single line.
24
+ Layout/RedundantLineBreak:
25
+ Enabled: false
26
+ # Having to prefix all classes by `::` is too much to avoid low probability clashes.
27
+ Lint/ConstantResolution:
28
+ Enabled: false
29
+ # Much less readable.
30
+ Lint/NumberConversion:
31
+ Enabled: false
32
+ Metrics/BlockLength:
33
+ # Describes block are more comments than real code blocks.
34
+ AllowedMethods: ['describe', 'context']
35
+ # Initializers are long, we know and we do not care.
36
+ Exclude:
37
+ - config/initializers/*
38
+ # This cop checks if the length a method exceeds some maximum value.
39
+ Metrics/MethodLength:
40
+ Max: 20
41
+ # Memoized variables should not be accessed outside the method, and this should be explicit.
42
+ Naming/MemoizedInstanceVariableName:
43
+ EnforcedStyleForLeadingUnderscores: required
44
+ # Line alignment makes diffs bigger and harder to read.
45
+ RSpec/AlignLeftLetBrace:
46
+ Enabled: false
47
+ # Line alignment makes diffs bigger and harder to read.
48
+ RSpec/AlignRightLetBrace:
49
+ Enabled: false
50
+ # Consider extracting out some behaviour, e.g. with a `let` block, or a helper method.
51
+ RSpec/ExampleLength:
52
+ Max: 15
53
+ # `let!` variable referenced in an upper context is not detected, triggering many false positives.
54
+ RSpec/LetSetup:
55
+ Enabled: false
56
+ # Checks if examples contain too many `expect` calls.
57
+ RSpec/MultipleExpectations:
58
+ Enabled: false
59
+ # Nested contexts are considered bad. I might miss something, but I do not see why.
60
+ RSpec/MultipleMemoizedHelpers:
61
+ Enabled: false
62
+ # Static checks do not describe classes.
63
+ RSpec/DescribeClass:
64
+ Exclude:
65
+ - spec/static_checks/**/*
66
+ - spec/features/**/*
67
+ # When a class as only one public method, we want the same file name as the class but the method described.
68
+ RSpec/FilePath:
69
+ Enabled: false
70
+ # Nesting allow clear context separation. I prefer nesting to listing. This can be debated.
71
+ RSpec/NestedGroups:
72
+ Max: 5
73
+ # https://github.com/TheMenu/rubocop-config/issues/10
74
+ Style/BlockDelimiters:
75
+ EnforcedStyle: braces_for_chaining
76
+ # https://github.com/TheMenu/rubocop-config/issues/9
77
+ Style/ConstantVisibility:
78
+ Enabled: false
79
+ # We are not nazi robots, we want the flexibility to locally disable some rules.
80
+ Style/DisableCopsWithinSourceCodeDirective:
81
+ Enabled: false
82
+ # Ruby is self documented when correctly named.
83
+ Style/Documentation:
84
+ Enabled: false
85
+ # Ruby is self documented when correctly named.
86
+ Style/DocumentationMethod:
87
+ Enabled: false
88
+ # Everything is Swile copyrighted.
89
+ Style/Copyright:
90
+ Enabled: false
91
+ # Because return unless with negative are not necessarily more readable than an if.
92
+ Style/GuardClause:
93
+ Enabled: false
94
+ # In many occasions, adding an error class adds noise.
95
+ Style/ImplicitRuntimeError:
96
+ Enabled: false
97
+ # Because sometimes, we do not want to break a block for a comment.
98
+ Style/InlineComment:
99
+ Enabled: false
100
+ Style/IpAddresses:
101
+ Exclude:
102
+ - spec/**/*
103
+ # Parenthesis are more readable for non ruby seniors.
104
+ Style/MethodCallWithArgsParentheses:
105
+ AllowedMethods:
106
+ - gem
107
+ - require
108
+ - require_relative
109
+ - exit
110
+ - puts
111
+ - raise
112
+ # gemspec
113
+ - add_dependency
114
+ - add_development_dependency
115
+ # rspec
116
+ - to
117
+ - not_to
118
+ - describe
119
+ - it
120
+ - be
121
+ - context
122
+ - before
123
+ - after
124
+
125
+ # We do not want to explicit all nil else.
126
+ Style/MissingElse:
127
+ Enabled: false
128
+ # Sometime we need hashes with string keys.
129
+ Style/StringHashKeys:
130
+ Enabled: false
131
+ # https://github.com/TheMenu/rubocop-config/issues/14
132
+ Style/StringLiterals:
133
+ EnforcedStyle: double_quotes
134
+ # Reduce diff size.
135
+ Style/TrailingCommaInArguments:
136
+ EnforcedStyleForMultiline: consistent_comma
137
+ # Reduce diff size.
138
+ Style/TrailingCommaInArrayLiteral:
139
+ EnforcedStyleForMultiline: consistent_comma
140
+ # Reduce diff size.
141
+ Style/TrailingCommaInHashLiteral:
142
+ EnforcedStyleForMultiline: consistent_comma