gemsmith 21.10.0 → 22.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91f7bb8b0f00c2525965db44e12023fbb054043702c6cda7886a0b9fb497c9e1
4
- data.tar.gz: e00efab235a042ac27d4a255607280571923ebf3306773501f73e79c2a1dda98
3
+ metadata.gz: 4fcdf37e1c5549ca56e3758ef677b7a2c67fb3c889ce858c1c7f46075b25bf84
4
+ data.tar.gz: 96e8566c05f4b498cdab49e6df7815224424d019432d4e035ed07ef4acec063c
5
5
  SHA512:
6
- metadata.gz: 972901fc50424827f9d633896cc119726a49e9ecd4a0d2d90c241606946d0ce4a0013a56f7b84125188a0fd9aa88a670ea075807f85a826a2fec6ecf8535216b
7
- data.tar.gz: 56be1b200bfc689fe10297abbd39c234596460ab5ee9c8aad52d2f1b691644e01278c5b43f30038f70f33bc3804b23f5dcd74cb2c6e5db26f3d9ad5cbad1a93e
6
+ metadata.gz: b85a165714890f114e4969a6ec3cf281eb66a9643f73a4f328591cb3eaffd13dc592588fb8f89bb4a539882e8a962e4e349c086d0ea01adfb822241d68eac691
7
+ data.tar.gz: 5552966cc4ac0181d66a018915d2a15c8b11d3dafd83d652a97f2834d4f7eb9464ca2724fc92272e52aafac62a8562a92dd695ba7639bb06ec53ea25e25c7f70
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -164,8 +164,8 @@ the following:
164
164
 
165
165
  [source,yaml]
166
166
  ----
167
- :build:
168
- :cli: false
167
+ build:
168
+ cli: false
169
169
  ----
170
170
 
171
171
  It is recommended that you provide URLs for your project which would be all keys found in this
@@ -173,8 +173,8 @@ section:
173
173
 
174
174
  [source,yaml]
175
175
  ----
176
- :project:
177
- :url:
176
+ project:
177
+ uri:
178
178
  # Add sub-key values here.
179
179
  ----
180
180
 
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 = "21.10.0"
5
+ spec.version = "22.0.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gemsmith"
@@ -24,17 +24,17 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = "~> 3.3"
26
26
  spec.add_dependency "cogger", "~> 0.21"
27
- spec.add_dependency "containable", "~> 0.0"
27
+ spec.add_dependency "containable", "~> 0.2"
28
28
  spec.add_dependency "core", "~> 1.0"
29
29
  spec.add_dependency "dry-monads", "~> 1.6"
30
30
  spec.add_dependency "dry-schema", "~> 1.13"
31
- spec.add_dependency "etcher", "~> 1.6"
32
- spec.add_dependency "infusible", "~> 3.5"
33
- spec.add_dependency "milestoner", "~> 17.8"
34
- spec.add_dependency "refinements", "~> 12.1"
35
- spec.add_dependency "rubysmith", "~> 6.10"
36
- spec.add_dependency "runcom", "~> 11.0"
37
- spec.add_dependency "sod", "~> 0.8"
31
+ spec.add_dependency "etcher", "~> 2.1"
32
+ spec.add_dependency "infusible", "~> 3.8"
33
+ spec.add_dependency "milestoner", "~> 18.0"
34
+ spec.add_dependency "refinements", "~> 12.5"
35
+ spec.add_dependency "rubysmith", "~> 7.0"
36
+ spec.add_dependency "runcom", "~> 11.5"
37
+ spec.add_dependency "sod", "~> 0.12"
38
38
  spec.add_dependency "spek", "~> 3.0"
39
39
  spec.add_dependency "zeitwerk", "~> 2.6"
40
40
 
@@ -5,18 +5,20 @@ require "refinements/struct"
5
5
  module Gemsmith
6
6
  module Builders
7
7
  # Builds project skeleton with Gemfile configuration.
8
- class Bundler < Rubysmith::Builders::Abstract
8
+ class Bundler < Rubysmith::Builders::Bundler
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- builder.call(configuration.merge(template_path: "%project_name%/Gemfile.erb"))
12
+ super
13
+
14
+ builder.call(settings.merge(template_path: "%project_name%/Gemfile.erb"))
13
15
  .insert_after("source", "\ngemspec\n")
14
16
  .replace(/spec\n\n\Z/m, "spec\n")
15
17
  .replace(/.+refinements.+/, "")
16
18
  .replace(/.+zeitwerk.+/, "")
17
19
  .replace("\n\n\n\n", "\n")
18
20
 
19
- configuration
21
+ true
20
22
  end
21
23
  end
22
24
  end
@@ -4,23 +4,24 @@ require "refinements/struct"
4
4
 
5
5
  module Gemsmith
6
6
  module Builders
7
- # Builds project skeleton Circle CI configuration.
8
- class CircleCI < Rubysmith::Builders::Abstract
7
+ # Builds project skeleton Circle CI settings.
8
+ class CircleCI < Rubysmith::Builders::CircleCI
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- return configuration unless configuration.build_circle_ci
12
+ return false unless settings.build_circle_ci
13
13
 
14
- builder.call(configuration.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
14
+ super
15
+ builder.call(settings.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
15
16
  .replace %({{checksum "Gemfile.lock"}}),
16
17
  %({{checksum "Gemfile"}}-{{checksum "#{project_name}.gemspec"}})
17
18
 
18
- configuration
19
+ true
19
20
  end
20
21
 
21
22
  private
22
23
 
23
- def project_name = configuration.project_name
24
+ def project_name = settings.project_name
24
25
  end
25
26
  end
26
27
  end
@@ -9,10 +9,10 @@ module Gemsmith
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- return configuration unless configuration.build_cli
12
+ return false unless settings.build_cli
13
13
 
14
14
  render
15
- configuration
15
+ true
16
16
  end
17
17
 
18
18
  private
@@ -20,13 +20,13 @@ module Gemsmith
20
20
  def render = private_methods.sort.grep(/render_/).each { |method| __send__ method }
21
21
 
22
22
  def render_exe
23
- builder.call(configuration.merge(template_path: "%project_name%/exe/%project_name%.erb"))
23
+ builder.call(settings.merge(template_path: "%project_name%/exe/%project_name%.erb"))
24
24
  .render
25
25
  .permit 0o755
26
26
  end
27
27
 
28
28
  def render_core
29
- content = configuration.merge template_path: "%project_name%/lib/%project_path%.rb.erb"
29
+ content = settings.merge template_path: "%project_name%/lib/%project_path%.rb.erb"
30
30
 
31
31
  builder.call(content)
32
32
  .insert_before(/tag/, %( loader.inflector.inflect "cli" => "CLI"\n))
@@ -39,21 +39,21 @@ module Gemsmith
39
39
  "%project_name%/lib/%project_path%/configuration/defaults.yml.erb",
40
40
  "%project_name%/lib/%project_path%/container.rb.erb",
41
41
  "%project_name%/lib/%project_path%/import.rb.erb"
42
- ].each { |path| builder.call(configuration.merge(template_path: path)).render }
42
+ ].each { |path| builder.call(settings.merge(template_path: path)).render }
43
43
  end
44
44
 
45
45
  def render_shell
46
46
  path = "%project_name%/lib/%project_path%/cli/shell.rb.erb"
47
- builder.call(configuration.merge(template_path: path)).render
47
+ builder.call(settings.merge(template_path: path)).render
48
48
  end
49
49
 
50
50
  def render_specs
51
- return unless configuration.build_rspec
51
+ return unless settings.build_rspec
52
52
 
53
53
  [
54
54
  "%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb",
55
55
  "%project_name%/spec/support/shared_contexts/application_dependencies.rb.erb"
56
- ].each { |path| builder.call(configuration.merge(template_path: path)).render }
56
+ ].each { |path| builder.call(settings.merge(template_path: path)).render }
57
57
  end
58
58
  end
59
59
  end
@@ -9,13 +9,13 @@ module Gemsmith
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- return configuration unless configuration.build_console
12
+ return false unless settings.build_console
13
13
 
14
14
  super
15
- builder.call(configuration.merge(template_path: "%project_name%/bin/console.erb"))
16
- .replace(/require Bundler.root.+/, %(require "#{configuration.project_path}"))
15
+ builder.call(settings.merge(template_path: "%project_name%/bin/console.erb"))
16
+ .replace(/require Bundler.root.+/, %(require "#{settings.project_path}"))
17
17
 
18
- configuration
18
+ true
19
19
  end
20
20
  end
21
21
  end
@@ -10,25 +10,25 @@ module Gemsmith
10
10
  using Refinements::Struct
11
11
 
12
12
  def call
13
- return configuration unless configuration.build_readme
13
+ return false unless settings.build_readme
14
14
 
15
15
  super
16
- builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
16
+ builder.call(settings.merge(template_path: "%project_name%/README.#{kind}.erb"))
17
17
  .replace(/Setup.+Usage/m, setup)
18
18
  .replace("Rubysmith", "Gemsmith")
19
19
  .replace("rubysmith", "gemsmith")
20
20
 
21
- configuration
21
+ true
22
22
  end
23
23
 
24
24
  private
25
25
 
26
26
  def setup = kind == "adoc" ? ascii_setup : markdown_setup
27
27
 
28
- def ascii_setup = configuration.build_security ? ascii_secure : ascii_insecure
28
+ def ascii_setup = settings.build_security ? ascii_secure : ascii_insecure
29
29
 
30
30
  def ascii_secure
31
- project_name = configuration.project_name
31
+ project_name = settings.project_name
32
32
 
33
33
  <<~CONTENT.strip
34
34
  Setup
@@ -38,7 +38,7 @@ module Gemsmith
38
38
  [source,bash]
39
39
  ----
40
40
  # 💡 Skip this line if you already have the public certificate installed.
41
- gem cert --add <(curl --compressed --location #{configuration.organization_url}/gems.pem)
41
+ gem cert --add <(curl --compressed --location #{settings.organization_uri}/gems.pem)
42
42
  gem install #{project_name} --trust-policy HighSecurity
43
43
  ----
44
44
 
@@ -61,7 +61,7 @@ module Gemsmith
61
61
 
62
62
  [source,bash]
63
63
  ----
64
- gem install #{configuration.project_name}
64
+ gem install #{settings.project_name}
65
65
  ----
66
66
 
67
67
  #{ascii_common}
@@ -74,24 +74,24 @@ module Gemsmith
74
74
 
75
75
  [source,bash]
76
76
  ----
77
- bundle add #{configuration.project_name}
77
+ bundle add #{settings.project_name}
78
78
  ----
79
79
 
80
80
  Once the gem is installed, you only need to require it:
81
81
 
82
82
  [source,ruby]
83
83
  ----
84
- require "#{configuration.project_path}"
84
+ require "#{settings.project_path}"
85
85
  ----
86
86
 
87
87
  == Usage
88
88
  CONTENT
89
89
  end
90
90
 
91
- def markdown_setup = configuration.build_security ? markdown_secure : markdown_insecure
91
+ def markdown_setup = settings.build_security ? markdown_secure : markdown_insecure
92
92
 
93
93
  def markdown_secure
94
- project_name = configuration.project_name
94
+ project_name = settings.project_name
95
95
 
96
96
  <<~CONTENT.strip
97
97
  Setup
@@ -99,7 +99,7 @@ module Gemsmith
99
99
  To install _with_ security, run:
100
100
 
101
101
  # 💡 Skip this line if you already have the public certificate installed.
102
- gem cert --add <(curl --compressed --location #{configuration.organization_url}/gems.pem)
102
+ gem cert --add <(curl --compressed --location #{settings.organization_uri}/gems.pem)
103
103
  gem install #{project_name} --trust-policy HighSecurity
104
104
 
105
105
  To install _without_ security, run:
@@ -116,7 +116,7 @@ module Gemsmith
116
116
 
117
117
  To install, run:
118
118
 
119
- gem install #{configuration.project_name}
119
+ gem install #{settings.project_name}
120
120
 
121
121
  #{markdown_common}
122
122
  CONTENT
@@ -126,11 +126,11 @@ module Gemsmith
126
126
  <<~CONTENT.strip
127
127
  You can also add the gem directly to your project:
128
128
 
129
- bundle add #{configuration.project_name}
129
+ bundle add #{settings.project_name}
130
130
 
131
131
  Once the gem is installed, you only need to require it:
132
132
 
133
- require "#{configuration.project_path}"
133
+ require "#{settings.project_path}"
134
134
 
135
135
  ## Usage
136
136
  CONTENT
@@ -10,9 +10,9 @@ module Gemsmith
10
10
  using Refinements::Struct
11
11
 
12
12
  def call
13
- return configuration unless configuration.build_git
13
+ return false unless settings.build_git
14
14
 
15
- builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
15
+ builder.call(settings.merge(template_path: "%project_name%/.gitignore.erb"))
16
16
  .touch
17
17
  .prepend("*.gem\n")
18
18
  .insert_before "tmp\n", <<~CONTENT
@@ -20,7 +20,7 @@ module Gemsmith
20
20
  pkg
21
21
  CONTENT
22
22
 
23
- configuration
23
+ true
24
24
  end
25
25
  end
26
26
  end
@@ -6,16 +6,17 @@ module Gemsmith
6
6
  module Builders
7
7
  module RSpec
8
8
  # Builds RSpec spec helper for project skeleton.
9
- class Helper < Rubysmith::Builders::Abstract
9
+ class Helper < Rubysmith::Builders::RSpec::Helper
10
10
  using Refinements::Struct
11
11
 
12
12
  def call
13
- return configuration unless configuration.build_rspec && configuration.build_cli
13
+ return false unless settings.build_rspec && settings.build_cli
14
14
 
15
- builder.call(configuration.merge(template_path: "%project_name%/spec/spec_helper.rb.erb"))
16
- .touch
15
+ super
16
+ builder.call(settings.merge(template_path: "%project_name%/spec/spec_helper.rb.erb"))
17
17
  .replace("%r(^/spec/)", "%r((.+/container\\.rb|^/spec/))")
18
- configuration
18
+
19
+ true
19
20
  end
20
21
  end
21
22
  end
@@ -9,7 +9,7 @@ module Gemsmith
9
9
  using Refinements::Struct
10
10
 
11
11
  def call
12
- config = configuration.merge template_path: "%project_name%/%project_name%.gemspec.erb"
12
+ config = settings.merge template_path: "%project_name%/%project_name%.gemspec.erb"
13
13
 
14
14
  builder.call(config)
15
15
  .render
@@ -19,7 +19,7 @@ module Gemsmith
19
19
  .replace(" spec", " spec")
20
20
  .replace(/\}\s+s/m, "}\n\n s")
21
21
 
22
- configuration
22
+ true
23
23
  end
24
24
  end
25
25
  end
@@ -7,15 +7,15 @@ module Gemsmith
7
7
  module Actions
8
8
  # Stores CLI flag.
9
9
  class CLI < Sod::Action
10
- include Import[:input]
10
+ include Import[:settings]
11
11
 
12
12
  description "Add command line interface."
13
13
 
14
14
  on "--[no-]cli"
15
15
 
16
- default { Container[:configuration].build_cli }
16
+ default { Container[:settings].build_cli }
17
17
 
18
- def call(value = nil) = input.build_cli = value
18
+ def call(value = nil) = settings.build_cli = value
19
19
  end
20
20
  end
21
21
  end
@@ -9,7 +9,7 @@ module Gemsmith
9
9
  module Actions
10
10
  # Handles the edit action for editing an installed gem.
11
11
  class Edit < Sod::Action
12
- include Import[:kernel, :logger]
12
+ include Import[:logger]
13
13
  include Dry::Monads[:result]
14
14
 
15
15
  description "Edit installed gem in default editor."
@@ -30,8 +30,8 @@ module Gemsmith
30
30
  def call name = nil
31
31
  case publisher.call loader.call("#{name || default}.gemspec")
32
32
  in Success(spec) then logger.info { "Published: #{spec.package_name}." }
33
- in Failure(message) then log_error { message }
34
- else log_error { "Unable to handle publish action." }
33
+ in Failure(message) then log_error message
34
+ else log_error "Publish failed, unable to parse result."
35
35
  end
36
36
  end
37
37
 
@@ -39,7 +39,7 @@ module Gemsmith
39
39
 
40
40
  attr_reader :publisher, :loader
41
41
 
42
- def log_error(&) = logger.error(&)
42
+ def log_error(message) = logger.error { message }
43
43
  end
44
44
  end
45
45
  end
@@ -9,7 +9,7 @@ module Gemsmith
9
9
  module Actions
10
10
  # Handles the view action for viewing an installed gem in default browser.
11
11
  class View < Sod::Action
12
- include Import[:kernel, :logger]
12
+ include Import[:logger]
13
13
  include Dry::Monads[:result]
14
14
 
15
15
  description "View installed gem in default browser."
@@ -7,7 +7,7 @@ module Gemsmith
7
7
  module Commands
8
8
  # Handles the build action.
9
9
  class Build < Sod::Command
10
- include Import[:input, :logger]
10
+ include Import[:settings, :logger]
11
11
 
12
12
  # Order is important.
13
13
  BUILDERS = [
@@ -21,23 +21,22 @@ module Gemsmith
21
21
  Rubysmith::Builders::Documentation::License,
22
22
  Rubysmith::Builders::Documentation::Version,
23
23
  Rubysmith::Builders::Git::Setup,
24
- Rubysmith::Builders::Git::Ignore,
25
- Rubysmith::Builders::Git::Safe,
26
24
  Builders::Git::Ignore,
27
- Rubysmith::Builders::Bundler,
25
+ Rubysmith::Builders::Git::Safe,
28
26
  Builders::Bundler,
29
27
  Builders::CLI,
30
- Rubysmith::Builders::Rake,
28
+ Rubysmith::Builders::Rake::Binstub,
29
+ Rubysmith::Builders::Rake::Configuration,
31
30
  Builders::Console,
32
- Rubysmith::Builders::CircleCI,
33
31
  Builders::CircleCI,
34
32
  Rubysmith::Builders::Setup,
35
- Rubysmith::Builders::GitHub,
33
+ Rubysmith::Builders::GitHub::Template,
34
+ Rubysmith::Builders::GitHub::Funding,
35
+ Rubysmith::Builders::GitHub::CI,
36
36
  Rubysmith::Builders::Guard,
37
37
  Rubysmith::Builders::Reek,
38
38
  Rubysmith::Builders::RSpec::Binstub,
39
39
  Rubysmith::Builders::RSpec::Context,
40
- Rubysmith::Builders::RSpec::Helper,
41
40
  Builders::RSpec::Helper,
42
41
  Rubysmith::Builders::Caliber,
43
42
  Rubysmith::Extensions::Bundler,
@@ -51,36 +50,36 @@ module Gemsmith
51
50
 
52
51
  description "Build new project."
53
52
 
54
- on Rubysmith::CLI::Actions::Name, input: Container[:input]
55
- on Rubysmith::CLI::Actions::AmazingPrint, input: Container[:input]
56
- on Rubysmith::CLI::Actions::Caliber, input: Container[:input]
57
- on Rubysmith::CLI::Actions::CircleCI, input: Container[:input]
58
- on Rubysmith::CLI::Actions::Citation, input: Container[:input]
53
+ on Rubysmith::CLI::Actions::Name, settings: Container[:settings]
54
+ on Rubysmith::CLI::Actions::AmazingPrint, settings: Container[:settings]
55
+ on Rubysmith::CLI::Actions::Caliber, settings: Container[:settings]
56
+ on Rubysmith::CLI::Actions::CircleCI, settings: Container[:settings]
57
+ on Rubysmith::CLI::Actions::Citation, settings: Container[:settings]
59
58
  on Actions::CLI
60
- on Rubysmith::CLI::Actions::Community, input: Container[:input]
61
- on Rubysmith::CLI::Actions::Conduct, input: Container[:input]
62
- on Rubysmith::CLI::Actions::Console, input: Container[:input]
63
- on Rubysmith::CLI::Actions::Contributions, input: Container[:input]
64
- on Rubysmith::CLI::Actions::Debug, input: Container[:input]
65
- on Rubysmith::CLI::Actions::Funding, input: Container[:input]
66
- on Rubysmith::CLI::Actions::Git, input: Container[:input]
67
- on Rubysmith::CLI::Actions::GitHub, input: Container[:input]
68
- on Rubysmith::CLI::Actions::GitHubCI, input: Container[:input]
69
- on Rubysmith::CLI::Actions::GitLint, input: Container[:input]
70
- on Rubysmith::CLI::Actions::Guard, input: Container[:input]
71
- on Rubysmith::CLI::Actions::License, input: Container[:input]
72
- on Rubysmith::CLI::Actions::Maximum, input: Container[:input]
73
- on Rubysmith::CLI::Actions::Minimum, input: Container[:input]
74
- on Rubysmith::CLI::Actions::Rake, input: Container[:input]
75
- on Rubysmith::CLI::Actions::Readme, input: Container[:input]
76
- on Rubysmith::CLI::Actions::Reek, input: Container[:input]
77
- on Rubysmith::CLI::Actions::Refinements, input: Container[:input]
78
- on Rubysmith::CLI::Actions::RSpec, input: Container[:input]
79
- on Rubysmith::CLI::Actions::Security, input: Container[:input]
80
- on Rubysmith::CLI::Actions::Setup, input: Container[:input]
81
- on Rubysmith::CLI::Actions::SimpleCov, input: Container[:input]
82
- on Rubysmith::CLI::Actions::Versions, input: Container[:input]
83
- on Rubysmith::CLI::Actions::Zeitwerk, input: Container[:input]
59
+ on Rubysmith::CLI::Actions::Community, settings: Container[:settings]
60
+ on Rubysmith::CLI::Actions::Conduct, settings: Container[:settings]
61
+ on Rubysmith::CLI::Actions::Console, settings: Container[:settings]
62
+ on Rubysmith::CLI::Actions::Contributions, settings: Container[:settings]
63
+ on Rubysmith::CLI::Actions::Debug, settings: Container[:settings]
64
+ on Rubysmith::CLI::Actions::Funding, settings: Container[:settings]
65
+ on Rubysmith::CLI::Actions::Git, settings: Container[:settings]
66
+ on Rubysmith::CLI::Actions::GitHub, settings: Container[:settings]
67
+ on Rubysmith::CLI::Actions::GitHubCI, settings: Container[:settings]
68
+ on Rubysmith::CLI::Actions::GitLint, settings: Container[:settings]
69
+ on Rubysmith::CLI::Actions::Guard, settings: Container[:settings]
70
+ on Rubysmith::CLI::Actions::License, settings: Container[:settings]
71
+ on Rubysmith::CLI::Actions::Maximum, settings: Container[:settings]
72
+ on Rubysmith::CLI::Actions::Minimum, settings: Container[:settings]
73
+ on Rubysmith::CLI::Actions::Rake, settings: Container[:settings]
74
+ on Rubysmith::CLI::Actions::Readme, settings: Container[:settings]
75
+ on Rubysmith::CLI::Actions::Reek, settings: Container[:settings]
76
+ on Rubysmith::CLI::Actions::Refinements, settings: Container[:settings]
77
+ on Rubysmith::CLI::Actions::RSpec, settings: Container[:settings]
78
+ on Rubysmith::CLI::Actions::Security, settings: Container[:settings]
79
+ on Rubysmith::CLI::Actions::Setup, settings: Container[:settings]
80
+ on Rubysmith::CLI::Actions::SimpleCov, settings: Container[:settings]
81
+ on Rubysmith::CLI::Actions::Versions, settings: Container[:settings]
82
+ on Rubysmith::CLI::Actions::Zeitwerk, settings: Container[:settings]
84
83
 
85
84
  def initialize(builders: BUILDERS, **)
86
85
  super(**)
@@ -88,8 +87,8 @@ module Gemsmith
88
87
  end
89
88
 
90
89
  def call
91
- log_info "Building project skeleton: #{input.project_name}..."
92
- builders.each { |builder| builder.call input }
90
+ log_info "Building project skeleton: #{settings.project_name}..."
91
+ builders.each { |constant| constant.new(settings:).call }
93
92
  log_info "Project skeleton complete!"
94
93
  end
95
94
 
@@ -12,36 +12,45 @@ module Gemsmith
12
12
  module Container
13
13
  extend Containable
14
14
 
15
- register :configuration do
16
- self[:defaults].add_loader(:yaml, self[:xdg_config].active)
17
- .then { |registry| Etcher.call registry }
18
- end
19
-
20
- register :defaults do
21
- registry = Etcher::Registry.new contract: Rubysmith::Configuration::Contract,
22
- model: Rubysmith::Configuration::Model
15
+ register :registry do
16
+ contract = Rubysmith::Configuration::Contract
17
+ model = Rubysmith::Configuration::Model
23
18
 
24
- registry.add_loader(:yaml, self[:defaults_path])
25
- .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new)
26
- .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new)
27
- .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new)
28
- .add_transformer(Rubysmith::Configuration::Transformers::TemplateRoot.new)
29
- .add_transformer(
30
- Rubysmith::Configuration::Transformers::TemplateRoot.new(
31
- default: Pathname(__dir__).join("templates")
32
- )
33
- )
34
- .add_transformer(Rubysmith::Configuration::Transformers::TargetRoot)
35
- .add_transformer(:time)
19
+ Etcher::Registry.new(contract:, model:)
20
+ .add_loader(:yaml, self[:defaults_path])
21
+ .add_loader(:yaml, self[:xdg_config].active)
22
+ .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new)
23
+ .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new)
24
+ .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new)
25
+ .add_transformer(Rubysmith::Configuration::Transformers::TemplateRoot.new)
26
+ .add_transformer(
27
+ Rubysmith::Configuration::Transformers::TemplateRoot.new(
28
+ default: Pathname(__dir__).join("templates")
29
+ )
30
+ )
31
+ .add_transformer(:root, :target_root)
32
+ .add_transformer(:format, :author_uri)
33
+ .add_transformer(:format, :project_uri_community)
34
+ .add_transformer(:format, :project_uri_conduct)
35
+ .add_transformer(:format, :project_uri_contributions)
36
+ .add_transformer(:format, :project_uri_download, :project_name)
37
+ .add_transformer(:format, :project_uri_funding)
38
+ .add_transformer(:format, :project_uri_home, :project_name)
39
+ .add_transformer(:format, :project_uri_issues, :project_name)
40
+ .add_transformer(:format, :project_uri_license)
41
+ .add_transformer(:format, :project_uri_security)
42
+ .add_transformer(:format, :project_uri_source, :project_name)
43
+ .add_transformer(:format, :project_uri_versions, :project_name)
44
+ .add_transformer(:time, :loaded_at)
36
45
  end
37
46
 
47
+ register(:settings) { Etcher.call(self[:registry]).dup }
38
48
  register(:specification) { Spek::Loader.call "#{__dir__}/../../gemsmith.gemspec" }
39
- register(:input) { self[:configuration].dup }
40
49
  register(:defaults_path) { Rubysmith::Container[:defaults_path] }
41
50
  register(:xdg_config) { Runcom::Config.new "gemsmith/configuration.yml" }
42
51
  register :environment, ENV
43
52
  register(:logger) { Cogger.new id: :gemsmith }
44
53
  register :executor, Open3
45
- register :kernel, Kernel
54
+ register :io, STDOUT
46
55
  end
47
56
  end
@@ -1,74 +1,74 @@
1
1
  Gem::Specification.new do |spec|
2
- spec.name = "<%= configuration.project_name %>"
3
- spec.version = "<%= configuration.project_version %>"
4
- spec.authors = ["<%= configuration.author_name %>"]
5
- spec.email = ["<%= configuration.author_email %>"]
6
- spec.homepage = "<%= configuration.computed_project_url_home %>"
2
+ spec.name = "<%= settings.project_name %>"
3
+ spec.version = "<%= settings.project_version %>"
4
+ spec.authors = ["<%= settings.author_name %>"]
5
+ spec.email = ["<%= settings.author_email %>"]
6
+ spec.homepage = "<%= settings.computed_project_uri_home %>"
7
7
  spec.summary = ""
8
- spec.license = "<%= configuration.license_label_version %>"
8
+ spec.license = "<%= settings.license_label_version %>"
9
9
 
10
10
  spec.metadata = {
11
- <% unless configuration.computed_project_url_issues.empty? %>
12
- "bug_tracker_uri" => "<%= configuration.computed_project_url_issues %>",
11
+ <% unless settings.computed_project_uri_issues.empty? %>
12
+ "bug_tracker_uri" => "<%= settings.computed_project_uri_issues %>",
13
13
  <% end %>
14
- <% unless configuration.computed_project_url_versions.empty? %>
15
- "changelog_uri" => "<%= configuration.computed_project_url_versions %>",
14
+ <% unless settings.computed_project_uri_versions.empty? %>
15
+ "changelog_uri" => "<%= settings.computed_project_uri_versions %>",
16
16
  <% end %>
17
- <% unless configuration.computed_project_url_home.empty? %>
18
- "documentation_uri" => "<%= configuration.computed_project_url_home %>",
17
+ <% unless settings.computed_project_uri_home.empty? %>
18
+ "documentation_uri" => "<%= settings.computed_project_uri_home %>",
19
19
  <% end %>
20
- <% unless configuration.computed_project_url_funding.empty? %>
21
- "funding_uri" => "<%= configuration.computed_project_url_funding %>",
20
+ <% unless settings.computed_project_uri_funding.empty? %>
21
+ "funding_uri" => "<%= settings.computed_project_uri_funding %>",
22
22
  <% end %>
23
- "label" => "<%= configuration.project_label %>",
24
- <% if configuration.computed_project_url_source.empty? %>
25
- "rubygems_mfa_required" => "true"
26
- <% else %>
23
+ "label" => "<%= settings.project_label %>",
24
+ <% unless settings.computed_project_uri_source.empty? %>
27
25
  "rubygems_mfa_required" => "true",
28
- "source_code_uri" => "<%= configuration.computed_project_url_source %>"
26
+ "source_code_uri" => "<%= settings.computed_project_uri_source %>"
27
+ <% else %>
28
+ "rubygems_mfa_required" => "true"
29
29
  <% end %>
30
30
  }
31
31
 
32
- <% if configuration.build_security %>
32
+ <% if settings.build_security %>
33
33
  spec.signing_key = Gem.default_key_path
34
34
  spec.cert_chain = [Gem.default_cert_path]
35
35
  <% end %>
36
36
 
37
37
  spec.required_ruby_version = "~> <%= RUBY_VERSION[/\d+\.\d+/] %>"
38
- <% if configuration.build_cli %>
38
+ <% if settings.build_cli %>
39
39
  spec.add_dependency "cogger", "~> 0.21"
40
40
  <% end %>
41
- <% if configuration.build_cli %>
42
- spec.add_dependency "containable", "~> 0.0"
41
+ <% if settings.build_cli %>
42
+ spec.add_dependency "containable", "~> 0.2"
43
43
  <% end %>
44
- <% if configuration.build_cli %>
44
+ <% if settings.build_cli %>
45
45
  spec.add_dependency "dry-monads", "~> 1.6"
46
46
  <% end %>
47
- <% if configuration.build_cli %>
48
- spec.add_dependency "etcher", "~> 1.6"
47
+ <% if settings.build_cli %>
48
+ spec.add_dependency "etcher", "~> 2.1"
49
49
  <% end %>
50
- <% if configuration.build_cli %>
51
- spec.add_dependency "infusible", "~> 3.5"
50
+ <% if settings.build_cli %>
51
+ spec.add_dependency "infusible", "~> 3.8"
52
52
  <% end %>
53
- <% if configuration.build_refinements %>
54
- spec.add_dependency "refinements", "~> 12.1"
53
+ <% if settings.build_refinements %>
54
+ spec.add_dependency "refinements", "~> 12.5"
55
55
  <% end %>
56
- <% if configuration.build_cli %>
57
- spec.add_dependency "runcom", "~> 11.0"
56
+ <% if settings.build_cli %>
57
+ spec.add_dependency "runcom", "~> 11.5"
58
58
  <% end %>
59
- <% if configuration.build_cli %>
60
- spec.add_dependency "sod", "~> 0.8"
59
+ <% if settings.build_cli %>
60
+ spec.add_dependency "sod", "~> 0.12"
61
61
  <% end %>
62
- <% if configuration.build_cli %>
62
+ <% if settings.build_cli %>
63
63
  spec.add_dependency "spek", "~> 3.0"
64
64
  <% end %>
65
- <% if configuration.build_zeitwerk %>
65
+ <% if settings.build_zeitwerk %>
66
66
  spec.add_dependency "zeitwerk", "~> 2.6"
67
67
  <% end %>
68
68
 
69
- <% if configuration.build_cli %>
69
+ <% if settings.build_cli %>
70
70
  spec.bindir = "exe"
71
- spec.executables << "<%= configuration.project_name %>"
71
+ spec.executables << "<%= settings.project_name %>"
72
72
  <% end %>
73
73
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
74
74
  spec.files = Dir["*.gemspec", "lib/**/*"]
@@ -1,5 +1,5 @@
1
1
  #! /usr/bin/env ruby
2
2
 
3
- require "<%= configuration.project_path %>"
3
+ require "<%= settings.project_path %>"
4
4
 
5
- <%= configuration.project_namespaced_class %>::CLI::Shell.new.call
5
+ <%= settings.project_namespaced_class %>::CLI::Shell.new.call
@@ -21,7 +21,7 @@ require "sod"
21
21
  def cli
22
22
  context = build_context
23
23
 
24
- dsl.new <%= configuration.project_levels.positive? ? configuration.project_name.inspect : configuration.project_name.to_sym.inspect %>, banner: specification.banner do
24
+ dsl.new <%= settings.project_levels.positive? ? settings.project_name.inspect : settings.project_name.to_sym.inspect %>, banner: specification.banner do
25
25
  on(Sod::Prefabs::Commands::Config, context:)
26
26
  on(Sod::Prefabs::Actions::Version, context:)
27
27
  on Sod::Prefabs::Actions::Help, self
@@ -9,20 +9,17 @@ require "spek"
9
9
  module Container
10
10
  extend Containable
11
11
 
12
- register :configuration do
13
- self[:defaults].add_loader(:yaml, self[:xdg_config].active)
14
- .then { |registry| Etcher.call registry }
15
- end
16
-
17
- register :defaults do
12
+ register :registry do
18
13
  Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
19
14
  .add_loader(:yaml, self[:defaults_path])
15
+ .add_loader(:yaml, self[:xdg_config].active)
20
16
  end
21
17
 
22
- register(:specification) { Spek::Loader.call "#{__dir__}/<%= Array.new(2 + configuration.project_levels, "../").join %><%= configuration.project_name %>.gemspec" }
18
+ register(:settings) { Etcher.call(self[:registry]).dup }
19
+ register(:specification) { Spek::Loader.call "#{__dir__}/<%= Array.new(2 + settings.project_levels, "../").join %><%= settings.project_name %>.gemspec" }
23
20
  register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
24
- register(:xdg_config) { Runcom::Config.new "<%= configuration.project_path %>/configuration.yml" }
25
- register(:logger) { Cogger.new id: "<%= configuration.project_name %>" }
26
- register :kernel, Kernel
21
+ register(:xdg_config) { Runcom::Config.new "<%= settings.project_path %>/configuration.yml" }
22
+ register(:logger) { Cogger.new id: "<%= settings.project_name %>" }
23
+ register :io, STDOUT
27
24
  end
28
25
  <% end %>
@@ -1,30 +1,31 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe <%= configuration.project_namespaced_class %>::CLI::Shell do
3
+ RSpec.describe <%= settings.project_namespaced_class %>::CLI::Shell do
4
4
  using Refinements::Pathname
5
+ using Refinements::StringIO
5
6
 
6
7
  subject(:shell) { described_class.new }
7
8
 
8
9
  include_context "with application dependencies"
9
10
 
10
- before { Sod::Container.stub! kernel:, logger: }
11
+ before { Sod::Container.stub! logger:, io: }
11
12
 
12
13
  after { Sod::Container.restore }
13
14
 
14
15
  describe "#call" do
15
16
  it "prints configuration usage" do
16
17
  shell.call %w[config]
17
- expect(kernel).to have_received(:puts).with(/Manage configuration.+/m)
18
+ expect(io.reread).to match(/Manage configuration.+/m)
18
19
  end
19
20
 
20
21
  it "prints version" do
21
22
  shell.call %w[--version]
22
- expect(kernel).to have_received(:puts).with(/<%= configuration.project_label.gsub(" ", "\\s") %>\s\d+\.\d+\.\d+/)
23
+ expect(io.reread).to match(/<%= settings.project_label.gsub(" ", "\\s") %>\s\d+\.\d+\.\d+/)
23
24
  end
24
25
 
25
26
  it "prints help" do
26
27
  shell.call %w[--help]
27
- expect(kernel).to have_received(:puts).with(/<%= configuration.project_label.gsub(" ", "\\s") %>.+USAGE.+/m)
28
+ expect(io.reread).to match(/<%= settings.project_label.gsub(" ", "\\s") %>.+USAGE.+/m)
28
29
  end
29
30
  end
30
31
  end
@@ -1,9 +1,14 @@
1
1
  RSpec.shared_context "with application dependencies" do
2
- let(:configuration) { Etcher.new(<%= configuration.project_namespaced_class %>::Container[:defaults]).call.bind(&:dup) }
3
- let(:xdg_config) { Runcom::Config.new <%= configuration.project_namespaced_class %>::Container[:defaults_path] }
4
- let(:kernel) { class_spy Kernel }
5
- let(:logger) { Cogger.new id: "<%= configuration.project_name %>", io: StringIO.new, level: :debug }
2
+ using Refinements::Struct
6
3
 
7
- before { <%= configuration.project_namespaced_class %>::Container.stub! configuration:, xdg_config:, kernel:, logger: }
8
- after { <%= configuration.project_namespaced_class %>::Container.restore }
4
+ let(:settings) { <%= settings.project_namespaced_class %>::Container[:settings] }
5
+ let(:logger) { Cogger.new id: "<%= settings.project_name %>", io: StringIO.new, level: :debug }
6
+ let(:io) { StringIO.new }
7
+
8
+ before do
9
+ settings.merge! Etcher.call(<%= settings.project_namespaced_class %>::Container[:registry].remove_loader(1))
10
+ <%= settings.project_namespaced_class %>::Container.stub! logger:, io:
11
+ end
12
+
13
+ after { <%= settings.project_namespaced_class %>::Container.restore }
9
14
  end
@@ -7,7 +7,6 @@ module Gemsmith
7
7
  module Tools
8
8
  # Versions (tags: local and remote) current project.
9
9
  class Versioner
10
- include Import[:configuration]
11
10
  include Dry::Monads[:result]
12
11
 
13
12
  def initialize(
@@ -20,12 +19,7 @@ module Gemsmith
20
19
  @model = model
21
20
  end
22
21
 
23
- def call specification
24
- publisher.call specification.version
25
- Success specification
26
- rescue Milestoner::Error => error
27
- Failure error.message
28
- end
22
+ def call(specification) = publisher.call(specification.version).fmap { specification }
29
23
 
30
24
  private
31
25
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemsmith
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.10.0
4
+ version: 22.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2024-06-16 00:00:00.000000000 Z
38
+ date: 2024-07-11 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0.0'
60
+ version: '0.2'
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.0'
67
+ version: '0.2'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: core
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -113,98 +113,98 @@ dependencies:
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '1.6'
116
+ version: '2.1'
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '1.6'
123
+ version: '2.1'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: infusible
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '3.5'
130
+ version: '3.8'
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '3.5'
137
+ version: '3.8'
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: milestoner
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '17.8'
144
+ version: '18.0'
145
145
  type: :runtime
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '17.8'
151
+ version: '18.0'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: refinements
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: '12.1'
158
+ version: '12.5'
159
159
  type: :runtime
160
160
  prerelease: false
161
161
  version_requirements: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: '12.1'
165
+ version: '12.5'
166
166
  - !ruby/object:Gem::Dependency
167
167
  name: rubysmith
168
168
  requirement: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '6.10'
172
+ version: '7.0'
173
173
  type: :runtime
174
174
  prerelease: false
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '6.10'
179
+ version: '7.0'
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: runcom
182
182
  requirement: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '11.0'
186
+ version: '11.5'
187
187
  type: :runtime
188
188
  prerelease: false
189
189
  version_requirements: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: '11.0'
193
+ version: '11.5'
194
194
  - !ruby/object:Gem::Dependency
195
195
  name: sod
196
196
  requirement: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
- version: '0.8'
200
+ version: '0.12'
201
201
  type: :runtime
202
202
  prerelease: false
203
203
  version_requirements: !ruby/object:Gem::Requirement
204
204
  requirements:
205
205
  - - "~>"
206
206
  - !ruby/object:Gem::Version
207
- version: '0.8'
207
+ version: '0.12'
208
208
  - !ruby/object:Gem::Dependency
209
209
  name: spek
210
210
  requirement: !ruby/object:Gem::Requirement
@@ -311,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
311
  - !ruby/object:Gem::Version
312
312
  version: '0'
313
313
  requirements: []
314
- rubygems_version: 3.5.12
314
+ rubygems_version: 3.5.15
315
315
  signing_key:
316
316
  specification_version: 4
317
317
  summary: A command line interface for smithing Ruby gems.
metadata.gz.sig CHANGED
Binary file