rubysmith 4.9.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/README.adoc +91 -117
  4. data/lib/rubysmith/builders/core.rb +0 -1
  5. data/lib/rubysmith/cli/actions/amazing_print.rb +25 -0
  6. data/lib/rubysmith/cli/actions/caliber.rb +25 -0
  7. data/lib/rubysmith/cli/actions/circle_ci.rb +25 -0
  8. data/lib/rubysmith/cli/actions/citation.rb +25 -0
  9. data/lib/rubysmith/cli/actions/community.rb +25 -0
  10. data/lib/rubysmith/cli/actions/conduct.rb +25 -0
  11. data/lib/rubysmith/cli/actions/console.rb +25 -0
  12. data/lib/rubysmith/cli/actions/contributions.rb +25 -0
  13. data/lib/rubysmith/cli/actions/debug.rb +25 -0
  14. data/lib/rubysmith/cli/actions/funding.rb +25 -0
  15. data/lib/rubysmith/cli/actions/git.rb +25 -0
  16. data/lib/rubysmith/cli/actions/git_hub.rb +25 -0
  17. data/lib/rubysmith/cli/actions/git_hub_ci.rb +25 -0
  18. data/lib/rubysmith/cli/actions/git_lint.rb +25 -0
  19. data/lib/rubysmith/cli/actions/guard.rb +25 -0
  20. data/lib/rubysmith/cli/actions/license.rb +25 -0
  21. data/lib/rubysmith/cli/actions/maximum.rb +25 -0
  22. data/lib/rubysmith/cli/actions/minimum.rb +25 -0
  23. data/lib/rubysmith/cli/actions/name.rb +23 -0
  24. data/lib/rubysmith/cli/actions/publish.rb +16 -4
  25. data/lib/rubysmith/cli/actions/rake.rb +25 -0
  26. data/lib/rubysmith/cli/actions/readme.rb +25 -0
  27. data/lib/rubysmith/cli/actions/reek.rb +25 -0
  28. data/lib/rubysmith/cli/actions/refinements.rb +25 -0
  29. data/lib/rubysmith/cli/actions/rspec.rb +25 -0
  30. data/lib/rubysmith/cli/actions/security.rb +25 -0
  31. data/lib/rubysmith/cli/actions/setup.rb +25 -0
  32. data/lib/rubysmith/cli/actions/simple_cov.rb +25 -0
  33. data/lib/rubysmith/cli/actions/versions.rb +25 -0
  34. data/lib/rubysmith/cli/actions/yard.rb +25 -0
  35. data/lib/rubysmith/cli/actions/zeitwerk.rb +25 -0
  36. data/lib/rubysmith/cli/{actions → commands}/build.rb +45 -7
  37. data/lib/rubysmith/cli/shell.rb +20 -18
  38. data/lib/rubysmith/configuration/contract.rb +78 -0
  39. data/lib/rubysmith/configuration/defaults.yml +52 -73
  40. data/lib/rubysmith/configuration/{content.rb → model.rb} +8 -22
  41. data/lib/rubysmith/configuration/transformers/current_time.rb +18 -0
  42. data/lib/rubysmith/configuration/transformers/git_email.rb +19 -0
  43. data/lib/rubysmith/configuration/transformers/git_hub_user.rb +19 -0
  44. data/lib/rubysmith/configuration/transformers/git_user.rb +24 -0
  45. data/lib/rubysmith/configuration/transformers/target_root.rb +18 -0
  46. data/lib/rubysmith/configuration/transformers/template_root.rb +22 -0
  47. data/lib/rubysmith/container.rb +21 -3
  48. data/lib/rubysmith/extensions/milestoner.rb +1 -1
  49. data/lib/rubysmith/extensions/pragmater.rb +8 -8
  50. data/lib/rubysmith/extensions/tocer.rb +8 -8
  51. data/lib/rubysmith/pathway.rb +1 -0
  52. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +4 -4
  53. data/rubysmith.gemspec +16 -13
  54. data.tar.gz.sig +0 -0
  55. metadata +112 -46
  56. metadata.gz.sig +0 -0
  57. data/lib/rubysmith/cli/actions/config.rb +0 -33
  58. data/lib/rubysmith/cli/actions/container.rb +0 -20
  59. data/lib/rubysmith/cli/actions/import.rb +0 -11
  60. data/lib/rubysmith/cli/parser.rb +0 -35
  61. data/lib/rubysmith/cli/parsers/build.rb +0 -307
  62. data/lib/rubysmith/cli/parsers/core.rb +0 -72
  63. data/lib/rubysmith/configuration/enhancers/container.rb +0 -20
  64. data/lib/rubysmith/configuration/enhancers/current_time.rb +0 -14
  65. data/lib/rubysmith/configuration/enhancers/git_email.rb +0 -21
  66. data/lib/rubysmith/configuration/enhancers/git_hub_user.rb +0 -21
  67. data/lib/rubysmith/configuration/enhancers/git_user.rb +0 -25
  68. data/lib/rubysmith/configuration/enhancers/template_root.rb +0 -12
  69. data/lib/rubysmith/configuration/loader.rb +0 -44
@@ -1,59 +1,52 @@
1
- :author:
2
- :email:
3
- :family_name:
4
- :given_name:
5
- :url:
6
- :build:
7
- :amazing_print: true
8
- :caliber: true
9
- :circle_ci: false
10
- :citation: true
11
- :cli: false
12
- :community: false
13
- :conduct: true
14
- :console: true
15
- :contributions: true
16
- :debug: true
17
- :funding: false
18
- :git: true
19
- :git_hub: false
20
- :git_hub_ci: false
21
- :git_lint: true
22
- :guard: true
23
- :license: true
24
- :maximum: false
25
- :minimum: false
26
- :rake: true
27
- :readme: true
28
- :reek: true
29
- :refinements: true
30
- :rspec: true
31
- :security: true
32
- :setup: true
33
- :simple_cov: true
34
- :versions: true
35
- :yard: false
36
- :zeitwerk: true
37
- :citation:
38
- :affiliation:
39
- :message: Please use the following metadata when citing this project in your work.
40
- :orcid:
41
- :documentation:
42
- :format: "adoc"
43
- :extensions:
44
- :milestoner:
45
- :documentation:
46
- :format: "adoc"
47
- :prefixes:
1
+ build:
2
+ amazing_print: true
3
+ caliber: true
4
+ circle_ci: false
5
+ citation: true
6
+ cli: false
7
+ community: false
8
+ conduct: true
9
+ console: true
10
+ contributions: true
11
+ debug: true
12
+ funding: false
13
+ git: true
14
+ git_hub: false
15
+ git_hub_ci: false
16
+ git_lint: true
17
+ guard: true
18
+ license: true
19
+ maximum: false
20
+ minimum: false
21
+ rake: true
22
+ readme: true
23
+ reek: true
24
+ refinements: true
25
+ rspec: true
26
+ security: true
27
+ setup: true
28
+ simple_cov: true
29
+ versions: true
30
+ yard: false
31
+ zeitwerk: true
32
+ citation:
33
+ message: Please use the following metadata when citing this project in your work.
34
+ documentation:
35
+ format: "adoc"
36
+ extensions:
37
+ milestoner:
38
+ documentation:
39
+ format: "adoc"
40
+ prefixes:
48
41
  - Fixed
49
42
  - Added
50
43
  - Updated
51
44
  - Removed
52
45
  - Refactored
53
- :pragmater:
54
- :comments:
46
+ pragmater:
47
+ comments:
55
48
  - "# frozen_string_literal: true"
56
- :includes:
49
+ patterns:
57
50
  - "**/*.rake"
58
51
  - "**/*.rb"
59
52
  - "*.gemspec"
@@ -65,27 +58,13 @@
65
58
  - Gemfile
66
59
  - Guardfile
67
60
  - Rakefile
68
- :tocer:
69
- :includes:
61
+ tocer:
62
+ label: "## Table of Contents"
63
+ patterns:
70
64
  - "README.md"
71
- :label: "## Table of Contents"
72
- :git_hub:
73
- :user:
74
- :license:
75
- :label: Hippocratic
76
- :name: hippocratic
77
- :version: 2.1
78
- :project:
79
- :url:
80
- :community:
81
- :conduct:
82
- :contributions:
83
- :download:
84
- :funding:
85
- :home:
86
- :issues:
87
- :license:
88
- :security:
89
- :source:
90
- :versions:
91
- :version: 0.0.0
65
+ license:
66
+ label: Hippocratic
67
+ name: hippocratic
68
+ version: "2.1"
69
+ project:
70
+ version: 0.0.0
@@ -9,15 +9,7 @@ module Rubysmith
9
9
  # rubocop:disable Metrics/ModuleLength
10
10
  module Configuration
11
11
  # Defines the common configuration content for use throughout the gem.
12
- Content = Struct.new(
13
- :action_build,
14
- :action_config,
15
- :action_edit,
16
- :action_help,
17
- :action_install,
18
- :action_publish,
19
- :action_version,
20
- :action_view,
12
+ Model = Struct.new(
21
13
  :author_email,
22
14
  :author_family_name,
23
15
  :author_given_name,
@@ -59,8 +51,8 @@ module Rubysmith
59
51
  :extensions_milestoner_documentation_format,
60
52
  :extensions_milestoner_prefixes,
61
53
  :extensions_pragmater_comments,
62
- :extensions_pragmater_includes,
63
- :extensions_tocer_includes,
54
+ :extensions_pragmater_patterns,
55
+ :extensions_tocer_patterns,
64
56
  :extensions_tocer_label,
65
57
  :git_hub_user,
66
58
  :license_label,
@@ -88,20 +80,14 @@ module Rubysmith
88
80
  using Refinements::Strings
89
81
  using Refinements::Structs
90
82
 
91
- def initialize target_root: Pathname.pwd, template_roots: [], **arguments
83
+ def initialize(**)
92
84
  super
93
85
  freeze
94
86
  end
95
87
 
96
- def add_template_roots *paths
97
- paths.map { |path| Pathname path }
98
- .including(template_roots)
99
- .then { |roots| dup.merge! template_roots: roots }
100
- end
101
-
102
- def maximize = update_build_options(true)
88
+ def maximize = update_build_options true
103
89
 
104
- def minimize = update_build_options(false)
90
+ def minimize = update_build_options false
105
91
 
106
92
  def author_name = [author_given_name, author_family_name].compress.join(" ")
107
93
 
@@ -150,8 +136,8 @@ module Rubysmith
150
136
  end
151
137
 
152
138
  def template_root
153
- template_roots.map(&:expand_path)
154
- .find { |path| path.join(String(template_path)).exist? }
139
+ Array(template_roots).map(&:expand_path)
140
+ .find { |path| path.join(String(template_path)).exist? }
155
141
  end
156
142
 
157
143
  private
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+
5
+ module Rubysmith
6
+ module Configuration
7
+ # Adds current time to content.
8
+ module Transformers
9
+ include Dry::Monads[:result]
10
+
11
+ CurrentTime = lambda do |content, at: Time.now|
12
+ content.fetch(:now) { at }
13
+ .then { |now| content.merge! now: }
14
+ .then { |updated_content| Dry::Monads::Success updated_content }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+ require "gitt"
5
+
6
+ module Rubysmith
7
+ module Configuration
8
+ # Dynamically adds Git email if defined.
9
+ module Transformers
10
+ include Dry::Monads[:result]
11
+
12
+ GitEmail = lambda do |content, git: Gitt::Repository.new|
13
+ return Dry::Monads::Success content if content[:author_email]
14
+
15
+ git.get("user.email").fmap { |email| content.merge! author_email: email }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+ require "gitt"
5
+
6
+ module Rubysmith
7
+ module Configuration
8
+ # Dynamically adds GitHub user if user is defined.
9
+ module Transformers
10
+ include Dry::Monads[:result]
11
+
12
+ GitHubUser = lambda do |content, git: Gitt::Repository.new|
13
+ return Dry::Monads::Success content if content[:git_hub_user]
14
+
15
+ git.get("github.user").fmap { |user| content.merge! git_hub_user: user }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+ require "gitt"
5
+
6
+ module Rubysmith
7
+ module Configuration
8
+ # Dynamically adds Git user if defined.
9
+ module Transformers
10
+ include Dry::Monads[:result]
11
+
12
+ GitUser = lambda do |content, git: Gitt::Repository.new|
13
+ if content[:author_given_name] || content[:author_family_name]
14
+ Dry::Monads::Success content
15
+ else
16
+ git.get("user.name").fmap do |name|
17
+ first, last = String(name).split
18
+ content.merge author_given_name: first, author_family_name: last
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+
5
+ module Rubysmith
6
+ module Configuration
7
+ # Sets target root which defaults to current directory when key is missing.
8
+ module Transformers
9
+ include Dry::Monads[:result]
10
+
11
+ TargetRoot = lambda do |content, path: Pathname.pwd|
12
+ content.fetch(:target_root) { path }
13
+ .then { |root| content.merge! target_root: root }
14
+ .then { |updated_content| Dry::Monads::Success updated_content }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+ require "refinements/arrays"
5
+
6
+ module Rubysmith
7
+ module Configuration
8
+ # Prepends template roots to existing content.
9
+ module Transformers
10
+ include Dry::Monads[:result]
11
+
12
+ using Refinements::Arrays
13
+
14
+ TemplateRoot = lambda do |content, overrides: Pathname(__dir__).join("../../templates")|
15
+ Array(overrides).map { |path| Pathname path }
16
+ .including(content[:template_roots])
17
+ .compact
18
+ .then { |paths| Dry::Monads::Success content.merge!(template_roots: paths) }
19
+ end
20
+ end
21
+ end
22
+ end
@@ -2,16 +2,34 @@
2
2
 
3
3
  require "cogger"
4
4
  require "dry-container"
5
+ require "etcher"
6
+ require "runcom"
5
7
  require "spek"
6
- require "tone"
7
8
 
8
9
  module Rubysmith
9
10
  # Provides a global gem container for injection into other objects.
10
11
  module Container
11
12
  extend Dry::Container::Mixin
12
13
 
13
- register(:color) { Tone.new }
14
- register(:configuration) { Configuration::Loader.call }
14
+ register :configuration do
15
+ self[:defaults].add_loader(Etcher::Loaders::YAML.new(self[:xdg_config].active))
16
+ .then { |registry| Etcher.call registry }
17
+ end
18
+
19
+ register :defaults do
20
+ Etcher::Registry.new(contract: Configuration::Contract, model: Configuration::Model)
21
+ .add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
22
+ .add_transformer(Configuration::Transformers::CurrentTime)
23
+ .add_transformer(Configuration::Transformers::GitHubUser)
24
+ .add_transformer(Configuration::Transformers::GitEmail)
25
+ .add_transformer(Configuration::Transformers::GitUser)
26
+ .add_transformer(Configuration::Transformers::TemplateRoot)
27
+ .add_transformer(Configuration::Transformers::TargetRoot)
28
+ end
29
+
30
+ register(:input, memoize: true) { self[:configuration].dup }
31
+ register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
32
+ register(:xdg_config) { Runcom::Config.new "rubysmith/configuration.yml" }
15
33
  register(:specification) { Spek::Loader.call "#{__dir__}/../../rubysmith.gemspec" }
16
34
  register(:kernel) { Kernel }
17
35
  register(:logger) { Cogger.new formatter: :emoji }
@@ -13,7 +13,7 @@ module Rubysmith
13
13
 
14
14
  def initialize configuration,
15
15
  client: ::Milestoner::Tags::Publisher.new,
16
- content: ::Milestoner::Configuration::Content.new
16
+ content: ::Milestoner::Configuration::Model.new
17
17
  @configuration = configuration
18
18
  @client = client
19
19
  @content = content
@@ -12,24 +12,24 @@ module Rubysmith
12
12
  def self.call(...) = new(...).call
13
13
 
14
14
  def initialize configuration,
15
- client: ::Pragmater::Runner.new,
16
- content: ::Pragmater::Configuration::Content.new
15
+ client: ::Pragmater::Inserter.new,
16
+ record: ::Pragmater::Configuration::Model.new
17
17
  @configuration = configuration
18
18
  @client = client
19
- @content = content
19
+ @record = record
20
20
  end
21
21
 
22
22
  def call = client.call(settings) && configuration
23
23
 
24
24
  private
25
25
 
26
- attr_reader :configuration, :client, :content
26
+ attr_reader :configuration, :client, :record
27
27
 
28
28
  def settings
29
- content.merge(action_insert: true, root_dir: configuration.project_root)
30
- .transmute! configuration,
31
- comments: :extensions_pragmater_comments,
32
- includes: :extensions_pragmater_includes
29
+ record.merge(root_dir: configuration.project_root)
30
+ .transmute! configuration,
31
+ comments: :extensions_pragmater_comments,
32
+ patterns: :extensions_pragmater_patterns
33
33
  end
34
34
  end
35
35
  end
@@ -5,7 +5,7 @@ require "tocer"
5
5
 
6
6
  module Rubysmith
7
7
  module Extensions
8
- # Ensures project skeleton documentation has table of contents.
8
+ # Ensures project skeleton documentation has table of content.
9
9
  class Tocer
10
10
  using Refinements::Structs
11
11
 
@@ -13,10 +13,10 @@ module Rubysmith
13
13
 
14
14
  def initialize configuration,
15
15
  client: ::Tocer::Runner.new,
16
- content: ::Tocer::Configuration::Content.new
16
+ record: ::Tocer::Configuration::Model.new
17
17
  @configuration = configuration
18
18
  @client = client
19
- @content = content
19
+ @record = record
20
20
  end
21
21
 
22
22
  def call
@@ -26,13 +26,13 @@ module Rubysmith
26
26
 
27
27
  private
28
28
 
29
- attr_reader :configuration, :client, :content
29
+ attr_reader :configuration, :client, :record
30
30
 
31
31
  def settings
32
- content.merge(root_dir: configuration.project_root)
33
- .transmute! configuration,
34
- includes: :extensions_tocer_includes,
35
- label: :extensions_tocer_label
32
+ record.merge(root_dir: configuration.project_root)
33
+ .transmute! configuration,
34
+ label: :extensions_tocer_label,
35
+ patterns: :extensions_tocer_patterns
36
36
  end
37
37
  end
38
38
  end
@@ -7,6 +7,7 @@ module Rubysmith
7
7
  Pathway = Struct.new :start_root, :start_path, :end_root, keyword_init: true do
8
8
  using Refinements::Pathnames
9
9
 
10
+ # :reek:TooManyStatements
10
11
  def initialize *arguments
11
12
  super
12
13
  each_pair { |key, value| self[key] = Pathname value }
@@ -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", "~> 10.0"
6
+ gem "refinements", "~> 11.0"
7
7
  <% end %>
8
8
  <% if configuration.build_zeitwerk %>
9
9
  gem "zeitwerk", "~> 2.6"
@@ -11,10 +11,10 @@ source "https://rubygems.org"
11
11
 
12
12
  group :code_quality do
13
13
  <% if configuration.build_caliber %>
14
- gem "caliber", "~> 0.30"
14
+ gem "caliber", "~> 0.35"
15
15
  <% end %>
16
16
  <% if configuration.build_git && configuration.build_git_lint %>
17
- gem "git-lint", "~> 5.0"
17
+ gem "git-lint", "~> 6.0"
18
18
  <% end %>
19
19
  <% if configuration.build_reek %>
20
20
  gem "reek", "~> 6.1", require: false
@@ -32,7 +32,7 @@ group :development do
32
32
  gem "rake", "~> 13.0"
33
33
  <% end %>
34
34
  <% if configuration.markdown? %>
35
- gem "tocer", "~> 15.0"
35
+ gem "tocer", "~> 16.0"
36
36
  <% end %>
37
37
  <% if configuration.build_yard %>
38
38
  gem "yard", "~> 0.9"
data/rubysmith.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rubysmith"
5
- spec.version = "4.9.0"
5
+ spec.version = "5.0.1"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://github.com/bkuhlmann/rubysmith"
@@ -23,19 +23,22 @@ 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.8"
27
- spec.add_dependency "core", "~> 0.1"
26
+ spec.add_dependency "cogger", "~> 0.10"
28
27
  spec.add_dependency "dry-container", "~> 0.11"
29
- spec.add_dependency "gitt", "~> 1.1"
30
- spec.add_dependency "infusible", "~> 1.0"
31
- spec.add_dependency "milestoner", "~> 15.3"
32
- spec.add_dependency "pragmater", "~> 12.2"
33
- spec.add_dependency "refinements", "~> 10.0"
34
- spec.add_dependency "rubocop", "~> 1.41"
35
- spec.add_dependency "runcom", "~> 9.0"
36
- spec.add_dependency "spek", "~> 1.1"
37
- spec.add_dependency "tocer", "~> 15.2"
38
- spec.add_dependency "tone", "~> 0.1"
28
+ spec.add_dependency "dry-monads", "~> 1.6"
29
+ spec.add_dependency "dry-schema", "~> 1.13"
30
+ spec.add_dependency "etcher", "~> 0.2"
31
+ spec.add_dependency "gitt", "~> 2.0"
32
+ spec.add_dependency "infusible", "~> 2.0"
33
+ spec.add_dependency "milestoner", "~> 16.0"
34
+ spec.add_dependency "pragmater", "~> 13.0"
35
+ spec.add_dependency "refinements", "~> 11.0"
36
+ spec.add_dependency "rubocop", "~> 1.52"
37
+ spec.add_dependency "runcom", "~> 10.0"
38
+ spec.add_dependency "sod", "~> 0.0"
39
+ spec.add_dependency "spek", "~> 2.0"
40
+ spec.add_dependency "tocer", "~> 16.0"
41
+ spec.add_dependency "tone", "~> 0.3"
39
42
  spec.add_dependency "zeitwerk", "~> 2.6"
40
43
 
41
44
  spec.bindir = "exe"
data.tar.gz.sig CHANGED
Binary file