gemwork 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6d3241df9423a54841f11171d2fbeff4bb63b22085bc187a18fedae95b74ee2f
4
+ data.tar.gz: 7a5dea7187011408054ec03e82ec39613db139d40187db044f115a35a3b65133
5
+ SHA512:
6
+ metadata.gz: d0f5e9c142694babd902734ef36ccdee43439ca13a79b3d276a488136e42dfa1a8a2dd6ea2dc38ce727937bbede0e5c94d1e0da04b0508876be932af8cf5e9dd
7
+ data.tar.gz: c996bc46e4a8d3b96daeb73d4d3c8ccbf9905267dc3f238de1d2cc3d4d55b500d08945591728e7065a2bbd8a50892e54e568f2d22a7c4544a20f04ca46b06aa9
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.1] - 2023-11-24
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Paul DobbinSchmaltz
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,118 @@
1
+ # Gemwork
2
+
3
+ Gemwork is an abstract framework used by [pdobb](https://github.com/pdobb)'s Ruby Gems.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your `my_gem.gemspec` file:
8
+
9
+ ```ruby
10
+ spec.add_development_dependency "gemwork"
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```bash
16
+ bundle
17
+
18
+ # OR
19
+
20
+ bin/setup
21
+ ```
22
+
23
+ ## Rake Integration
24
+
25
+ Gemwork provides a number of additional Rake tasks that can be integrated into your project.
26
+
27
+ Create file: `./rakelib/gemwork.rake`
28
+ (If the `rakelib` directory doesn't exist, create it at the project root.)
29
+
30
+ ```ruby
31
+ # frozen_string_literal: true
32
+
33
+ # Load additional tasks defined by Gemwork.
34
+ Gem::Specification.find_by_name("gemwork").tap do |gemspec|
35
+ Rake.load_rakefile("#{gemspec.gem_dir}/lib/tasks/Rakefile")
36
+ end
37
+ ```
38
+
39
+ Running `rake -T` after this will reveal the additional tasks defined by Gemwork just as if they were defined within your project.
40
+
41
+ ## Rubocop Integration
42
+ ### Simple Usage
43
+
44
+ Add the following to the `.rubocop.yml` file in your gem:
45
+
46
+ ```yaml
47
+ # .rubocop.yml
48
+
49
+ inherit_gem:
50
+ gemwork: lib/rubocop/.rubocop.yml
51
+ ```
52
+
53
+ ### Advanced Usage
54
+
55
+ The above (simple usage) will automatically includes all RuboCop configuration settings defined in Gemwork. You can, however, require individual cop definitions piecemeal:
56
+
57
+ ```yaml
58
+ # .rubocop.yml
59
+
60
+ # Load Rubocop plugins.
61
+ require:
62
+ - rubocop-rake
63
+ - rubocop-minitest
64
+ - rubocop-performance
65
+
66
+ # Load Cops configuration by Department.
67
+ inherit_gem:
68
+ gemwork:
69
+ - lib/rubocop/all_cops.yml
70
+ - lib/rubocop/gemspec.yml
71
+ - lib/rubocop/layout.yml
72
+ - lib/rubocop/lint.yml
73
+ - lib/rubocop/metrics.yml
74
+ - lib/rubocop/naming.yml
75
+ - lib/rubocop/style.yml
76
+ ```
77
+
78
+ See also: [RuboCop's Configuration Guide on Inheritance](https://github.com/rubocop/rubocop/blob/master/docs/modules/ROOT/pages/configuration.adoc#inheriting-configuration-from-a-dependency-gem).
79
+
80
+ ## Development
81
+
82
+ Development of Gemwork often requires making updates to its code and then testing them in another child gem that uses Gemwork.
83
+
84
+ Even if the child gem already has the `gemwork` gem installed from RubyGems, local changes to Gemwork can be compiled and installed as a local gem, which the child gem will then immediately utilize. To facilitate this, it is recommended to add this compile/local-install step to the child gem's `bin/setup` executable:
85
+
86
+ ```bash
87
+ # ./bin/setup for your child gem:
88
+
89
+ # ...
90
+
91
+ # Recompile and install Gemwork locally.
92
+ ( cd ~/dev/gemwork && rake install:local )
93
+
94
+ # The above code should be placed above this line in your bin/setup:
95
+ bundle install
96
+
97
+ # ...
98
+ ```
99
+
100
+ ### Releases
101
+
102
+ To release a new version of Gemwork to RubyGems:
103
+
104
+ 1. Update the version number in `version.rb`
105
+ 2. Update `CHANGELOG.md`
106
+ 3. Run `rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
107
+
108
+ ## Contributing
109
+
110
+ Bug reports and pull requests are welcome on GitHub at https://github.com/pdobb/gemwork. 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/pdobb/gemwork/blob/master/CODE_OF_CONDUCT.md).
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
115
+
116
+ ## Code of Conduct
117
+
118
+ Everyone interacting in the Gemwork project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pdobb/gemwork/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gemwork
4
+ VERSION = "0.1.0"
5
+ end
data/lib/gemwork.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "version"
4
+
5
+ # Gemwork is the top-level namespace/module for this gem.
6
+ module Gemwork
7
+ end
@@ -0,0 +1,18 @@
1
+ # See: https://github.com/troessner/reek#configuration-options
2
+
3
+ detectors:
4
+ Attribute:
5
+ enabled: false
6
+ DuplicateMethodCall:
7
+ exclude:
8
+ - "self.test"
9
+ TooManyStatements:
10
+ exclude:
11
+ - "self.test"
12
+ UncommunicativeVariableName:
13
+ exclude:
14
+ - "self.test"
15
+
16
+ exclude_paths:
17
+ - script
18
+ - test
@@ -0,0 +1,8 @@
1
+ inherit_from:
2
+ - ./all_cops.yml
3
+ - ./gemspec.yml
4
+ - ./layout.yml
5
+ - ./lint.yml
6
+ - ./metrics.yml
7
+ - ./naming.yml
8
+ - ./style.yml
@@ -0,0 +1,15 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ DisplayStyleGuide: true
4
+ ExtraDetails: true
5
+ NewCops: enable
6
+ TargetRubyVersion: 2.7
7
+ UseCache: true
8
+ Exclude:
9
+ # Rubocop Defaults
10
+ - "node_modules/**/*"
11
+ - "tmp/**/*"
12
+ - "vendor/**/*"
13
+ - ".git/**/*"
14
+ # Custom additions
15
+ - "script/**/*"
@@ -0,0 +1,8 @@
1
+ Gemspec/DeprecatedAttributeAssignment:
2
+ Enabled: true
3
+
4
+ Gemspec/DevelopmentDependencies:
5
+ EnforcedStyle: gemspec
6
+
7
+ Gemspec/RequireMFA:
8
+ Enabled: true
@@ -0,0 +1,57 @@
1
+ Layout/DotPosition:
2
+ EnforcedStyle: trailing
3
+
4
+ Layout/EmptyLineAfterGuardClause:
5
+ Enabled: true
6
+
7
+ Layout/EndOfLine:
8
+ EnforcedStyle: lf
9
+
10
+ Layout/FirstArgumentIndentation:
11
+ EnforcedStyle: consistent_relative_to_receiver
12
+
13
+ Layout/FirstArrayElementIndentation:
14
+ EnforcedStyle: consistent
15
+
16
+ Layout/FirstHashElementIndentation:
17
+ EnforcedStyle: consistent
18
+
19
+ Layout/FirstParameterIndentation:
20
+ Enabled: false # Revisit if more settings become available.
21
+
22
+ Layout/LineContinuationSpacing:
23
+ EnforcedStyle: no_space
24
+
25
+ Layout/LineEndStringConcatenationIndentation:
26
+ EnforcedStyle: aligned
27
+
28
+ Layout/LineLength:
29
+ Max: 80
30
+ Exclude:
31
+ - "*.gemspec"
32
+ AllowedPatterns:
33
+ # YARD doc `@example` output.
34
+ - !ruby/regexp /\A *# \# => /
35
+ - !ruby/regexp /\A *# =/
36
+
37
+ Layout/MultilineAssignmentLayout:
38
+ Enabled: true
39
+ SupportedTypes:
40
+ - block
41
+ - case
42
+ - class
43
+ - if
44
+ # - kwbegin
45
+ - module
46
+
47
+ Layout/MultilineMethodCallBraceLayout:
48
+ EnforcedStyle: same_line
49
+
50
+ Layout/MultilineMethodCallIndentation:
51
+ EnforcedStyle: indented_relative_to_receiver
52
+
53
+ Layout/MultilineMethodDefinitionBraceLayout:
54
+ EnforcedStyle: same_line
55
+
56
+ Layout/MultilineOperationIndentation:
57
+ Enabled: false # Waiting for e.g. `indented_relative_to_receiver`.
@@ -0,0 +1,8 @@
1
+ # Lint/AmbiguousOperator:
2
+ # Enabled: false # Conflicts with other rules.
3
+
4
+ # Lint/AmbiguousRegexpLiteral:
5
+ # Enabled: false # Conflicts with other rules.
6
+
7
+ Lint/Void:
8
+ CheckForMethodsWithNoSideEffects: true
@@ -0,0 +1,28 @@
1
+ Metrics/BlockLength:
2
+ AllowedMethods:
3
+ - context # Tests
4
+ - describe # Tests
5
+ - ips # Benchmarking
6
+ - new
7
+
8
+ Metrics/ClassLength:
9
+ CountAsOne:
10
+ - array
11
+ - heredoc
12
+ - method_call
13
+ Exclude:
14
+ - "test/**/*"
15
+
16
+ Metrics/MethodLength:
17
+ CountAsOne:
18
+ - array
19
+ - hash
20
+ - heredoc
21
+ - method_call
22
+
23
+ Metrics/ModuleLength:
24
+ CountAsOne:
25
+ - array
26
+ - hash
27
+ - heredoc
28
+ - method_call
@@ -0,0 +1,7 @@
1
+ Naming/MethodParameterName:
2
+ AllowedNames:
3
+ - a
4
+ - b
5
+
6
+ Naming/RescuedExceptionsVariableName:
7
+ PreferredName: ex
@@ -0,0 +1,105 @@
1
+ Style/Alias:
2
+ EnforcedStyle: prefer_alias_method
3
+
4
+ Style/BlockDelimiters:
5
+ EnforcedStyle: semantic
6
+ AllowBracesOnProceduralOneLiners: true
7
+ FunctionalMethods:
8
+ # Minitest Spec DSL. (Rubocop defaults.)
9
+ - let
10
+ - let!
11
+ - subject
12
+ - watch
13
+ # Overrides (Defaulted to Procedural by Rubocop.)
14
+ - tap
15
+ # MuchStub
16
+ - call
17
+ - on_call
18
+ - spy
19
+ # - tap (Already listed above.)
20
+ - tap_on_call
21
+ - with
22
+ ProceduralMethods: # Defining this just to remove `tap` from the list.
23
+ - benchmark
24
+ - bm
25
+ - bmbm
26
+ - create
27
+ - each_with_object
28
+ - measure
29
+ - new
30
+ - realtime
31
+ # - tap (Remove from Rubocop defaults.)
32
+ - with_object
33
+
34
+ Style/ClassAndModuleChildren:
35
+ AutoCorrect: true
36
+ EnforcedStyle: compact
37
+ Exclude:
38
+ - "test/**/*"
39
+
40
+ Style/CollectionMethods:
41
+ Enabled: true
42
+ PreferredMethods:
43
+ collect: map
44
+ collect!: map!
45
+ find_all: select
46
+ detect: detect
47
+ inject: inject
48
+
49
+ Style/Documentation:
50
+ Exclude:
51
+ - "test/**/*"
52
+
53
+ Style/EmptyElse:
54
+ Enabled: false # Including a comment in an empty else block shows intent.
55
+
56
+ Style/EmptyMethod:
57
+ EnforcedStyle: expanded
58
+
59
+ Style/ExpandPathArguments:
60
+ Exclude:
61
+ - "*.gemspec"
62
+
63
+ Style/FormatString:
64
+ Enabled: false # % notation with an Array just reads better sometimes.
65
+
66
+ Style/Lambda:
67
+ EnforcedStyle: literal
68
+
69
+ Style/LambdaCall:
70
+ Enabled: false # Allow ServiceObject.(*). Only use on classes, not instances.
71
+
72
+ Style/NumericPredicate:
73
+ AutoCorrect: true
74
+
75
+ Style/OpenStructUse:
76
+ Exclude:
77
+ - "test/**/*"
78
+
79
+ Style/RegexpLiteral:
80
+ EnforcedStyle: mixed
81
+
82
+ Style/RescueStandardError:
83
+ EnforcedStyle: implicit
84
+
85
+ Style/ReturnNil:
86
+ Enabled: true
87
+
88
+ Style/StringMethods:
89
+ Enabled: true
90
+
91
+ Style/SingleLineMethods:
92
+ Exclude:
93
+ - "test/**/*"
94
+
95
+ Style/StringLiterals:
96
+ EnforcedStyle: double_quotes
97
+
98
+ Style/StringLiteralsInInterpolation:
99
+ EnforcedStyle: double_quotes
100
+
101
+ Style/TrailingCommaInArrayLiteral:
102
+ EnforcedStyleForMultiline: comma
103
+
104
+ Style/TrailingCommaInHashLiteral:
105
+ EnforcedStyleForMultiline: comma
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # FIXME: How to do relative path loading (from a child gem context)?
4
+ spec = Gem::Specification.find_by_name("gemwork")
5
+ Dir.glob("#{spec.gem_dir}/lib/tasks/*.rake").each { |r| load r }
6
+
7
+ task :default do
8
+ run_tasks(%i[
9
+ test
10
+ rubocop
11
+ reek
12
+ yard
13
+ ])
14
+ end
15
+
16
+ def run_tasks(tasks)
17
+ tasks.each_with_index do |name, index|
18
+ annotate_run(name) do
19
+ Rake::Task[name].invoke
20
+ end
21
+
22
+ puts unless index.next == tasks.size
23
+ end
24
+ end
25
+
26
+ def annotate_run(name)
27
+ puts "= Running #{name} #{"=" * (71 - name.size)}\n"
28
+ yield
29
+ puts "= Done #{"=" * 75}"
30
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "reek/rake/task"
4
+
5
+ Reek::Rake::Task.new do |t|
6
+ t.fail_on_error = false
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubocop/rake_task"
4
+
5
+ RuboCop::RakeTask.new do |t|
6
+ t.fail_on_error = false
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/testtask"
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test"
7
+ t.libs << "lib"
8
+ t.test_files = FileList["test/**/*_test.rb"]
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yard"
4
+
5
+ YARD::Rake::YardocTask.new do |t|
6
+ t.stats_options = ["--list-undoc"]
7
+ end
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gemwork
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Paul DobbinSchmaltz
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-11-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: reek
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-performance
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Gemwork is an abstract framework used by pdobb's Ruby Gems.
112
+ email:
113
+ - p.dobbinschmaltz@icloud.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - CHANGELOG.md
119
+ - LICENSE.txt
120
+ - README.md
121
+ - lib/gemwork.rb
122
+ - lib/gemwork/version.rb
123
+ - lib/reek/.reek.yml
124
+ - lib/rubocop/.rubocop.yml
125
+ - lib/rubocop/all_cops.yml
126
+ - lib/rubocop/gemspec.yml
127
+ - lib/rubocop/layout.yml
128
+ - lib/rubocop/lint.yml
129
+ - lib/rubocop/metrics.yml
130
+ - lib/rubocop/naming.yml
131
+ - lib/rubocop/style.yml
132
+ - lib/tasks/Rakefile
133
+ - lib/tasks/reek.rake
134
+ - lib/tasks/rubocop.rake
135
+ - lib/tasks/test.rake
136
+ - lib/tasks/yard.rake
137
+ homepage: https://github.com/pdobb/gemwork
138
+ licenses:
139
+ - MIT
140
+ metadata:
141
+ bug_tracker_uri: https://github.com/pdobb/gemwork/issues
142
+ changelog_uri: https://github.com/pdobb/gemwork/releases
143
+ source_code_uri: https://github.com/pdobb/gemwork
144
+ homepage_uri: https://github.com/pdobb/gemwork
145
+ rubygems_mfa_required: 'true'
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '2.7'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubygems_version: 3.4.10
162
+ signing_key:
163
+ specification_version: 4
164
+ summary: Common gem framework code used by pdobb's Ruby Gems.
165
+ test_files: []