rubysmith 1.0.0 → 1.3.0
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/README.adoc +27 -24
- data/exe/rubysmith +0 -1
- data/lib/rubysmith/builders/core.rb +9 -2
- data/lib/rubysmith/builders/git/commit.rb +2 -2
- data/lib/rubysmith/builders/git/ignore.rb +35 -0
- data/lib/rubysmith/builders/rake.rb +1 -0
- data/lib/rubysmith/builders/version.rb +28 -0
- data/lib/rubysmith/cli/actions/build.rb +2 -0
- data/lib/rubysmith/cli/parsers/build.rb +18 -0
- data/lib/rubysmith/cli/parsers/core.rb +8 -3
- data/lib/rubysmith/cli/shell.rb +3 -1
- data/lib/rubysmith/configuration/content.rb +9 -3
- data/lib/rubysmith/configuration/defaults.yml +10 -7
- data/lib/rubysmith/configuration/loader.rb +1 -1
- data/lib/rubysmith/container.rb +2 -0
- data/lib/rubysmith/extensions/milestoner.rb +9 -7
- data/lib/rubysmith/extensions/pragmater.rb +8 -7
- data/lib/rubysmith/extensions/tocer.rb +9 -7
- data/lib/rubysmith/renderers/erb.rb +9 -1
- data/lib/rubysmith/renderers/namespace.rb +3 -3
- data/lib/rubysmith/templates/%project_name%/.gitignore.erb +11 -0
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +9 -3
- data/lib/rubysmith/templates/%project_name%/Rakefile.erb +9 -0
- data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +5 -5
- data/rubysmith.gemspec +41 -0
- data.tar.gz.sig +0 -0
- metadata +30 -12
- metadata.gz.sig +2 -3
- data/lib/rubysmith/identity.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70dbc101555ee2f755af1202de17dd12c04bd5a427a483a3c2710bcedad4fdb5
|
4
|
+
data.tar.gz: 723ab4a9bee7cb81f5c46e5011704972922ec6c9d30e408b17935369a7034502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a735f251308fe224894d35cd6ec488fbb48296d2192371b1cefb7f0dfaaa2a4320cfeebcb91954c4ee6238ff35d3f962b9c5f59496d9c49a215bcbd6250c8bb
|
7
|
+
data.tar.gz: caa4eccf46c21ef081e46530ba780776895d9ee42b10fc87f2bcf43dd4e3ed5b99665a22f4eaf2490dafc44c22650ab67cd9507fa5af7c05202caa2d25bd2604
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -4,13 +4,6 @@
|
|
4
4
|
|
5
5
|
= Rubysmith
|
6
6
|
|
7
|
-
[link=http://badge.fury.io/rb/rubysmith]
|
8
|
-
image::https://badge.fury.io/rb/rubysmith.svg[Gem Version]
|
9
|
-
[link=https://www.alchemists.io/projects/code_quality]
|
10
|
-
image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
|
11
|
-
[link=https://circleci.com/gh/bkuhlmann/rubysmith]
|
12
|
-
image::https://circleci.com/gh/bkuhlmann/rubysmith.svg?style=svg[Circle CI Status]
|
13
|
-
|
14
7
|
Rubysmith is a command line interface for smithing Ruby projects.
|
15
8
|
|
16
9
|
This gem is useful in situations in which you need something more sophisticated than a
|
@@ -113,6 +106,7 @@ BUILD OPTIONS:
|
|
113
106
|
--[no-]setup Add setup script. Default: true.
|
114
107
|
--[no-]simple_cov Add SimpleCov gem. Default: true.
|
115
108
|
--[no-]versions Add version history. Default: true.
|
109
|
+
--[no-]yard Add Yard gem. Default: false.
|
116
110
|
--[no-]zeitwerk Add Zeitwerk gem. Default: true.
|
117
111
|
....
|
118
112
|
|
@@ -288,7 +282,7 @@ defining your project specifications and have a framework for testing your code.
|
|
288
282
|
|
289
283
|
==== Rubocop
|
290
284
|
|
291
|
-
The `--rubocop` option allows you to add the link:https://docs.rubocop.org[
|
285
|
+
The `--rubocop` option allows you to add the link:https://docs.rubocop.org[RuboCop] gem and suite
|
292
286
|
of gems to your project for good code quality standards. This the Alchemists style guide, provided
|
293
287
|
by the link:https://www.alchemists.io/projects/code_quality[Code Quality] project, is what is used
|
294
288
|
by default.
|
@@ -309,6 +303,13 @@ analysis of what your quality of code is for the project.
|
|
309
303
|
The `--versions` option allows you add a `VERSIONS` file to your project to provide details about
|
310
304
|
all published versions of your project.
|
311
305
|
|
306
|
+
==== YARD
|
307
|
+
|
308
|
+
The `--yard` option allows you add the link:https://yardoc.org/[YARD] gem to your project so you can
|
309
|
+
automate the generation of project documentation. Once your project is built, you can use `rake
|
310
|
+
yard` to build documentation into the `doc/yard` folder. This folder is ignored by Git by default.
|
311
|
+
Additional customization is possible via the YARD Rake task as found in the `Rakefile`.
|
312
|
+
|
312
313
|
==== Zeitwerk
|
313
314
|
|
314
315
|
The `--zeitwerk` option allows you add the link:https://github.com/fxn/zeitwerk[Zeitwerk] gem to
|
@@ -376,6 +377,7 @@ variables. The default configuration is as follows:
|
|
376
377
|
:setup: true
|
377
378
|
:simple_cov: true
|
378
379
|
:versions: true
|
380
|
+
:yard: false
|
379
381
|
:zeitwerk: true
|
380
382
|
:citation:
|
381
383
|
:affiliation:
|
@@ -398,15 +400,17 @@ variables. The default configuration is as follows:
|
|
398
400
|
:comments:
|
399
401
|
- "# frozen_string_literal: true"
|
400
402
|
:includes:
|
401
|
-
- "**/*.gemspec"
|
402
403
|
- "**/*.rake"
|
403
404
|
- "**/*.rb"
|
404
|
-
- "
|
405
|
-
- "
|
406
|
-
-
|
407
|
-
-
|
408
|
-
-
|
409
|
-
-
|
405
|
+
- "*.gemspec"
|
406
|
+
- "exe/*"
|
407
|
+
- bin/console
|
408
|
+
- bin/guard
|
409
|
+
- bin/rubocop
|
410
|
+
- config.ru
|
411
|
+
- Gemfile
|
412
|
+
- Guardfile
|
413
|
+
- Rakefile
|
410
414
|
:tocer:
|
411
415
|
:includes:
|
412
416
|
- "README.md"
|
@@ -457,10 +461,9 @@ custom values as desired. The URL is the only value that can't be automatically
|
|
457
461
|
|
458
462
|
==== Build
|
459
463
|
|
460
|
-
All build options
|
461
|
-
|
462
|
-
|
463
|
-
--help`). All of these options are explained in greater detail above.
|
464
|
+
All build options accept booleans values only and can be customized as desired. When changing your
|
465
|
+
build options, they will dynamically render when display usage (i.e. `rubysmith --help`). All of
|
466
|
+
these options are explained in greater detail above.
|
464
467
|
|
465
468
|
==== Citations
|
466
469
|
|
@@ -490,10 +493,10 @@ Follow the above links to learn more about each extension's gem configuration.
|
|
490
493
|
|
491
494
|
==== GitHub
|
492
495
|
|
493
|
-
Your GitHub user is
|
494
|
-
|
495
|
-
|
496
|
-
|
496
|
+
Your GitHub user is the handle you setup when creating your GitHub account. This information is used
|
497
|
+
for documentation purposes and Circle CI badge association. If you don't define this information,
|
498
|
+
Rubysmith will automatically fallback to pulling this information from your Git configuration (i.e.
|
499
|
+
`github.user`). If all else fails, then nothing will be used.
|
497
500
|
|
498
501
|
==== License
|
499
502
|
|
@@ -506,7 +509,7 @@ license are available:
|
|
506
509
|
|
507
510
|
==== Project
|
508
511
|
|
509
|
-
There are two
|
512
|
+
There are two categories within this section: URLs and version. The URLs allow you to link to
|
510
513
|
specific documentation related to your project. You'll definitely want to customize these as makes
|
511
514
|
sense since these URLs are used for documentation, citations, and general project information. You
|
512
515
|
can also use `%project_name%` as a placeholder anywhere in your URL and Rubysmith will ensure your
|
data/exe/rubysmith
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "refinements/strings"
|
3
4
|
require "refinements/structs"
|
4
5
|
|
5
6
|
module Rubysmith
|
6
7
|
module Builders
|
7
8
|
# Builds project skeleton core structure and minimum file support.
|
8
9
|
class Core
|
10
|
+
using Refinements::Strings
|
9
11
|
using Refinements::Structs
|
10
12
|
|
11
13
|
def self.call(...) = new(...).call
|
@@ -19,15 +21,20 @@ module Rubysmith
|
|
19
21
|
builder.call(configuration.merge(template_path: "%project_name%/lib/%project_path%.rb.erb"))
|
20
22
|
.render
|
21
23
|
.replace(" require", "require")
|
22
|
-
.replace(/ (?=(Zeit
|
24
|
+
.replace(/ (?=(Zeit|loader|end))/, "")
|
23
25
|
.replace("\n \n", "\n\n")
|
26
|
+
.insert_before("module #{module_name}", "#{indentation}# Main namespace.\n")
|
27
|
+
.replace("end\n end", " end\n end")
|
24
28
|
|
25
|
-
builder.call(configuration.merge(template_path: "%project_name%/.ruby-version.erb")).render
|
26
29
|
configuration
|
27
30
|
end
|
28
31
|
|
29
32
|
private
|
30
33
|
|
34
|
+
def indentation = "".indent configuration.project_levels
|
35
|
+
|
36
|
+
def module_name = configuration.project_class.split("::").last
|
37
|
+
|
31
38
|
attr_reader :configuration, :builder
|
32
39
|
end
|
33
40
|
end
|
@@ -31,8 +31,8 @@ module Rubysmith
|
|
31
31
|
|
32
32
|
def body
|
33
33
|
<<~CONTENT
|
34
|
-
Generated with [
|
35
|
-
|
34
|
+
Generated with [Rubysmith](https://www.alchemists.io/projects/rubysmith)
|
35
|
+
1.1.1.
|
36
36
|
CONTENT
|
37
37
|
end
|
38
38
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Git
|
8
|
+
# Builds Git repository directory and file ignore configuration.
|
9
|
+
class Ignore
|
10
|
+
using Refinements::Structs
|
11
|
+
|
12
|
+
def self.call(...) = new(...).call
|
13
|
+
|
14
|
+
def initialize configuration, builder: Builder
|
15
|
+
@configuration = configuration
|
16
|
+
@builder = builder
|
17
|
+
end
|
18
|
+
|
19
|
+
def call
|
20
|
+
return configuration unless configuration.build_git
|
21
|
+
|
22
|
+
builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
|
23
|
+
.render
|
24
|
+
.replace(" ", "")
|
25
|
+
|
26
|
+
configuration
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
attr_reader :configuration, :builder
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
# Builds project skeleton Ruby version file.
|
8
|
+
class Version
|
9
|
+
using Refinements::Structs
|
10
|
+
|
11
|
+
def self.call(...) = new(...).call
|
12
|
+
|
13
|
+
def initialize configuration, builder: Builder
|
14
|
+
@configuration = configuration
|
15
|
+
@builder = builder
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
builder.call(configuration.merge(template_path: "%project_name%/.ruby-version.erb")).render
|
20
|
+
configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :configuration, :builder
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -8,11 +8,13 @@ module Rubysmith
|
|
8
8
|
# Order is important.
|
9
9
|
BUILDERS = [
|
10
10
|
Builders::Core,
|
11
|
+
Builders::Version,
|
11
12
|
Builders::Documentation::Readme,
|
12
13
|
Builders::Documentation::Citation,
|
13
14
|
Builders::Documentation::License,
|
14
15
|
Builders::Documentation::Version,
|
15
16
|
Builders::Git::Setup,
|
17
|
+
Builders::Git::Ignore,
|
16
18
|
Builders::Bundler,
|
17
19
|
Builders::Rake,
|
18
20
|
Builders::Console,
|
@@ -239,6 +239,15 @@ module Rubysmith
|
|
239
239
|
end
|
240
240
|
end
|
241
241
|
|
242
|
+
def add_security
|
243
|
+
client.on(
|
244
|
+
"--[no-]security",
|
245
|
+
"Add security. #{default __method__}."
|
246
|
+
) do |value|
|
247
|
+
configuration.merge! build_security: value
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
242
251
|
def add_setup
|
243
252
|
client.on(
|
244
253
|
"--[no-]setup",
|
@@ -266,6 +275,15 @@ module Rubysmith
|
|
266
275
|
end
|
267
276
|
end
|
268
277
|
|
278
|
+
def add_yard
|
279
|
+
client.on(
|
280
|
+
"--[no-]yard",
|
281
|
+
"Add Yard gem. #{default __method__}."
|
282
|
+
) do |value|
|
283
|
+
configuration.merge! build_yard: value
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
269
287
|
def add_zeitwerk
|
270
288
|
client.on(
|
271
289
|
"--[no-]zeitwerk",
|
@@ -11,13 +11,16 @@ module Rubysmith
|
|
11
11
|
|
12
12
|
def self.call(...) = new(...).call
|
13
13
|
|
14
|
-
def initialize configuration = Container[:configuration],
|
14
|
+
def initialize configuration = Container[:configuration],
|
15
|
+
client: Parser::CLIENT,
|
16
|
+
container: Container
|
15
17
|
@configuration = configuration
|
16
18
|
@client = client
|
19
|
+
@container = container
|
17
20
|
end
|
18
21
|
|
19
22
|
def call arguments = []
|
20
|
-
client.banner =
|
23
|
+
client.banner = specification.labeled_summary
|
21
24
|
client.separator "\nUSAGE:\n"
|
22
25
|
collate
|
23
26
|
client.parse arguments
|
@@ -26,7 +29,7 @@ module Rubysmith
|
|
26
29
|
|
27
30
|
private
|
28
31
|
|
29
|
-
attr_reader :configuration, :client
|
32
|
+
attr_reader :configuration, :client, :container
|
30
33
|
|
31
34
|
def collate = private_methods.sort.grep(/add_/).each { |method| __send__ method }
|
32
35
|
|
@@ -62,6 +65,8 @@ module Rubysmith
|
|
62
65
|
configuration.merge! action_help: true
|
63
66
|
end
|
64
67
|
end
|
68
|
+
|
69
|
+
def specification = container[__method__]
|
65
70
|
end
|
66
71
|
end
|
67
72
|
end
|
data/lib/rubysmith/cli/shell.rb
CHANGED
@@ -33,7 +33,7 @@ module Rubysmith
|
|
33
33
|
in action_config: Symbol => action then config action
|
34
34
|
in action_build: true then build configuration
|
35
35
|
in action_publish: true then publish configuration
|
36
|
-
in action_version: true then logger.info
|
36
|
+
in action_version: true then logger.info { specification.labeled_version }
|
37
37
|
else usage
|
38
38
|
end
|
39
39
|
end
|
@@ -46,6 +46,8 @@ module Rubysmith
|
|
46
46
|
|
47
47
|
def usage = logger.unknown(parser.to_s)
|
48
48
|
|
49
|
+
def specification = container[__method__]
|
50
|
+
|
49
51
|
def logger = container[__method__]
|
50
52
|
end
|
51
53
|
end
|
@@ -12,9 +12,12 @@ module Rubysmith
|
|
12
12
|
Content = Struct.new(
|
13
13
|
:action_build,
|
14
14
|
:action_config,
|
15
|
+
:action_edit,
|
15
16
|
:action_help,
|
17
|
+
:action_install,
|
16
18
|
:action_publish,
|
17
19
|
:action_version,
|
20
|
+
:action_view,
|
18
21
|
:author_email,
|
19
22
|
:author_family_name,
|
20
23
|
:author_given_name,
|
@@ -47,6 +50,7 @@ module Rubysmith
|
|
47
50
|
:build_setup,
|
48
51
|
:build_simple_cov,
|
49
52
|
:build_versions,
|
53
|
+
:build_yard,
|
50
54
|
:build_zeitwerk,
|
51
55
|
:citation_affiliation,
|
52
56
|
:citation_message,
|
@@ -107,14 +111,16 @@ module Rubysmith
|
|
107
111
|
|
108
112
|
def license_label_version = [license_label, license_version].compress.join("-")
|
109
113
|
|
110
|
-
def project_label = project_name.titleize
|
111
|
-
|
112
114
|
def project_class = project_name.camelcase
|
113
115
|
|
114
|
-
def
|
116
|
+
def project_label = project_name.titleize
|
117
|
+
|
118
|
+
def project_levels = project_class.split("::").size - 1
|
115
119
|
|
116
120
|
def project_path = project_name.snakecase
|
117
121
|
|
122
|
+
def project_root = target_root.join(project_name)
|
123
|
+
|
118
124
|
def computed_project_url_community = format_url(__method__)
|
119
125
|
|
120
126
|
def computed_project_url_conduct = format_url(__method__)
|
@@ -32,6 +32,7 @@
|
|
32
32
|
:setup: true
|
33
33
|
:simple_cov: true
|
34
34
|
:versions: true
|
35
|
+
:yard: false
|
35
36
|
:zeitwerk: true
|
36
37
|
:citation:
|
37
38
|
:affiliation:
|
@@ -54,15 +55,17 @@
|
|
54
55
|
:comments:
|
55
56
|
- "# frozen_string_literal: true"
|
56
57
|
:includes:
|
57
|
-
- "**/*.gemspec"
|
58
58
|
- "**/*.rake"
|
59
59
|
- "**/*.rb"
|
60
|
-
- "
|
61
|
-
- "
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
60
|
+
- "*.gemspec"
|
61
|
+
- "exe/*"
|
62
|
+
- bin/console
|
63
|
+
- bin/guard
|
64
|
+
- bin/rubocop
|
65
|
+
- config.ru
|
66
|
+
- Gemfile
|
67
|
+
- Guardfile
|
68
|
+
- Rakefile
|
66
69
|
:tocer:
|
67
70
|
:includes:
|
68
71
|
- "README.md"
|
@@ -14,7 +14,7 @@ module Rubysmith
|
|
14
14
|
using Refinements::Structs
|
15
15
|
|
16
16
|
DEFAULTS = YAML.load_file(Pathname(__dir__).join("defaults.yml")).freeze
|
17
|
-
CLIENT = Runcom::Config.new "
|
17
|
+
CLIENT = Runcom::Config.new "rubysmith/configuration.yml", defaults: DEFAULTS
|
18
18
|
|
19
19
|
ENHANCERS = [
|
20
20
|
Enhancers::CurrentTime.new,
|
data/lib/rubysmith/container.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "dry-container"
|
4
4
|
require "logger"
|
5
5
|
require "pastel"
|
6
|
+
require "spek"
|
6
7
|
|
7
8
|
module Rubysmith
|
8
9
|
# Provides a global gem container for injection into other objects.
|
@@ -10,6 +11,7 @@ module Rubysmith
|
|
10
11
|
extend Dry::Container::Mixin
|
11
12
|
|
12
13
|
register(:configuration) { Configuration::Loader.call }
|
14
|
+
register(:specification) { Spek::Loader.call "#{__dir__}/../../rubysmith.gemspec" }
|
13
15
|
register(:colorizer) { Pastel.new enabled: $stdout.tty? }
|
14
16
|
register(:kernel) { Kernel }
|
15
17
|
|
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "milestoner"
|
4
|
+
require "refinements/structs"
|
4
5
|
|
5
6
|
module Rubysmith
|
6
7
|
module Extensions
|
7
8
|
# Ensures project can be published (tagged) in a reliable and consistent fashion.
|
8
9
|
class Milestoner
|
10
|
+
using Refinements::Structs
|
11
|
+
|
9
12
|
def self.call(...) = new(...).call
|
10
13
|
|
11
14
|
def initialize configuration,
|
12
15
|
client: ::Milestoner::Tags::Publisher.new,
|
13
|
-
content: ::Milestoner::Configuration::Content
|
16
|
+
content: ::Milestoner::Configuration::Content.new
|
14
17
|
@configuration = configuration
|
15
18
|
@client = client
|
16
19
|
@content = content
|
@@ -23,12 +26,11 @@ module Rubysmith
|
|
23
26
|
attr_reader :configuration, :client, :content
|
24
27
|
|
25
28
|
def settings
|
26
|
-
content
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
]
|
29
|
+
content.transmute configuration,
|
30
|
+
documentation_format: :extensions_milestoner_documentation_format,
|
31
|
+
prefixes: :extensions_milestoner_prefixes,
|
32
|
+
sign: :extensions_milestoner_sign,
|
33
|
+
version: :project_version
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -1,16 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "pragmater"
|
4
|
+
require "refinements/structs"
|
4
5
|
|
5
6
|
module Rubysmith
|
6
7
|
module Extensions
|
7
8
|
# Ensures project skeleton has pragmas.
|
8
9
|
class Pragmater
|
10
|
+
using Refinements::Structs
|
11
|
+
|
9
12
|
def self.call(...) = new(...).call
|
10
13
|
|
11
14
|
def initialize configuration,
|
12
15
|
client: ::Pragmater::Runner.new,
|
13
|
-
content: ::Pragmater::Configuration::Content
|
16
|
+
content: ::Pragmater::Configuration::Content.new
|
14
17
|
@configuration = configuration
|
15
18
|
@client = client
|
16
19
|
@content = content
|
@@ -23,12 +26,10 @@ module Rubysmith
|
|
23
26
|
attr_reader :configuration, :client, :content
|
24
27
|
|
25
28
|
def settings
|
26
|
-
content
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
root_dir: configuration.project_root
|
31
|
-
]
|
29
|
+
content.merge(action_insert: true, root_dir: configuration.project_root)
|
30
|
+
.transmute! configuration,
|
31
|
+
comments: :extensions_pragmater_comments,
|
32
|
+
includes: :extensions_pragmater_includes
|
32
33
|
end
|
33
34
|
end
|
34
35
|
end
|
@@ -1,23 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "tocer"
|
4
|
+
require "refinements/structs"
|
4
5
|
|
5
6
|
module Rubysmith
|
6
7
|
module Extensions
|
7
8
|
# Ensures project skeleton documentation has table of contents.
|
8
9
|
class Tocer
|
10
|
+
using Refinements::Structs
|
11
|
+
|
9
12
|
def self.call(...) = new(...).call
|
10
13
|
|
11
14
|
def initialize configuration,
|
12
15
|
client: ::Tocer::Runner.new,
|
13
|
-
content: ::Tocer::Configuration::Content
|
16
|
+
content: ::Tocer::Configuration::Content.new
|
14
17
|
@configuration = configuration
|
15
18
|
@client = client
|
16
19
|
@content = content
|
17
20
|
end
|
18
21
|
|
19
22
|
def call
|
20
|
-
client.call
|
23
|
+
client.call settings if configuration.build_readme
|
21
24
|
configuration
|
22
25
|
end
|
23
26
|
|
@@ -26,11 +29,10 @@ module Rubysmith
|
|
26
29
|
attr_reader :configuration, :client, :content
|
27
30
|
|
28
31
|
def settings
|
29
|
-
content
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
]
|
32
|
+
content.merge(root_dir: configuration.project_root)
|
33
|
+
.transmute! configuration,
|
34
|
+
includes: :extensions_tocer_includes,
|
35
|
+
label: :extensions_tocer_label
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -21,7 +21,15 @@ module Rubysmith
|
|
21
21
|
attr_accessor :buffer
|
22
22
|
attr_reader :configuration, :scope, :client
|
23
23
|
|
24
|
-
def namespace
|
24
|
+
def namespace
|
25
|
+
source = buffer.dup
|
26
|
+
|
27
|
+
self.buffer = source + if block_given?
|
28
|
+
scope.call yield.sub(source, "")
|
29
|
+
else
|
30
|
+
scope.call
|
31
|
+
end
|
32
|
+
end
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
@@ -8,10 +8,10 @@ module Rubysmith
|
|
8
8
|
class Namespace
|
9
9
|
using Refinements::Strings
|
10
10
|
|
11
|
-
def initialize namespace
|
11
|
+
def initialize namespace, delimiter: "::"
|
12
12
|
@namespace = namespace
|
13
|
-
@modules = namespace.split
|
14
|
-
@depth = namespace.scan(
|
13
|
+
@modules = namespace.split delimiter
|
14
|
+
@depth = namespace.scan(delimiter).length
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(content = nil) = "#{prefix}#{body content}#{suffix}"
|
@@ -3,7 +3,7 @@ ruby File.read(".ruby-version").strip
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
<% if configuration.build_refinements %>
|
6
|
-
gem "refinements", "~> 9.
|
6
|
+
gem "refinements", "~> 9.1"
|
7
7
|
<% end %>
|
8
8
|
<% if configuration.build_zeitwerk %>
|
9
9
|
gem "zeitwerk", "~> 2.5"
|
@@ -20,10 +20,10 @@ group :code_quality do
|
|
20
20
|
gem "git-lint", "~> 3.0"
|
21
21
|
<% end %>
|
22
22
|
<% if configuration.build_reek %>
|
23
|
-
gem "reek", "~> 6.
|
23
|
+
gem "reek", "~> 6.1"
|
24
24
|
<% end %>
|
25
25
|
<% if configuration.build_rubocop %>
|
26
|
-
gem "rubocop", "~> 1.
|
26
|
+
gem "rubocop", "~> 1.25"
|
27
27
|
gem "rubocop-performance", "~> 1.12"
|
28
28
|
gem "rubocop-rake", "~> 0.6"
|
29
29
|
<% end %>
|
@@ -36,12 +36,18 @@ group :code_quality do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
group :development do
|
39
|
+
<% if configuration.build_yard && configuration.ascii_doc? %>
|
40
|
+
gem "asciidoctor", "~> 2.0"
|
41
|
+
<% end %>
|
39
42
|
<% if configuration.build_rake %>
|
40
43
|
gem "rake", "~> 13.0"
|
41
44
|
<% end %>
|
42
45
|
<% if configuration.markdown? %>
|
43
46
|
gem "tocer", "~> 13.0"
|
44
47
|
<% end %>
|
48
|
+
<% if configuration.build_yard %>
|
49
|
+
gem "yard", "~> 0.9"
|
50
|
+
<% end %>
|
45
51
|
end
|
46
52
|
|
47
53
|
group :test do
|
@@ -15,6 +15,9 @@ require "bundler/setup"
|
|
15
15
|
<% if configuration.build_rubocop %>
|
16
16
|
require "rubocop/rake_task"
|
17
17
|
<% end %>
|
18
|
+
<% if configuration.build_yard %>
|
19
|
+
require "yard"
|
20
|
+
<% end %>
|
18
21
|
|
19
22
|
<% if configuration.build_bundler_leak %>
|
20
23
|
Bundler::Plumber::Task.new
|
@@ -29,6 +32,12 @@ require "bundler/setup"
|
|
29
32
|
RuboCop::RakeTask.new
|
30
33
|
<% end %>
|
31
34
|
|
35
|
+
<% if configuration.build_yard %>
|
36
|
+
YARD::Rake::YardocTask.new do |task|
|
37
|
+
task.options = ["--title", "<%= configuration.project_label %>", "--output-dir", "doc/yard"]
|
38
|
+
end
|
39
|
+
<% end %>
|
40
|
+
|
32
41
|
desc "Run code quality checks"
|
33
42
|
task code_quality: %i[<% if configuration.build_bundler_leak %>bundle:leak<% end %> <% if configuration.build_git && configuration.build_git_lint %>git_lint<% end %> <% if configuration.build_reek %>reek<% end %> <% if configuration.build_rubocop %>rubocop<% end %>]
|
34
43
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
<% if configuration.build_zeitwerk %>
|
2
2
|
require "zeitwerk"
|
3
|
-
<% if configuration.
|
4
|
-
Zeitwerk::Loader.new
|
5
|
-
|
6
|
-
|
3
|
+
<% if configuration.project_levels.positive? %>
|
4
|
+
Zeitwerk::Loader.new.then do |loader|
|
5
|
+
loader.push_dir "#{__dir__}<%= Array.new(configuration.project_levels, "/..").join %>"
|
6
|
+
loader.setup
|
7
|
+
end
|
7
8
|
<% else %>
|
8
9
|
Zeitwerk::Loader.for_gem.setup
|
9
10
|
<% end %>
|
10
11
|
<% end %>
|
11
|
-
# Main namespace.
|
12
12
|
<% namespace %>
|
data/rubysmith.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "rubysmith"
|
5
|
+
spec.version = "1.3.0"
|
6
|
+
spec.authors = ["Brooke Kuhlmann"]
|
7
|
+
spec.email = ["brooke@alchemists.io"]
|
8
|
+
spec.homepage = "https://github.com/bkuhlmann/rubysmith"
|
9
|
+
spec.summary = "A command line interface for smithing Ruby projects."
|
10
|
+
spec.license = "Hippocratic-3.0"
|
11
|
+
|
12
|
+
spec.metadata = {
|
13
|
+
"bug_tracker_uri" => "https://github.com/bkuhlmann/rubysmith/issues",
|
14
|
+
"changelog_uri" => "https://www.alchemists.io/projects/rubysmith/versions",
|
15
|
+
"documentation_uri" => "https://www.alchemists.io/projects/rubysmith",
|
16
|
+
"label" => "Rubysmith",
|
17
|
+
"rubygems_mfa_required" => "true",
|
18
|
+
"source_code_uri" => "https://github.com/bkuhlmann/rubysmith"
|
19
|
+
}
|
20
|
+
|
21
|
+
spec.signing_key = Gem.default_key_path
|
22
|
+
spec.cert_chain = [Gem.default_cert_path]
|
23
|
+
|
24
|
+
spec.required_ruby_version = "~> 3.1"
|
25
|
+
spec.add_dependency "dry-container", "~> 0.9"
|
26
|
+
spec.add_dependency "git_plus", "~> 1.1"
|
27
|
+
spec.add_dependency "milestoner", "~> 13.0"
|
28
|
+
spec.add_dependency "pastel", "~> 0.8"
|
29
|
+
spec.add_dependency "pragmater", "~> 10.0"
|
30
|
+
spec.add_dependency "refinements", "~> 9.1"
|
31
|
+
spec.add_dependency "rubocop", "~> 1.25"
|
32
|
+
spec.add_dependency "runcom", "~> 8.2"
|
33
|
+
spec.add_dependency "spek", "~> 0.0"
|
34
|
+
spec.add_dependency "tocer", "~> 13.0"
|
35
|
+
spec.add_dependency "zeitwerk", "~> 2.5"
|
36
|
+
|
37
|
+
spec.bindir = "exe"
|
38
|
+
spec.executables << "rubysmith"
|
39
|
+
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
40
|
+
spec.files = Dir.glob ["*.gemspec", "lib/**/*"], File::FNM_DOTMATCH
|
41
|
+
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
|
29
29
|
W2A=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2022-
|
31
|
+
date: 2022-02-06 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: dry-container
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1.
|
53
|
+
version: '1.1'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '1.
|
60
|
+
version: '1.1'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: milestoner
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,42 +106,56 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '9.
|
109
|
+
version: '9.1'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '9.
|
116
|
+
version: '9.1'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: rubocop
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '1.
|
123
|
+
version: '1.25'
|
124
124
|
type: :runtime
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '1.
|
130
|
+
version: '1.25'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: runcom
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '8.
|
137
|
+
version: '8.2'
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '8.
|
144
|
+
version: '8.2'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: spek
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0.0'
|
152
|
+
type: :runtime
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0.0'
|
145
159
|
- !ruby/object:Gem::Dependency
|
146
160
|
name: tocer
|
147
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,6 +208,7 @@ files:
|
|
194
208
|
- lib/rubysmith/builders/documentation/readme.rb
|
195
209
|
- lib/rubysmith/builders/documentation/version.rb
|
196
210
|
- lib/rubysmith/builders/git/commit.rb
|
211
|
+
- lib/rubysmith/builders/git/ignore.rb
|
197
212
|
- lib/rubysmith/builders/git/setup.rb
|
198
213
|
- lib/rubysmith/builders/git_hub.rb
|
199
214
|
- lib/rubysmith/builders/guard.rb
|
@@ -203,6 +218,7 @@ files:
|
|
203
218
|
- lib/rubysmith/builders/rspec/helper.rb
|
204
219
|
- lib/rubysmith/builders/rubocop.rb
|
205
220
|
- lib/rubysmith/builders/setup.rb
|
221
|
+
- lib/rubysmith/builders/version.rb
|
206
222
|
- lib/rubysmith/cli/actions/build.rb
|
207
223
|
- lib/rubysmith/cli/actions/config.rb
|
208
224
|
- lib/rubysmith/cli/actions/publish.rb
|
@@ -223,13 +239,13 @@ files:
|
|
223
239
|
- lib/rubysmith/extensions/pragmater.rb
|
224
240
|
- lib/rubysmith/extensions/rubocop.rb
|
225
241
|
- lib/rubysmith/extensions/tocer.rb
|
226
|
-
- lib/rubysmith/identity.rb
|
227
242
|
- lib/rubysmith/pathway.rb
|
228
243
|
- lib/rubysmith/renderers/erb.rb
|
229
244
|
- lib/rubysmith/renderers/namespace.rb
|
230
245
|
- lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb
|
231
246
|
- lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb
|
232
247
|
- lib/rubysmith/templates/%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb
|
248
|
+
- lib/rubysmith/templates/%project_name%/.gitignore.erb
|
233
249
|
- lib/rubysmith/templates/%project_name%/.reek.yml.erb
|
234
250
|
- lib/rubysmith/templates/%project_name%/.rubocop.yml.erb
|
235
251
|
- lib/rubysmith/templates/%project_name%/.ruby-version.erb
|
@@ -255,6 +271,7 @@ files:
|
|
255
271
|
- lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb
|
256
272
|
- lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb
|
257
273
|
- lib/rubysmith/text/inserter.rb
|
274
|
+
- rubysmith.gemspec
|
258
275
|
homepage: https://github.com/bkuhlmann/rubysmith
|
259
276
|
licenses:
|
260
277
|
- Hippocratic-3.0
|
@@ -262,6 +279,7 @@ metadata:
|
|
262
279
|
bug_tracker_uri: https://github.com/bkuhlmann/rubysmith/issues
|
263
280
|
changelog_uri: https://www.alchemists.io/projects/rubysmith/versions
|
264
281
|
documentation_uri: https://www.alchemists.io/projects/rubysmith
|
282
|
+
label: Rubysmith
|
265
283
|
rubygems_mfa_required: 'true'
|
266
284
|
source_code_uri: https://github.com/bkuhlmann/rubysmith
|
267
285
|
post_install_message:
|
@@ -279,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
297
|
- !ruby/object:Gem::Version
|
280
298
|
version: '0'
|
281
299
|
requirements: []
|
282
|
-
rubygems_version: 3.3.
|
300
|
+
rubygems_version: 3.3.6
|
283
301
|
signing_key:
|
284
302
|
specification_version: 4
|
285
303
|
summary: A command line interface for smithing Ruby projects.
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
���
|
2
|
-
�
|
3
|
-
���˪DS����R_���� \hq>hapZWң!��ucӯ�C�
|
1
|
+
Y�`l8�e�wU0Y��aX.�������m����A4�WOU��4�[Ѷy�_�a[䈟�ơ��s�. �Rhy���V�#T�rT�"��rB���v+>g��Tb���i��.o��.��$�T��<�SM�(e�-���n�Q
|
2
|
+
V:�\���o��idQIK6�H 3c�Ir\�zArN~3�
|
data/lib/rubysmith/identity.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Rubysmith
|
4
|
-
module Identity
|
5
|
-
NAME = "rubysmith"
|
6
|
-
LABEL = "Rubysmith"
|
7
|
-
VERSION = "1.0.0"
|
8
|
-
VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
|
9
|
-
SUMMARY = "A command line interface for smithing Ruby projects."
|
10
|
-
end
|
11
|
-
end
|