gemsmith 19.8.0 → 20.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +28 -52
- data/gemsmith.gemspec +12 -9
- data/lib/gemsmith/builders/cli.rb +6 -25
- data/lib/gemsmith/builders/rspec/helper.rb +3 -16
- data/lib/gemsmith/cli/actions/cli.rb +22 -0
- data/lib/gemsmith/cli/actions/edit.rb +9 -4
- data/lib/gemsmith/cli/actions/install.rb +17 -6
- data/lib/gemsmith/cli/actions/publish.rb +17 -6
- data/lib/gemsmith/cli/actions/view.rb +9 -4
- data/lib/gemsmith/cli/commands/build.rb +106 -0
- data/lib/gemsmith/cli/shell.rb +28 -32
- data/lib/gemsmith/container.rb +29 -5
- data/lib/gemsmith/templates/%project_name%/%project_name%.gemspec.erb +13 -7
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb +18 -15
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/contract.rb.erb +9 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/model.rb.erb +6 -0
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/container.rb.erb +14 -1
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb +8 -23
- data/lib/gemsmith/templates/%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb +5 -7
- data/lib/gemsmith/tools/versioner.rb +8 -8
- data.tar.gz.sig +0 -0
- metadata +65 -40
- metadata.gz.sig +0 -0
- data/lib/gemsmith/cli/actions/build.rb +0 -68
- data/lib/gemsmith/cli/actions/config.rb +0 -33
- data/lib/gemsmith/cli/actions/container.rb +0 -23
- data/lib/gemsmith/cli/actions/import.rb +0 -11
- data/lib/gemsmith/cli/parser.rb +0 -37
- data/lib/gemsmith/cli/parsers/build.rb +0 -53
- data/lib/gemsmith/cli/parsers/core.rb +0 -93
- data/lib/gemsmith/configuration/loader.rb +0 -27
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/config.rb.erb +0 -31
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/container.rb.erb +0 -16
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/actions/import.rb.erb +0 -9
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/parser.rb.erb +0 -35
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/parsers/core.rb.erb +0 -58
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/content.rb.erb +0 -18
- data/lib/gemsmith/templates/%project_name%/lib/%project_path%/configuration/loader.rb.erb +0 -33
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/actions/config_spec.rb.erb +0 -24
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parser_spec.rb.erb +0 -25
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parsers/core_spec.rb.erb +0 -53
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/configuration/content_spec.rb.erb +0 -15
- data/lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/configuration/loader_spec.rb.erb +0 -29
- data/lib/gemsmith/templates/%project_name%/spec/support/shared_examples/a_parser.rb.erb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e0b2d89efd43adce74b6fbed669777763f954f2b0b6f0f0c5832f12d2f8d883
|
4
|
+
data.tar.gz: a17145a647271cd6286b72b5c52574c34ab613e012a35b147223cb12109554b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46aa1cc207d47fe6c768d8b4f581992536166126df49944b2de2b249bb56923e22e28fd969c799e5c3e2e7e58c8ad7a2dbf858af4a59652377c0c106de8085da
|
7
|
+
data.tar.gz: d074cba35efa1a8b40c6c58225a4ffbc8ad317d05838e906e4ffc6d94cb9395973800bea861ef1c85be2f9074fba1e0ec6804152c8a1be148b8beb45178613d5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
:figure-caption!:
|
4
4
|
|
5
5
|
:ruby_gems_link: link:https://rubygems.org[RubyGems]
|
6
|
+
:sod_link: link:https://alchemists.io/projects/sod[Sod]
|
6
7
|
|
7
8
|
= Gemsmith
|
8
9
|
|
@@ -17,7 +18,7 @@ toc::[]
|
|
17
18
|
== Features
|
18
19
|
|
19
20
|
* Supports all link:https://alchemists.io/projects/rubysmith[Rubysmith] features.
|
20
|
-
* Supports basic gem
|
21
|
+
* Supports basic gem or more advanced {sod_link}-based Command Line Interface (CLI) skeletons.
|
21
22
|
* Supports gem building, installing for local development, and publishing.
|
22
23
|
* Supports the editing and viewing of installed gems.
|
23
24
|
|
@@ -52,52 +53,30 @@ gem install gemsmith
|
|
52
53
|
From the command line, type: `gemsmith --help`
|
53
54
|
|
54
55
|
....
|
55
|
-
USAGE
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
-i, --install [
|
61
|
-
|
62
|
-
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
--[no-]debug Add Debug gem. Default: true.
|
75
|
-
--[no-]funding Add GitHub funding configuration. Default: false.
|
76
|
-
--[no-]git Add Git. Default: true.
|
77
|
-
--[no-]git_hub Add GitHub templates. Default: false.
|
78
|
-
--[no-]git_hub_ci Add GitHub templates. Default: false.
|
79
|
-
--[no-]git-lint Add Git Lint gem. Default: true.
|
80
|
-
--[no-]guard Add Guard gem. Default: true.
|
81
|
-
--[no-]license Add license documentation. Default: true.
|
82
|
-
--max Use maximum/enabled options. Default: false.
|
83
|
-
--min Use minimum/disabled options. Default: false.
|
84
|
-
--[no-]rake Add Rake gem. Default: true.
|
85
|
-
--[no-]readme Add readme documentation. Default: true.
|
86
|
-
--[no-]reek Add Reek gem. Default: true.
|
87
|
-
--[no-]refinements Add Refinements gem. Default: true.
|
88
|
-
--[no-]rspec Add RSpec gem. Default: true.
|
89
|
-
--[no-]security Add security. Default: true.
|
90
|
-
--[no-]setup Add setup script. Default: true.
|
91
|
-
--[no-]simple_cov Add SimpleCov gem. Default: true.
|
92
|
-
--[no-]versions Add version history. Default: true.
|
93
|
-
--[no-]yard Add Yard gem. Default: false.
|
94
|
-
--[no-]zeitwerk Add Zeitwerk gem. Default: true.
|
95
|
-
--[no-]cli Add command line interface. Default: false.
|
56
|
+
USAGE
|
57
|
+
gemsmith [OPTIONS]
|
58
|
+
gemsmith COMMAND [OPTIONS]
|
59
|
+
|
60
|
+
OPTIONS
|
61
|
+
-i, --install [GEM] Install gem for local development.
|
62
|
+
Optionally computes gem package based on current directory.
|
63
|
+
-p, --publish [GEM] Publish gem to remote gem server.
|
64
|
+
Optionally computes gem package based on current directory.
|
65
|
+
Default: gemsmith.
|
66
|
+
-e, --edit GEM Edit installed gem in default editor.
|
67
|
+
-V, --view GEM View installed gem in default browser.
|
68
|
+
-v, --version Show version.
|
69
|
+
-h, --help [COMMAND] Show this message.
|
70
|
+
|
71
|
+
COMMANDS
|
72
|
+
config Manage configuration.
|
73
|
+
Path is dynamic per current directory.
|
74
|
+
build Build new project.
|
96
75
|
....
|
97
76
|
|
98
77
|
==== Build
|
99
78
|
|
100
|
-
The core functionality of this gem centers around the
|
79
|
+
The core functionality of this gem centers around the `build` command and associated flags. The
|
101
80
|
build options allow you to further customize the kind of gem you want to build. Most build options
|
102
81
|
are enabled by default. For detailed documentation on all supported flags, see the
|
103
82
|
link:https://alchemists.io/projects/rubysmith/#_build[Rubysmith] documentation.
|
@@ -111,7 +90,7 @@ simple as running:
|
|
111
90
|
|
112
91
|
[source,bash]
|
113
92
|
----
|
114
|
-
gemsmith
|
93
|
+
gemsmith build --name demo --cli
|
115
94
|
----
|
116
95
|
|
117
96
|
The above will give you a new gem with CLI support which includes working specs. It's the same
|
@@ -120,9 +99,9 @@ configuring your gem and adding additional CLI support. Out of the box, the CLI
|
|
120
99
|
you supports the following options:
|
121
100
|
|
122
101
|
....
|
123
|
-
-
|
124
|
-
-h, --help
|
125
|
-
|
102
|
+
-v, --version Show version.
|
103
|
+
-h, --help Show this message.
|
104
|
+
config Manage configuration.
|
126
105
|
....
|
127
106
|
|
128
107
|
From here you can add whatever you wish to make an awesome CLI gem for others to enjoy.
|
@@ -221,9 +200,6 @@ the following:
|
|
221
200
|
:cli: false
|
222
201
|
----
|
223
202
|
|
224
|
-
Feel free to take the combined Rubysmith + Gemsmith configuration, modify, and save as your own
|
225
|
-
custom `configuration.yml`.
|
226
|
-
|
227
203
|
It is recommended that you provide URLs for your project which would be all keys found in this
|
228
204
|
section:
|
229
205
|
|
@@ -245,7 +221,7 @@ When building/testing your gem locally, a typical workflow is:
|
|
245
221
|
[source,bash]
|
246
222
|
----
|
247
223
|
# Build
|
248
|
-
gemsmith
|
224
|
+
gemsmith build --name demo
|
249
225
|
|
250
226
|
# Design, Implement and Test.
|
251
227
|
cd demo
|
@@ -303,7 +279,7 @@ To create a certificate for your gems, run the following:
|
|
303
279
|
[source,bash]
|
304
280
|
----
|
305
281
|
cd ~/.gem
|
306
|
-
gem cert
|
282
|
+
gem cert build you@example.com --days 730
|
307
283
|
gem cert --add gem-public_cert.pem
|
308
284
|
cp gem-public_cert.pem <path/to/server/public/folder>/gems.pem
|
309
285
|
----
|
data/gemsmith.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "gemsmith"
|
5
|
-
spec.version = "
|
5
|
+
spec.version = "20.0.0"
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
8
8
|
spec.homepage = "https://alchemists.io/projects/gemsmith"
|
@@ -23,17 +23,20 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.cert_chain = [Gem.default_cert_path]
|
24
24
|
|
25
25
|
spec.required_ruby_version = "~> 3.2"
|
26
|
-
spec.add_dependency "cogger", "~> 0.
|
26
|
+
spec.add_dependency "cogger", "~> 0.10"
|
27
27
|
spec.add_dependency "core", "~> 0.1"
|
28
28
|
spec.add_dependency "dry-container", "~> 0.11"
|
29
29
|
spec.add_dependency "dry-monads", "~> 1.6"
|
30
|
-
spec.add_dependency "
|
31
|
-
spec.add_dependency "
|
32
|
-
spec.add_dependency "
|
33
|
-
spec.add_dependency "
|
34
|
-
spec.add_dependency "
|
35
|
-
spec.add_dependency "
|
36
|
-
spec.add_dependency "
|
30
|
+
spec.add_dependency "dry-schema", "~> 1.13"
|
31
|
+
spec.add_dependency "etcher", "~> 0.2"
|
32
|
+
spec.add_dependency "infusible", "~> 2.0"
|
33
|
+
spec.add_dependency "milestoner", "~> 16.0"
|
34
|
+
spec.add_dependency "refinements", "~> 11.0"
|
35
|
+
spec.add_dependency "rubysmith", "~> 5.1"
|
36
|
+
spec.add_dependency "runcom", "~> 10.0"
|
37
|
+
spec.add_dependency "sod", "~> 0.0"
|
38
|
+
spec.add_dependency "spek", "~> 2.0"
|
39
|
+
spec.add_dependency "versionaire", "~> 12.0"
|
37
40
|
spec.add_dependency "zeitwerk", "~> 2.6"
|
38
41
|
|
39
42
|
spec.bindir = "exe"
|
@@ -49,44 +49,25 @@ module Gemsmith
|
|
49
49
|
|
50
50
|
def render_configuration
|
51
51
|
[
|
52
|
-
"%project_name%/lib/%project_path%/configuration/
|
52
|
+
"%project_name%/lib/%project_path%/configuration/contract.rb.erb",
|
53
|
+
"%project_name%/lib/%project_path%/configuration/model.rb.erb",
|
53
54
|
"%project_name%/lib/%project_path%/configuration/defaults.yml.erb",
|
54
|
-
"%project_name%/lib/%project_path%/configuration/loader.rb.erb",
|
55
55
|
"%project_name%/lib/%project_path%/container.rb.erb",
|
56
56
|
"%project_name%/lib/%project_path%/import.rb.erb"
|
57
57
|
].each { |path| builder.call(configuration.merge(template_path: path)).render }
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
63
|
-
"%project_name%/lib/%project_path%/cli/actions/container.rb.erb",
|
64
|
-
"%project_name%/lib/%project_path%/cli/actions/import.rb.erb",
|
65
|
-
"%project_name%/lib/%project_path%/cli/parser.rb.erb",
|
66
|
-
"%project_name%/lib/%project_path%/cli/parsers/core.rb.erb",
|
67
|
-
"%project_name%/lib/%project_path%/cli/shell.rb.erb"
|
68
|
-
].each { |path| builder.call(configuration.merge(template_path: path)).render }
|
60
|
+
def render_shell
|
61
|
+
path = "%project_name%/lib/%project_path%/cli/shell.rb.erb"
|
62
|
+
builder.call(configuration.merge(template_path: path)).render
|
69
63
|
end
|
70
64
|
|
71
65
|
def render_specs
|
72
66
|
return unless configuration.build_rspec
|
73
67
|
|
74
68
|
[
|
75
|
-
"%project_name%/spec/lib/%project_path%/cli/actions/config_spec.rb.erb",
|
76
|
-
"%project_name%/spec/lib/%project_path%/cli/parser_spec.rb.erb",
|
77
|
-
"%project_name%/spec/lib/%project_path%/cli/parsers/core_spec.rb.erb",
|
78
69
|
"%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb",
|
79
|
-
"%project_name%/spec/
|
80
|
-
"%project_name%/spec/lib/%project_path%/configuration/loader_spec.rb.erb"
|
81
|
-
].each { |path| builder.call(configuration.merge(template_path: path)).render }
|
82
|
-
end
|
83
|
-
|
84
|
-
def render_rspec_support
|
85
|
-
return unless configuration.build_rspec
|
86
|
-
|
87
|
-
[
|
88
|
-
"%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb",
|
89
|
-
"%project_name%/spec/support/shared_examples/a_parser.rb.erb"
|
70
|
+
"%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb"
|
90
71
|
].each { |path| builder.call(configuration.merge(template_path: path)).render }
|
91
72
|
end
|
92
73
|
end
|
@@ -19,28 +19,15 @@ module Gemsmith
|
|
19
19
|
def call
|
20
20
|
return configuration unless configuration.build_rspec && configuration.build_cli
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
builder.call(configuration.merge(template_path: "%project_name%/spec/spec_helper.rb.erb"))
|
23
|
+
.touch
|
24
|
+
.replace("%r(^/spec/)", "%r((.+/container\\.rb|^/spec/))")
|
24
25
|
configuration
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
28
29
|
|
29
30
|
attr_reader :configuration, :builder
|
30
|
-
|
31
|
-
def update_spec_helper
|
32
|
-
builder.call(configuration.merge(template_path: "%project_name%/spec/spec_helper.rb.erb"))
|
33
|
-
.touch
|
34
|
-
.insert_after(
|
35
|
-
%r(support/shared_contexts),
|
36
|
-
%(Pathname.require_tree SPEC_ROOT.join("support/shared_examples")\n)
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
def render_shared_example
|
41
|
-
path = "%project_name%/spec/support/shared_examples/a_parser.rb.erb"
|
42
|
-
builder.call(configuration.merge(template_path: path)).render
|
43
|
-
end
|
44
31
|
end
|
45
32
|
end
|
46
33
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Gemsmith
|
6
|
+
module CLI
|
7
|
+
module Actions
|
8
|
+
# Stores CLI flag.
|
9
|
+
class CLI < Sod::Action
|
10
|
+
include Import[:input]
|
11
|
+
|
12
|
+
description "Add command line interface."
|
13
|
+
|
14
|
+
on "--[no-]cli"
|
15
|
+
|
16
|
+
default { Container[:configuration].build_cli }
|
17
|
+
|
18
|
+
def call(value = default) = input.build_cli = value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,16 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
+
require "sod"
|
4
5
|
require "spek"
|
5
6
|
|
6
7
|
module Gemsmith
|
7
8
|
module CLI
|
8
9
|
module Actions
|
9
10
|
# Handles the edit action for editing an installed gem.
|
10
|
-
class Edit
|
11
|
+
class Edit < Sod::Action
|
11
12
|
include Gemsmith::Import[:kernel, :logger]
|
12
13
|
include Dry::Monads[:result]
|
13
14
|
|
15
|
+
description "Edit installed gem in default editor."
|
16
|
+
|
17
|
+
on %w[-e --edit], argument: "GEM"
|
18
|
+
|
14
19
|
def initialize(picker: Spek::Picker, editor: Tools::Editor.new, **)
|
15
20
|
super(**)
|
16
21
|
@picker = picker
|
@@ -20,8 +25,8 @@ module Gemsmith
|
|
20
25
|
def call gem_name
|
21
26
|
case picker.call(gem_name).bind { |spec| editor.call spec }
|
22
27
|
in Success(spec) then logger.info { "Editing: #{spec.named_version}." }
|
23
|
-
in Failure(message) then
|
24
|
-
else
|
28
|
+
in Failure(message) then log_error { message }
|
29
|
+
else log_error { "Unable to handle edit action." }
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
@@ -29,7 +34,7 @@ module Gemsmith
|
|
29
34
|
|
30
35
|
attr_reader :picker, :editor
|
31
36
|
|
32
|
-
def
|
37
|
+
def log_error(&) = logger.error(&)
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
@@ -1,27 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
+
require "pathname"
|
5
|
+
require "sod"
|
4
6
|
require "spek"
|
5
7
|
|
6
8
|
module Gemsmith
|
7
9
|
module CLI
|
8
10
|
module Actions
|
9
11
|
# Handles the install action.
|
10
|
-
class Install
|
12
|
+
class Install < Sod::Action
|
11
13
|
include Gemsmith::Import[:logger]
|
12
14
|
include Dry::Monads[:result]
|
13
15
|
|
16
|
+
description "Install gem for local development."
|
17
|
+
|
18
|
+
ancillary "Optionally computes gem package based on current directory."
|
19
|
+
|
20
|
+
on %w[-i --install], argument: "[GEM]"
|
21
|
+
|
22
|
+
default { Pathname.pwd.basename }
|
23
|
+
|
14
24
|
def initialize(installer: Tools::Installer.new, loader: Spek::Loader, **)
|
15
25
|
super(**)
|
16
26
|
@installer = installer
|
17
27
|
@loader = loader
|
18
28
|
end
|
19
29
|
|
20
|
-
|
21
|
-
|
30
|
+
# :reek:ControlParameter
|
31
|
+
def call name = nil
|
32
|
+
case installer.call loader.call("#{name || default}.gemspec")
|
22
33
|
in Success(spec) then logger.info { "Installed: #{spec.package_name}." }
|
23
|
-
in Failure(message) then
|
24
|
-
else
|
34
|
+
in Failure(message) then log_error { message }
|
35
|
+
else log_error { "Unable to handle install action." }
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
@@ -29,7 +40,7 @@ module Gemsmith
|
|
29
40
|
|
30
41
|
attr_reader :installer, :loader
|
31
42
|
|
32
|
-
def
|
43
|
+
def log_error(&) = logger.error(&)
|
33
44
|
end
|
34
45
|
end
|
35
46
|
end
|
@@ -1,27 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
+
require "pathname"
|
5
|
+
require "sod"
|
4
6
|
require "spek"
|
5
7
|
|
6
8
|
module Gemsmith
|
7
9
|
module CLI
|
8
10
|
module Actions
|
9
11
|
# Handles the publish action.
|
10
|
-
class Publish
|
12
|
+
class Publish < Sod::Action
|
11
13
|
include Gemsmith::Import[:logger]
|
12
14
|
include Dry::Monads[:result]
|
13
15
|
|
16
|
+
description "Publish gem to remote gem server."
|
17
|
+
|
18
|
+
ancillary "Optionally computes gem package based on current directory."
|
19
|
+
|
20
|
+
on %w[-p --publish], argument: "[GEM]"
|
21
|
+
|
22
|
+
default { Pathname.pwd.basename }
|
23
|
+
|
14
24
|
def initialize(publisher: Tools::Publisher.new, loader: Spek::Loader, **)
|
15
25
|
super(**)
|
16
26
|
@publisher = publisher
|
17
27
|
@loader = loader
|
18
28
|
end
|
19
29
|
|
20
|
-
|
21
|
-
|
30
|
+
# :reek:ControlParameter
|
31
|
+
def call name = nil
|
32
|
+
case publisher.call loader.call("#{name || default}.gemspec")
|
22
33
|
in Success(spec) then logger.info { "Published: #{spec.package_name}." }
|
23
|
-
in Failure(message) then
|
24
|
-
else
|
34
|
+
in Failure(message) then log_error { message }
|
35
|
+
else log_error { "Unable to handle publish action." }
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
@@ -29,7 +40,7 @@ module Gemsmith
|
|
29
40
|
|
30
41
|
attr_reader :publisher, :loader
|
31
42
|
|
32
|
-
def
|
43
|
+
def log_error(&) = logger.error(&)
|
33
44
|
end
|
34
45
|
end
|
35
46
|
end
|
@@ -1,16 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/monads"
|
4
|
+
require "sod"
|
4
5
|
require "spek"
|
5
6
|
|
6
7
|
module Gemsmith
|
7
8
|
module CLI
|
8
9
|
module Actions
|
9
10
|
# Handles the view action for viewing an installed gem in default browser.
|
10
|
-
class View
|
11
|
+
class View < Sod::Action
|
11
12
|
include Gemsmith::Import[:kernel, :logger]
|
12
13
|
include Dry::Monads[:result]
|
13
14
|
|
15
|
+
description "View installed gem in default browser."
|
16
|
+
|
17
|
+
on %w[-V --view], argument: "GEM"
|
18
|
+
|
14
19
|
def initialize(picker: Spek::Picker, viewer: Tools::Viewer.new, **)
|
15
20
|
super(**)
|
16
21
|
@picker = picker
|
@@ -20,8 +25,8 @@ module Gemsmith
|
|
20
25
|
def call gem_name
|
21
26
|
case picker.call(gem_name).bind { |spec| viewer.call spec }
|
22
27
|
in Success(spec) then logger.info { "Viewing: #{spec.named_version}." }
|
23
|
-
in Failure(message) then
|
24
|
-
else
|
28
|
+
in Failure(message) then log_error { message }
|
29
|
+
else log_error { "Unable to handle view action." }
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
@@ -29,7 +34,7 @@ module Gemsmith
|
|
29
34
|
|
30
35
|
attr_reader :picker, :viewer
|
31
36
|
|
32
|
-
def
|
37
|
+
def log_error(&) = logger.error(&)
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sod"
|
4
|
+
|
5
|
+
module Gemsmith
|
6
|
+
module CLI
|
7
|
+
module Commands
|
8
|
+
# Handles the build action.
|
9
|
+
class Build < Sod::Command
|
10
|
+
include Gemsmith::Import[:input, :logger]
|
11
|
+
|
12
|
+
# Order is important.
|
13
|
+
# rubocop:todo Metrics/CollectionLiteralLength
|
14
|
+
BUILDERS = [
|
15
|
+
Rubysmith::Builders::Core,
|
16
|
+
Rubysmith::Builders::Version,
|
17
|
+
Builders::Specification,
|
18
|
+
Rubysmith::Builders::Documentation::Readme,
|
19
|
+
Builders::Documentation::Readme,
|
20
|
+
Rubysmith::Builders::Documentation::Citation,
|
21
|
+
Rubysmith::Builders::Documentation::License,
|
22
|
+
Rubysmith::Builders::Documentation::Version,
|
23
|
+
Rubysmith::Builders::Git::Setup,
|
24
|
+
Rubysmith::Builders::Git::Ignore,
|
25
|
+
Rubysmith::Builders::Git::Safe,
|
26
|
+
Builders::Git::Ignore,
|
27
|
+
Rubysmith::Builders::Bundler,
|
28
|
+
Builders::Bundler,
|
29
|
+
Builders::CLI,
|
30
|
+
Rubysmith::Builders::Rake,
|
31
|
+
Rubysmith::Builders::Console,
|
32
|
+
Rubysmith::Builders::CircleCI,
|
33
|
+
Builders::CircleCI,
|
34
|
+
Rubysmith::Builders::Setup,
|
35
|
+
Rubysmith::Builders::GitHub,
|
36
|
+
Rubysmith::Builders::Guard,
|
37
|
+
Rubysmith::Builders::Reek,
|
38
|
+
Rubysmith::Builders::RSpec::Binstub,
|
39
|
+
Rubysmith::Builders::RSpec::Context,
|
40
|
+
Rubysmith::Builders::RSpec::Helper,
|
41
|
+
Builders::RSpec::Helper,
|
42
|
+
Rubysmith::Builders::Caliber,
|
43
|
+
Rubysmith::Extensions::Bundler,
|
44
|
+
Rubysmith::Extensions::Pragmater,
|
45
|
+
Rubysmith::Extensions::Tocer,
|
46
|
+
Rubysmith::Extensions::Rubocop,
|
47
|
+
Builders::Git::Commit
|
48
|
+
].freeze
|
49
|
+
# rubocop:enable Metrics/CollectionLiteralLength
|
50
|
+
|
51
|
+
handle "build"
|
52
|
+
|
53
|
+
description "Build new project."
|
54
|
+
|
55
|
+
on Rubysmith::CLI::Actions::Name, input: Container[:input]
|
56
|
+
on Rubysmith::CLI::Actions::AmazingPrint, input: Container[:input]
|
57
|
+
on Rubysmith::CLI::Actions::Caliber, input: Container[:input]
|
58
|
+
on Rubysmith::CLI::Actions::CircleCI, input: Container[:input]
|
59
|
+
on Rubysmith::CLI::Actions::Citation, input: Container[:input]
|
60
|
+
on Actions::CLI, input: Container[:input]
|
61
|
+
on Rubysmith::CLI::Actions::Community, input: Container[:input]
|
62
|
+
on Rubysmith::CLI::Actions::Conduct, input: Container[:input]
|
63
|
+
on Rubysmith::CLI::Actions::Console, input: Container[:input]
|
64
|
+
on Rubysmith::CLI::Actions::Contributions, input: Container[:input]
|
65
|
+
on Rubysmith::CLI::Actions::Debug, input: Container[:input]
|
66
|
+
on Rubysmith::CLI::Actions::Funding, input: Container[:input]
|
67
|
+
on Rubysmith::CLI::Actions::Git, input: Container[:input]
|
68
|
+
on Rubysmith::CLI::Actions::GitHub, input: Container[:input]
|
69
|
+
on Rubysmith::CLI::Actions::GitHubCI, input: Container[:input]
|
70
|
+
on Rubysmith::CLI::Actions::GitLint, input: Container[:input]
|
71
|
+
on Rubysmith::CLI::Actions::Guard, input: Container[:input]
|
72
|
+
on Rubysmith::CLI::Actions::License, input: Container[:input]
|
73
|
+
on Rubysmith::CLI::Actions::Maximum, input: Container[:input]
|
74
|
+
on Rubysmith::CLI::Actions::Minimum, input: Container[:input]
|
75
|
+
on Rubysmith::CLI::Actions::Rake, input: Container[:input]
|
76
|
+
on Rubysmith::CLI::Actions::Readme, input: Container[:input]
|
77
|
+
on Rubysmith::CLI::Actions::Reek, input: Container[:input]
|
78
|
+
on Rubysmith::CLI::Actions::Refinements, input: Container[:input]
|
79
|
+
on Rubysmith::CLI::Actions::RSpec, input: Container[:input]
|
80
|
+
on Rubysmith::CLI::Actions::Security, input: Container[:input]
|
81
|
+
on Rubysmith::CLI::Actions::Setup, input: Container[:input]
|
82
|
+
on Rubysmith::CLI::Actions::SimpleCov, input: Container[:input]
|
83
|
+
on Rubysmith::CLI::Actions::Versions, input: Container[:input]
|
84
|
+
on Rubysmith::CLI::Actions::Yard, input: Container[:input]
|
85
|
+
on Rubysmith::CLI::Actions::Zeitwerk, input: Container[:input]
|
86
|
+
|
87
|
+
def initialize(builders: BUILDERS, **)
|
88
|
+
super(**)
|
89
|
+
@builders = builders
|
90
|
+
end
|
91
|
+
|
92
|
+
def call
|
93
|
+
log_info "Building project skeleton: #{input.project_name}..."
|
94
|
+
builders.each { |builder| builder.call input }
|
95
|
+
log_info "Project skeleton complete!"
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
attr_reader :builders
|
101
|
+
|
102
|
+
def log_info(message) = logger.info { message }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|