rubysmith 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e03056700b4b9b6911da4c481884b6c19aee121d9154e77d92537fa13544401c
4
- data.tar.gz: 8e8a4cd094dcd564e88fe3e989afeeb65dd8f4a68bffada57a7a6199d4fb6286
3
+ metadata.gz: ca0d0b47912e86e319cbd81bd25af112fd467aeab79fcf408ab01ab1446f94b2
4
+ data.tar.gz: c0e00e05dc16bf8976c497c48604ddb73c0b9bc6125b285bff89a137cd0b57fa
5
5
  SHA512:
6
- metadata.gz: 3aff89581481a9b5930a0fc08ed35e7f0061349e1f5db603a5e055475f52d000c5c61b5888baacacdc4f2224e011ea9fa2141a33855c51fed97521803bf3e002
7
- data.tar.gz: 68006a628f491364cc36ae28e6ac233f37389b8a17bcf0caf3c0a2c639e2db47fc713dadeec2ea75cae68a8df96dc2fd2725fdcd47561dc20ceeb82f1c04cad4
6
+ metadata.gz: bcb340f7987ff2b2c79f7c650c83c327e9e8e2dcf70bee01b529ce4a269bbb113b26b5df3f7df97eaeca86b8c953c1677be1501786711a1572a91ccc471553ed
7
+ data.tar.gz: ed94f96e94d3cd4b72d3e60789a5a960fe537b61edb8ce23898a7406ca16db24ea762d0193e44121c91a4678e805c3a6b5381ca60da3715c30e7e037444a733f
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -407,15 +407,17 @@ variables. The default configuration is as follows:
407
407
  :comments:
408
408
  - "# frozen_string_literal: true"
409
409
  :includes:
410
- - "**/*.gemspec"
411
410
  - "**/*.rake"
412
411
  - "**/*.rb"
413
- - "**/*bin/console"
414
- - "**/*bin/guard"
415
- - "**/*bin/rubocop"
416
- - "**/*Gemfile"
417
- - "**/*Guardfile"
418
- - "**/*Rakefile"
412
+ - "*.gemspec"
413
+ - "exe/*"
414
+ - bin/console
415
+ - bin/guard
416
+ - bin/rubocop
417
+ - config.ru
418
+ - Gemfile
419
+ - Guardfile
420
+ - Rakefile
419
421
  :tocer:
420
422
  :includes:
421
423
  - "README.md"
data/exe/rubysmith CHANGED
@@ -3,5 +3,4 @@
3
3
 
4
4
  require "rubysmith"
5
5
 
6
- Process.setproctitle Rubysmith::Identity::VERSION_LABEL
7
6
  Rubysmith::CLI::Shell.new.call ARGV
@@ -19,15 +19,21 @@ module Rubysmith
19
19
  builder.call(configuration.merge(template_path: "%project_name%/lib/%project_path%.rb.erb"))
20
20
  .render
21
21
  .replace(" require", "require")
22
- .replace(/ (?=(Zeit|\.tap|\.setup))/, "")
22
+ .replace(/ (?=(Zeit|loader|end))/, "")
23
23
  .replace("\n \n", "\n\n")
24
+ .insert_before("module #{module_name}", "#{module_indent}# Main namespace.\n")
24
25
 
25
- builder.call(configuration.merge(template_path: "%project_name%/.ruby-version.erb")).render
26
26
  configuration
27
27
  end
28
28
 
29
29
  private
30
30
 
31
+ def module_indent = project_class.include?("::") ? " " : ""
32
+
33
+ def module_name = project_class.split("::").last
34
+
35
+ def project_class = configuration.project_class
36
+
31
37
  attr_reader :configuration, :builder
32
38
  end
33
39
  end
@@ -31,8 +31,8 @@ module Rubysmith
31
31
 
32
32
  def body
33
33
  <<~CONTENT
34
- Generated with [#{Identity::LABEL}]("https://www.alchemists.io/projects/rubysmith")
35
- #{Identity::VERSION}.
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,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,6 +8,7 @@ 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,
@@ -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",
@@ -11,13 +11,16 @@ module Rubysmith
11
11
 
12
12
  def self.call(...) = new(...).call
13
13
 
14
- def initialize configuration = Container[:configuration], client: Parser::CLIENT
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 = "#{Identity::LABEL} - #{Identity::SUMMARY}"
23
+ client.banner = "Rubysmith - #{specification.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
@@ -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 Identity::VERSION_LABEL
36
+ in action_version: true then logger.info { "Rubysmith #{specification.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
@@ -55,15 +55,17 @@
55
55
  :comments:
56
56
  - "# frozen_string_literal: true"
57
57
  :includes:
58
- - "**/*.gemspec"
59
58
  - "**/*.rake"
60
59
  - "**/*.rb"
61
- - "**/*bin/console"
62
- - "**/*bin/guard"
63
- - "**/*bin/rubocop"
64
- - "**/*Gemfile"
65
- - "**/*Guardfile"
66
- - "**/*Rakefile"
60
+ - "*.gemspec"
61
+ - "exe/*"
62
+ - bin/console
63
+ - bin/guard
64
+ - bin/rubocop
65
+ - config.ru
66
+ - Gemfile
67
+ - Guardfile
68
+ - Rakefile
67
69
  :tocer:
68
70
  :includes:
69
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 "#{Identity::NAME}/configuration.yml", defaults: DEFAULTS
17
+ CLIENT = Runcom::Config.new "rubysmith/configuration.yml", defaults: DEFAULTS
18
18
 
19
19
  ENHANCERS = [
20
20
  Enhancers::CurrentTime.new,
@@ -9,7 +9,10 @@ module Rubysmith
9
9
  module Container
10
10
  extend Dry::Container::Mixin
11
11
 
12
+ SPEC_PATH = "#{__dir__}/../../rubysmith.gemspec".freeze
13
+
12
14
  register(:configuration) { Configuration::Loader.call }
15
+ register(:specification) { Gem::Specification.load SPEC_PATH }
13
16
  register(:colorizer) { Pastel.new enabled: $stdout.tty? }
14
17
  register(:kernel) { Kernel }
15
18
 
@@ -20,7 +20,7 @@ module Rubysmith
20
20
  end
21
21
 
22
22
  def call
23
- client.call(settings) if configuration.build_readme
23
+ client.call settings if configuration.build_readme
24
24
  configuration
25
25
  end
26
26
 
@@ -25,7 +25,7 @@ module Rubysmith
25
25
  source = buffer.dup
26
26
 
27
27
  self.buffer = source + if block_given?
28
- scope.call(yield.sub(source, ""))
28
+ scope.call yield.sub(source, "")
29
29
  else
30
30
  scope.call
31
31
  end
@@ -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.0"
23
+ gem "reek", "~> 6.1"
24
24
  <% end %>
25
25
  <% if configuration.build_rubocop %>
26
- gem "rubocop", "~> 1.24"
26
+ gem "rubocop", "~> 1.25"
27
27
  gem "rubocop-performance", "~> 1.12"
28
28
  gem "rubocop-rake", "~> 0.6"
29
29
  <% end %>
@@ -1,12 +1,12 @@
1
1
  <% if configuration.build_zeitwerk %>
2
2
  require "zeitwerk"
3
3
  <% if configuration.project_path.include? "/" %>
4
- Zeitwerk::Loader.new
5
- .tap { |loader| loader.push_dir "#{__dir__}/.." }
6
- .setup
4
+ Zeitwerk::Loader.new.then do |loader|
5
+ loader.push_dir "#{__dir__}/.."
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,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "rubysmith"
5
+ spec.version = "1.2.0"
6
+ spec.platform = Gem::Platform::RUBY
7
+ spec.authors = ["Brooke Kuhlmann"]
8
+ spec.email = ["brooke@alchemists.io"]
9
+ spec.homepage = "https://github.com/bkuhlmann/rubysmith"
10
+ spec.summary = "A command line interface for smithing Ruby projects."
11
+ spec.license = "Hippocratic-3.0"
12
+
13
+ spec.metadata = {
14
+ "bug_tracker_uri" => "https://github.com/bkuhlmann/rubysmith/issues",
15
+ "changelog_uri" => "https://www.alchemists.io/projects/rubysmith/versions",
16
+ "documentation_uri" => "https://www.alchemists.io/projects/rubysmith",
17
+ "label" => "Rubysmith",
18
+ "rubygems_mfa_required" => "true",
19
+ "source_code_uri" => "https://github.com/bkuhlmann/rubysmith"
20
+ }
21
+
22
+ spec.signing_key = Gem.default_key_path
23
+ spec.cert_chain = [Gem.default_cert_path]
24
+
25
+ spec.required_ruby_version = "~> 3.1"
26
+ spec.add_dependency "dry-container", "~> 0.9"
27
+ spec.add_dependency "git_plus", "~> 1.1"
28
+ spec.add_dependency "milestoner", "~> 13.0"
29
+ spec.add_dependency "pastel", "~> 0.8"
30
+ spec.add_dependency "pragmater", "~> 10.0"
31
+ spec.add_dependency "refinements", "~> 9.1"
32
+ spec.add_dependency "rubocop", "~> 1.25"
33
+ spec.add_dependency "runcom", "~> 8.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
+ spec.require_paths = ["lib"]
42
+ 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.1.1
4
+ version: 1.2.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-01-17 00:00:00.000000000 Z
31
+ date: 2022-01-23 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.0'
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.0'
60
+ version: '1.1'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: milestoner
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +120,14 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '1.24'
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.24'
130
+ version: '1.25'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: runcom
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -204,6 +204,7 @@ files:
204
204
  - lib/rubysmith/builders/rspec/helper.rb
205
205
  - lib/rubysmith/builders/rubocop.rb
206
206
  - lib/rubysmith/builders/setup.rb
207
+ - lib/rubysmith/builders/version.rb
207
208
  - lib/rubysmith/cli/actions/build.rb
208
209
  - lib/rubysmith/cli/actions/config.rb
209
210
  - lib/rubysmith/cli/actions/publish.rb
@@ -224,7 +225,6 @@ files:
224
225
  - lib/rubysmith/extensions/pragmater.rb
225
226
  - lib/rubysmith/extensions/rubocop.rb
226
227
  - lib/rubysmith/extensions/tocer.rb
227
- - lib/rubysmith/identity.rb
228
228
  - lib/rubysmith/pathway.rb
229
229
  - lib/rubysmith/renderers/erb.rb
230
230
  - lib/rubysmith/renderers/namespace.rb
@@ -257,6 +257,7 @@ files:
257
257
  - lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb
258
258
  - lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb
259
259
  - lib/rubysmith/text/inserter.rb
260
+ - rubysmith.gemspec
260
261
  homepage: https://github.com/bkuhlmann/rubysmith
261
262
  licenses:
262
263
  - Hippocratic-3.0
@@ -264,6 +265,7 @@ metadata:
264
265
  bug_tracker_uri: https://github.com/bkuhlmann/rubysmith/issues
265
266
  changelog_uri: https://www.alchemists.io/projects/rubysmith/versions
266
267
  documentation_uri: https://www.alchemists.io/projects/rubysmith
268
+ label: Rubysmith
267
269
  rubygems_mfa_required: 'true'
268
270
  source_code_uri: https://github.com/bkuhlmann/rubysmith
269
271
  post_install_message:
metadata.gz.sig CHANGED
Binary file
@@ -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.1.1"
8
- VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
9
- SUMMARY = "A command line interface for smithing Ruby projects."
10
- end
11
- end