rubysmith 0.16.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/LICENSE.adoc +207 -155
  4. data/README.adoc +360 -104
  5. data/exe/rubysmith +0 -1
  6. data/lib/rubysmith/builder.rb +1 -2
  7. data/lib/rubysmith/builders/bundler.rb +7 -11
  8. data/lib/rubysmith/builders/circle_ci.rb +8 -2
  9. data/lib/rubysmith/builders/console.rb +8 -2
  10. data/lib/rubysmith/builders/core.rb +14 -4
  11. data/lib/rubysmith/builders/documentation/{change.rb → citation.rb} +8 -8
  12. data/lib/rubysmith/builders/documentation/license.rb +9 -4
  13. data/lib/rubysmith/builders/documentation/readme.rb +12 -18
  14. data/lib/rubysmith/builders/documentation/{contribution.rb → version.rb} +10 -5
  15. data/lib/rubysmith/builders/git/commit.rb +5 -3
  16. data/lib/rubysmith/builders/{rubocop/setup.rb → git/ignore.rb} +11 -7
  17. data/lib/rubysmith/builders/git/setup.rb +2 -1
  18. data/lib/rubysmith/builders/git_hub.rb +8 -3
  19. data/lib/rubysmith/builders/guard.rb +9 -3
  20. data/lib/rubysmith/builders/rake.rb +9 -3
  21. data/lib/rubysmith/builders/reek.rb +7 -2
  22. data/lib/rubysmith/builders/rspec/context.rb +8 -2
  23. data/lib/rubysmith/builders/rspec/helper.rb +8 -2
  24. data/lib/rubysmith/builders/rubocop.rb +34 -0
  25. data/lib/rubysmith/builders/setup.rb +8 -2
  26. data/lib/rubysmith/builders/version.rb +28 -0
  27. data/lib/rubysmith/cli/actions/build.rb +12 -12
  28. data/lib/rubysmith/cli/actions/config.rb +4 -2
  29. data/lib/rubysmith/cli/actions/publish.rb +21 -0
  30. data/lib/rubysmith/cli/parser.rb +31 -0
  31. data/lib/rubysmith/cli/parsers/build.rb +98 -45
  32. data/lib/rubysmith/cli/parsers/core.rb +18 -9
  33. data/lib/rubysmith/cli/shell.rb +23 -14
  34. data/lib/rubysmith/configuration/content.rb +174 -0
  35. data/lib/rubysmith/configuration/defaults.yml +91 -0
  36. data/lib/rubysmith/configuration/enhancers/current_time.rb +24 -0
  37. data/lib/rubysmith/configuration/enhancers/git_email.rb +31 -0
  38. data/lib/rubysmith/configuration/enhancers/git_hub_user.rb +31 -0
  39. data/lib/rubysmith/configuration/enhancers/git_user.rb +33 -0
  40. data/lib/rubysmith/configuration/loader.rb +48 -0
  41. data/lib/rubysmith/container.rb +4 -1
  42. data/lib/rubysmith/extensions/bundler.rb +30 -0
  43. data/lib/rubysmith/extensions/milestoner.rb +37 -0
  44. data/lib/rubysmith/extensions/pragmater.rb +36 -0
  45. data/lib/rubysmith/extensions/rubocop.rb +29 -0
  46. data/lib/rubysmith/extensions/tocer.rb +39 -0
  47. data/lib/rubysmith/renderers/erb.rb +9 -1
  48. data/lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb +1 -4
  49. data/lib/rubysmith/templates/%project_name%/.gitignore.erb +11 -0
  50. data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +2 -0
  51. data/lib/rubysmith/templates/%project_name%/CITATION.cff.erb +16 -0
  52. data/lib/rubysmith/templates/%project_name%/Gemfile.erb +19 -10
  53. data/lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.adoc.erb +214 -0
  54. data/lib/rubysmith/templates/%project_name%/LICENSE-hippocratic.md.erb +214 -0
  55. data/lib/rubysmith/templates/%project_name%/README.adoc.erb +20 -21
  56. data/lib/rubysmith/templates/%project_name%/README.md.erb +20 -21
  57. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +9 -0
  58. data/lib/rubysmith/templates/%project_name%/VERSIONS.adoc.erb +5 -0
  59. data/lib/rubysmith/templates/%project_name%/VERSIONS.md.erb +5 -0
  60. data/lib/rubysmith/templates/%project_name%/bin/rubocop.erb +0 -1
  61. data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +4 -4
  62. data/rubysmith.gemspec +42 -0
  63. data.tar.gz.sig +0 -0
  64. metadata +59 -39
  65. metadata.gz.sig +0 -0
  66. data/lib/rubysmith/builders/documentation/conduct.rb +0 -32
  67. data/lib/rubysmith/builders/pragma.rb +0 -32
  68. data/lib/rubysmith/builders/rubocop/formatter.rb +0 -31
  69. data/lib/rubysmith/cli/configuration/content.rb +0 -97
  70. data/lib/rubysmith/cli/configuration/defaults.yml +0 -46
  71. data/lib/rubysmith/cli/configuration/enhancers/current_time.rb +0 -26
  72. data/lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb +0 -33
  73. data/lib/rubysmith/cli/configuration/enhancers/version.rb +0 -26
  74. data/lib/rubysmith/cli/configuration/loader.rb +0 -46
  75. data/lib/rubysmith/cli/parsers/assembler.rb +0 -32
  76. data/lib/rubysmith/cli/parsers.rb +0 -11
  77. data/lib/rubysmith/identity.rb +0 -11
  78. data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +0 -5
  79. data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +0 -5
  80. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +0 -114
  81. data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +0 -115
  82. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.adoc.erb +0 -22
  83. data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.md.erb +0 -22
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton Circle CI configuration.
6
8
  class CircleCI
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,10 +16,12 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_circle_ci
19
+ return configuration unless configuration.build_circle_ci
16
20
 
17
- builder.call(configuration.with(template_path: "%project_name%/.circleci/config.yml.erb"))
21
+ builder.call(configuration.merge(template_path: "%project_name%/.circleci/config.yml.erb"))
18
22
  .render
23
+
24
+ configuration
19
25
  end
20
26
 
21
27
  private
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton console for object inspection and exploration.
6
8
  class Console
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,11 +16,13 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_console
19
+ return configuration unless configuration.build_console
16
20
 
17
- builder.call(configuration.with(template_path: "%project_name%/bin/console.erb"))
21
+ builder.call(configuration.merge(template_path: "%project_name%/bin/console.erb"))
18
22
  .render
19
23
  .permit 0o755
24
+
25
+ configuration
20
26
  end
21
27
 
22
28
  private
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton core structure and minimum file support.
6
8
  class Core
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,18 +16,24 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- builder.call(configuration.with(template_path: "%project_name%/lib/%project_path%.rb.erb"))
19
+ builder.call(configuration.merge(template_path: "%project_name%/lib/%project_path%.rb.erb"))
16
20
  .render
17
21
  .replace(" require", "require")
18
- .replace(/ (?=(Zeit|\.tap|\.setup))/, "")
22
+ .replace(/ (?=(Zeit|loader|end))/, "")
19
23
  .replace("\n \n", "\n\n")
24
+ .insert_before("module #{module_name}", "#{module_indent}# Main namespace.\n")
20
25
 
21
- builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
22
- nil
26
+ configuration
23
27
  end
24
28
 
25
29
  private
26
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
+
27
37
  attr_reader :configuration, :builder
28
38
  end
29
39
  end
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "tocer"
3
+ require "refinements/structs"
4
4
 
5
5
  module Rubysmith
6
6
  module Builders
7
7
  module Documentation
8
- # Builds project skeleton CHANGES documentation.
9
- class Change
8
+ # Builds project skeleton citation documentation.
9
+ class Citation
10
+ using Refinements::Structs
11
+
10
12
  def self.call(...) = new(...).call
11
13
 
12
14
  def initialize configuration, builder: Builder
@@ -15,17 +17,15 @@ module Rubysmith
15
17
  end
16
18
 
17
19
  def call
18
- return unless configuration.build_changes
20
+ return configuration unless configuration.build_citation
19
21
 
20
- builder.call(configuration.with(template_path: "%project_name%/CHANGES.#{kind}.erb"))
21
- .render
22
+ builder.call(configuration.merge(template_path: "%project_name%/CITATION.cff.erb")).render
23
+ configuration
22
24
  end
23
25
 
24
26
  private
25
27
 
26
28
  attr_reader :configuration, :builder
27
-
28
- def kind = configuration.documentation_format || "md"
29
29
  end
30
30
  end
31
31
  end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "tocer"
4
+ require "refinements/structs"
4
5
 
5
6
  module Rubysmith
6
7
  module Builders
7
8
  module Documentation
8
9
  # Builds project skeleton LICENSE documentation.
9
10
  class License
11
+ using Refinements::Structs
12
+
10
13
  def self.call(...) = new(...).call
11
14
 
12
15
  def initialize configuration, builder: Builder
@@ -15,21 +18,23 @@ module Rubysmith
15
18
  end
16
19
 
17
20
  def call
18
- return unless configuration.build_license
21
+ return configuration unless configuration.build_license
19
22
 
20
- configuration.with(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
23
+ configuration.merge(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
21
24
  .then do |updated_configuration|
22
25
  builder.call(updated_configuration).render.rename "LICENSE.#{kind}"
23
26
  end
27
+
28
+ configuration
24
29
  end
25
30
 
26
31
  private
27
32
 
28
33
  attr_reader :configuration, :builder
29
34
 
30
- def kind = configuration.documentation_format || "md"
35
+ def kind = configuration.documentation_format
31
36
 
32
- def license = configuration.documentation_license || "mit"
37
+ def license = configuration.license_name
33
38
  end
34
39
  end
35
40
  end
@@ -1,43 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "tocer"
4
+ require "refinements/structs"
4
5
 
5
6
  module Rubysmith
6
7
  module Builders
7
8
  module Documentation
8
9
  # Builds project skeleton README documentation.
9
10
  class Readme
11
+ using Refinements::Structs
12
+
10
13
  def self.call(...) = new(...).call
11
14
 
12
- def initialize configuration, builder: Builder, tocer: Tocer::Writer.new
15
+ def initialize configuration, builder: Builder
13
16
  @configuration = configuration
14
17
  @builder = builder
15
- @tocer = tocer
16
18
  end
17
19
 
18
20
  def call
19
- return unless configuration.build_readme
21
+ return configuration unless configuration.build_readme
22
+
23
+ builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
24
+ .render
25
+ .replace(/\n{2,}/, "\n\n")
20
26
 
21
- private_methods.sort.grep(/render_/).each { |method| __send__ method }
27
+ configuration
22
28
  end
23
29
 
24
30
  private
25
31
 
26
- attr_reader :configuration, :builder, :tocer
27
-
28
- def render_content
29
- builder.call(configuration.with(template_path: "%project_name%/README.#{kind}.erb"))
30
- .render
31
- .replace("\n\n\n", "\n\n")
32
- end
33
-
34
- def render_table_of_contents
35
- configuration.project_root
36
- .join("README.md")
37
- .then { |path| tocer.call path if path.exist? }
38
- end
32
+ attr_reader :configuration, :builder
39
33
 
40
- def kind = configuration.documentation_format || "md"
34
+ def kind = configuration.documentation_format
41
35
  end
42
36
  end
43
37
  end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "tocer"
4
+ require "refinements/structs"
4
5
 
5
6
  module Rubysmith
6
7
  module Builders
7
8
  module Documentation
8
- # Builds project skeleton CONTRIBUTING documentation.
9
- class Contribution
9
+ # Builds project skeleton version history.
10
+ class Version
11
+ using Refinements::Structs
12
+
10
13
  def self.call(...) = new(...).call
11
14
 
12
15
  def initialize configuration, builder: Builder
@@ -15,17 +18,19 @@ module Rubysmith
15
18
  end
16
19
 
17
20
  def call
18
- return unless configuration.build_contributions
21
+ return configuration unless configuration.build_versions
19
22
 
20
- builder.call(configuration.with(template_path: "%project_name%/CONTRIBUTING.#{kind}.erb"))
23
+ builder.call(configuration.merge(template_path: "%project_name%/VERSIONS.#{kind}.erb"))
21
24
  .render
25
+
26
+ configuration
22
27
  end
23
28
 
24
29
  private
25
30
 
26
31
  attr_reader :configuration, :builder
27
32
 
28
- def kind = configuration.documentation_format || "md"
33
+ def kind = configuration.documentation_format
29
34
  end
30
35
  end
31
36
  end
@@ -13,7 +13,7 @@ module Rubysmith
13
13
  end
14
14
 
15
15
  def call
16
- return unless configuration.build_git
16
+ return configuration unless configuration.build_git
17
17
 
18
18
  builder.call(configuration)
19
19
  .run("git add .", chdir: project_name)
@@ -21,6 +21,8 @@ module Rubysmith
21
21
  %(git commit --all --message "Added project skeleton" --message "#{body}"),
22
22
  chdir: project_name
23
23
  )
24
+
25
+ configuration
24
26
  end
25
27
 
26
28
  private
@@ -29,8 +31,8 @@ module Rubysmith
29
31
 
30
32
  def body
31
33
  <<~CONTENT
32
- Generated with [#{Identity::LABEL}]("https://www.alchemists.io/projects/rubysmith")
33
- #{Identity::VERSION}.
34
+ Generated with [Rubysmith](https://www.alchemists.io/projects/rubysmith)
35
+ 1.1.1.
34
36
  CONTENT
35
37
  end
36
38
 
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
- module Rubocop
6
- # Builds project skeleton for Rubocop code quality support.
7
- class Setup
7
+ module Git
8
+ # Builds Git repository directory and file ignore configuration.
9
+ class Ignore
10
+ using Refinements::Structs
11
+
8
12
  def self.call(...) = new(...).call
9
13
 
10
14
  def initialize configuration, builder: Builder
@@ -13,13 +17,13 @@ module Rubysmith
13
17
  end
14
18
 
15
19
  def call
16
- return unless configuration.build_rubocop
20
+ return configuration unless configuration.build_git
17
21
 
18
- builder.call(configuration.with(template_path: "%project_name%/bin/rubocop.erb"))
22
+ builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
19
23
  .render
20
- .permit 0o755
24
+ .replace(" ", "")
21
25
 
22
- builder.call(configuration.with(template_path: "%project_name%/.rubocop.yml.erb")).render
26
+ configuration
23
27
  end
24
28
 
25
29
  private
@@ -13,9 +13,10 @@ module Rubysmith
13
13
  end
14
14
 
15
15
  def call
16
- return unless configuration.build_git
16
+ return configuration unless configuration.build_git
17
17
 
18
18
  builder.call(configuration).run("git init", chdir: configuration.project_name)
19
+ configuration
19
20
  end
20
21
 
21
22
  private
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton GitHub templates.
6
8
  class GitHub
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,10 +16,11 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_git_hub
19
+ return configuration unless configuration.build_git_hub
16
20
 
17
21
  builder.call(with_issue_template).render
18
22
  builder.call(with_pull_request_template).render
23
+ configuration
19
24
  end
20
25
 
21
26
  private
@@ -23,11 +28,11 @@ module Rubysmith
23
28
  attr_reader :configuration, :builder
24
29
 
25
30
  def with_issue_template
26
- configuration.with template_path: "%project_name%/.github/ISSUE_TEMPLATE.md.erb"
31
+ configuration.merge template_path: "%project_name%/.github/ISSUE_TEMPLATE.md.erb"
27
32
  end
28
33
 
29
34
  def with_pull_request_template
30
- configuration.with template_path: "%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb"
35
+ configuration.merge template_path: "%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb"
31
36
  end
32
37
  end
33
38
  end
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton Guard support for a red, green, refactor loop.
6
8
  class Guard
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,12 +16,14 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_guard
19
+ return configuration unless configuration.build_guard
16
20
 
17
- builder.call(configuration.with(template_path: "%project_name%/bin/guard.erb"))
21
+ builder.call(configuration.merge(template_path: "%project_name%/bin/guard.erb"))
18
22
  .render
19
23
  .permit 0o755
20
- builder.call(configuration.with(template_path: "%project_name%/Guardfile.erb")).render
24
+
25
+ builder.call(configuration.merge(template_path: "%project_name%/Guardfile.erb")).render
26
+ configuration
21
27
  end
22
28
 
23
29
  private
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton Rake support.
6
8
  class Rake
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,16 +16,18 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_rake
19
+ return configuration unless configuration.build_rake
16
20
 
17
- builder.call(configuration.with(template_path: "%project_name%/Rakefile.erb"))
21
+ builder.call(configuration.merge(template_path: "%project_name%/Rakefile.erb"))
18
22
  .render
19
23
  .replace(/\[\s+/, "[")
20
24
  .replace(/\s+\]/, "]")
21
25
  .replace(" ", "")
26
+ .replace("task.", " task.")
22
27
  .replace(/\n+(?=require)/, "\n")
23
28
  .replace(/\n{2,}/, "\n\n")
24
- nil
29
+
30
+ configuration
25
31
  end
26
32
 
27
33
  private
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton Reek code quality support.
6
8
  class Reek
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,9 +16,10 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_reek
19
+ return configuration unless configuration.build_reek
16
20
 
17
- builder.call(configuration.with(template_path: "%project_name%/.reek.yml.erb")).render
21
+ builder.call(configuration.merge(template_path: "%project_name%/.reek.yml.erb")).render
22
+ configuration
18
23
  end
19
24
 
20
25
  private
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  module RSpec
6
8
  # Builds RSpec shared context for temporary directories.
7
9
  class Context
10
+ using Refinements::Structs
11
+
8
12
  def self.call(...) = new(...).call
9
13
 
10
14
  def initialize configuration, builder: Builder
@@ -13,13 +17,15 @@ module Rubysmith
13
17
  end
14
18
 
15
19
  def call
16
- return unless configuration.build_rspec
20
+ return configuration unless configuration.build_rspec
17
21
 
18
22
  template = "%project_name%/spec/support/shared_contexts/temp_dir.rb.erb"
19
- configuration.with(template_path: template)
23
+ configuration.merge(template_path: template)
20
24
  .then { |updated_configuration| builder.call updated_configuration }
21
25
  .render
22
26
  .replace(/\n\s+\n\s+/, "\n ")
27
+
28
+ configuration
23
29
  end
24
30
 
25
31
  private
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  module RSpec
6
8
  # Builds RSpec spec helper for project skeleton.
7
9
  class Helper
10
+ using Refinements::Structs
11
+
8
12
  def self.call(...) = new(...).call
9
13
 
10
14
  def initialize configuration, builder: Builder
@@ -13,12 +17,14 @@ module Rubysmith
13
17
  end
14
18
 
15
19
  def call
16
- return unless configuration.build_rspec
20
+ return configuration unless configuration.build_rspec
17
21
 
18
- builder.call(configuration.with(template_path: "%project_name%/spec/spec_helper.rb.erb"))
22
+ builder.call(configuration.merge(template_path: "%project_name%/spec/spec_helper.rb.erb"))
19
23
  .render
20
24
  .replace(/\n{3,}/, "\n\n")
21
25
  .replace(/\n\s{2}(?=(require|Simple|using|Pathname|Dir))/, "\n")
26
+
27
+ configuration
22
28
  end
23
29
 
24
30
  private
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/structs"
4
+
5
+ module Rubysmith
6
+ module Builders
7
+ # Builds project skeleton with RuboCop code quality support.
8
+ class Rubocop
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
+ return configuration unless configuration.build_rubocop
20
+
21
+ builder.call(configuration.merge(template_path: "%project_name%/bin/rubocop.erb"))
22
+ .render
23
+ .permit 0o755
24
+
25
+ builder.call(configuration.merge(template_path: "%project_name%/.rubocop.yml.erb")).render
26
+ configuration
27
+ end
28
+
29
+ private
30
+
31
+ attr_reader :configuration, :builder
32
+ end
33
+ end
34
+ end
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/structs"
4
+
3
5
  module Rubysmith
4
6
  module Builders
5
7
  # Builds project skeleton setup script.
6
8
  class Setup
9
+ using Refinements::Structs
10
+
7
11
  def self.call(...) = new(...).call
8
12
 
9
13
  def initialize configuration, builder: Builder
@@ -12,11 +16,13 @@ module Rubysmith
12
16
  end
13
17
 
14
18
  def call
15
- return unless configuration.build_setup
19
+ return configuration unless configuration.build_setup
16
20
 
17
- builder.call(configuration.with(template_path: "%project_name%/bin/setup.erb"))
21
+ builder.call(configuration.merge(template_path: "%project_name%/bin/setup.erb"))
18
22
  .render
19
23
  .permit 0o755
24
+
25
+ configuration
20
26
  end
21
27
 
22
28
  private
@@ -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