rubysmith 5.1.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/rubysmith/builder.rb +15 -4
  4. data/lib/rubysmith/builders/init.rb +29 -0
  5. data/lib/rubysmith/builders/rake.rb +1 -1
  6. data/lib/rubysmith/builders/rspec/helper.rb +1 -0
  7. data/lib/rubysmith/cli/actions/amazing_print.rb +1 -4
  8. data/lib/rubysmith/cli/actions/caliber.rb +1 -4
  9. data/lib/rubysmith/cli/actions/circle_ci.rb +1 -4
  10. data/lib/rubysmith/cli/actions/citation.rb +1 -4
  11. data/lib/rubysmith/cli/actions/community.rb +1 -4
  12. data/lib/rubysmith/cli/actions/conduct.rb +1 -4
  13. data/lib/rubysmith/cli/actions/console.rb +1 -4
  14. data/lib/rubysmith/cli/actions/contributions.rb +1 -4
  15. data/lib/rubysmith/cli/actions/debug.rb +1 -4
  16. data/lib/rubysmith/cli/actions/funding.rb +1 -4
  17. data/lib/rubysmith/cli/actions/git.rb +1 -4
  18. data/lib/rubysmith/cli/actions/git_hub.rb +1 -4
  19. data/lib/rubysmith/cli/actions/git_hub_ci.rb +1 -4
  20. data/lib/rubysmith/cli/actions/git_lint.rb +1 -4
  21. data/lib/rubysmith/cli/actions/guard.rb +1 -4
  22. data/lib/rubysmith/cli/actions/license.rb +1 -4
  23. data/lib/rubysmith/cli/actions/maximum.rb +1 -1
  24. data/lib/rubysmith/cli/actions/minimum.rb +1 -1
  25. data/lib/rubysmith/cli/actions/name.rb +1 -4
  26. data/lib/rubysmith/cli/actions/publish.rb +2 -2
  27. data/lib/rubysmith/cli/actions/rake.rb +1 -4
  28. data/lib/rubysmith/cli/actions/readme.rb +1 -4
  29. data/lib/rubysmith/cli/actions/reek.rb +1 -4
  30. data/lib/rubysmith/cli/actions/refinements.rb +1 -4
  31. data/lib/rubysmith/cli/actions/rspec.rb +1 -4
  32. data/lib/rubysmith/cli/actions/security.rb +1 -4
  33. data/lib/rubysmith/cli/actions/setup.rb +1 -4
  34. data/lib/rubysmith/cli/actions/simple_cov.rb +1 -4
  35. data/lib/rubysmith/cli/actions/versions.rb +1 -4
  36. data/lib/rubysmith/cli/actions/yard.rb +1 -4
  37. data/lib/rubysmith/cli/actions/zeitwerk.rb +1 -4
  38. data/lib/rubysmith/cli/commands/build.rb +1 -2
  39. data/lib/rubysmith/configuration/model.rb +0 -2
  40. data/lib/rubysmith/configuration/transformers/git_email.rb +7 -3
  41. data/lib/rubysmith/configuration/transformers/git_hub_user.rb +7 -3
  42. data/lib/rubysmith/configuration/transformers/git_user.rb +12 -2
  43. data/lib/rubysmith/templates/%project_name%/Rakefile.erb +1 -1
  44. data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
  45. data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +2 -3
  46. data/rubysmith.gemspec +1 -1
  47. data.tar.gz.sig +0 -0
  48. metadata +3 -2
  49. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bf7aff137172ca7f7959152c9a6550f1453ae79c9f0947048b3f829ae118b5c
4
- data.tar.gz: 97a5b9c2fcf8204aa77b84bd159888f93808aa0dcc7693547d0aa3104cb226b2
3
+ metadata.gz: cc23eb9d3a6f0e1d1d06c596462a9c8622b921d51b637890fdd37fc4141b30d7
4
+ data.tar.gz: 67da0c327b758738432249bb9f061c76ed5c7db30697d81bbd66cde1502b354f
5
5
  SHA512:
6
- metadata.gz: cfbbafd5a69876cd04a2d6d980c3ffccf95efe7a70d595983953bf62efcd557e49433f34dc954069b135e90372f601837c9b9f7ee50534fb0c0b61c2b73c86b9
7
- data.tar.gz: 520c7dccfd4bde72ceb2678fbc6e7ceb1d5a246c17261858d22577b92965463998968dbf3cf50e44847c64484aff1fee4795d220364ceeef749fb4bee967450e
6
+ metadata.gz: 252f2eaf5a0e6c6c5c73173ad3a1e8cec42e15f87ed6791f40433cd5daf066039e4971bed9bde24af7d71fd815b82c4becb9fb61a44c85e87b0ecb0be63e5631
7
+ data.tar.gz: 3ed51c609c79770c5e080400a89464ea1a517e5c2278c190ecd32b9ae7fcebbc025a545856327a889fd809d8c921cca2fb8b52132da72c00b0652701a96eb506
checksums.yaml.gz.sig CHANGED
Binary file
@@ -7,11 +7,11 @@ require "refinements/pathnames"
7
7
  module Rubysmith
8
8
  # Provides common functionality necessary for all builders.
9
9
  class Builder
10
- include Import[:logger]
10
+ include Import[:kernel, :logger]
11
11
 
12
12
  using Refinements::Pathnames
13
13
 
14
- HELPERS = {inserter: Text::Inserter, renderer: Renderers::ERB, kernel: Open3}.freeze
14
+ HELPERS = {inserter: Text::Inserter, renderer: Renderers::ERB, executor: Open3}.freeze
15
15
 
16
16
  def self.call(...) = new(...)
17
17
 
@@ -27,6 +27,17 @@ module Rubysmith
27
27
  self
28
28
  end
29
29
 
30
+ def check
31
+ path = build_path
32
+
33
+ if path.exist?
34
+ log_error "Path exists: #{path}."
35
+ kernel.abort
36
+ else
37
+ log_debug "Checked: #{path}."
38
+ end
39
+ end
40
+
30
41
  def delete
31
42
  log_debug "Deleting: #{relative_build_path}"
32
43
  build_path.delete
@@ -104,7 +115,7 @@ module Rubysmith
104
115
  attr_reader :configuration, :helpers
105
116
 
106
117
  def execute *command
107
- kernel.capture2e(*command).then do |result, status|
118
+ executor.capture2e(*command).then do |result, status|
108
119
  log_error result unless status.success?
109
120
  end
110
121
  end
@@ -113,7 +124,7 @@ module Rubysmith
113
124
 
114
125
  def renderer = helpers.fetch(__method__).new(configuration)
115
126
 
116
- def kernel = helpers.fetch(__method__)
127
+ def executor = helpers.fetch(__method__)
117
128
 
118
129
  def relative_build_path = build_path.relative_path_from(configuration.target_root)
119
130
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require "refinements/structs"
5
+
6
+ module Rubysmith
7
+ module Builders
8
+ # Initializes building of project by checking for existence first.
9
+ class Init
10
+ using Refinements::Structs
11
+
12
+ def self.call(...) = new(...).call
13
+
14
+ def initialize configuration, builder: Builder
15
+ @configuration = configuration
16
+ @builder = builder
17
+ end
18
+
19
+ def call
20
+ builder.call(configuration.merge(template_path: "%project_name%")).check
21
+ configuration
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :configuration, :builder
27
+ end
28
+ end
29
+ end
@@ -39,7 +39,7 @@ module Rubysmith
39
39
  .replace(/\[\s+/, "[")
40
40
  .replace(/\s+\]/, "]")
41
41
  .replace(" ", "")
42
- .replace("task.", " task.")
42
+ .replace("task.options", " task.options")
43
43
  .replace(/\n+(?=require)/, "\n")
44
44
  .replace(/\n{2,}/, "\n\n")
45
45
  end
@@ -21,6 +21,7 @@ module Rubysmith
21
21
 
22
22
  builder.call(configuration.merge(template_path: "%project_name%/spec/spec_helper.rb.erb"))
23
23
  .render
24
+ .replace(/\A\n/, "")
24
25
  .replace("\n\n\n", "\n\n")
25
26
 
26
27
  configuration
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class AmazingPrint < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Amazing Print gem."
16
13
 
17
14
  on "--[no-]amazing_print"
18
15
 
19
16
  default { Container[:configuration].build_amazing_print }
20
17
 
21
- def call(value = default) = input.merge!(build_amazing_print: value)
18
+ def call(value = nil) = input.build_amazing_print = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Caliber < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Caliber gem."
16
13
 
17
14
  on "--[no-]caliber"
18
15
 
19
16
  default { Container[:configuration].build_caliber }
20
17
 
21
- def call(value = default) = input.merge!(build_caliber: value)
18
+ def call(value = nil) = input.build_caliber = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class CircleCI < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Circle CI configuration."
16
13
 
17
14
  on "--[no-]circle_ci"
18
15
 
19
16
  default { Container[:configuration].build_circle_ci }
20
17
 
21
- def call(value = default) = input.merge!(build_circle_ci: value)
18
+ def call(value = nil) = input.build_circle_ci = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Citation < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add citation documentation."
16
13
 
17
14
  on "--[no-]citation"
18
15
 
19
16
  default { Container[:configuration].build_citation }
20
17
 
21
- def call(value = default) = input.merge!(build_citation: value)
18
+ def call(value = nil) = input.build_citation = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Community < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add community documentation."
16
13
 
17
14
  on "--[no-]community"
18
15
 
19
16
  default { Container[:configuration].build_community }
20
17
 
21
- def call(value = default) = input.merge!(build_community: value)
18
+ def call(value = nil) = input.build_community = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Conduct < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add code of conduct documentation."
16
13
 
17
14
  on "--[no-]conduct"
18
15
 
19
16
  default { Container[:configuration].build_conduct }
20
17
 
21
- def call(value = default) = input.merge!(build_conduct: value)
18
+ def call(value = nil) = input.build_conduct = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Console < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add console script."
16
13
 
17
14
  on "--[no-]console"
18
15
 
19
16
  default { Container[:configuration].build_console }
20
17
 
21
- def call(value = default) = input.merge!(build_console: value)
18
+ def call(value = nil) = input.build_console = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Contributions < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add contributions documentation."
16
13
 
17
14
  on "--[no-]contributions"
18
15
 
19
16
  default { Container[:configuration].build_contributions }
20
17
 
21
- def call(value = default) = input.merge!(build_contributions: value)
18
+ def call(value = nil) = input.build_contributions = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Debug < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Debug gem."
16
13
 
17
14
  on "--[no-]debug"
18
15
 
19
16
  default { Container[:configuration].build_debug }
20
17
 
21
- def call(value = default) = input.merge!(build_debug: value)
18
+ def call(value = nil) = input.build_debug = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Funding < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add GitHub funding configuration."
16
13
 
17
14
  on "--[no-]funding"
18
15
 
19
16
  default { Container[:configuration].build_funding }
20
17
 
21
- def call(value = default) = input.merge!(build_funding: value)
18
+ def call(value = nil) = input.build_funding = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Git < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Git repository."
16
13
 
17
14
  on "--[no-]git"
18
15
 
19
16
  default { Container[:configuration].build_git }
20
17
 
21
- def call(value = default) = input.merge!(build_git: value)
18
+ def call(value = nil) = input.build_git = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class GitHub < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add GitHub templates."
16
13
 
17
14
  on "--[no-]git_hub"
18
15
 
19
16
  default { Container[:configuration].build_git_hub }
20
17
 
21
- def call(value = default) = input.merge!(build_git_hub: value)
18
+ def call(value = nil) = input.build_git_hub = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class GitHubCI < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add GitHub continuous integration."
16
13
 
17
14
  on "--[no-]git_hub_ci"
18
15
 
19
16
  default { Container[:configuration].build_git_hub_ci }
20
17
 
21
- def call(value = default) = input.merge!(build_git_hub_ci: value)
18
+ def call(value = nil) = input.build_git_hub_ci = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class GitLint < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Git Lint gem."
16
13
 
17
14
  on "--[no-]git-lint"
18
15
 
19
16
  default { Container[:configuration].build_git_lint }
20
17
 
21
- def call(value = default) = input.merge!(build_git_lint: value)
18
+ def call(value = nil) = input.build_git_lint = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Guard < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Guard gem."
16
13
 
17
14
  on "--[no-]guard"
18
15
 
19
16
  default { Container[:configuration].build_guard }
20
17
 
21
- def call(value = default) = input.merge!(build_guard: value)
18
+ def call(value = nil) = input.build_guard = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class License < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add license documentation."
16
13
 
17
14
  on "--[no-]license"
18
15
 
19
16
  default { Container[:configuration].build_license }
20
17
 
21
- def call(value = default) = input.merge!(build_license: value)
18
+ def call(value = nil) = input.build_license = value
22
19
  end
23
20
  end
24
21
  end
@@ -18,7 +18,7 @@ module Rubysmith
18
18
 
19
19
  default { Container[:configuration].build_maximum }
20
20
 
21
- def call(*) = input.merge!(input.maximize)
21
+ def call(*) = input.merge! input.maximize
22
22
  end
23
23
  end
24
24
  end
@@ -18,7 +18,7 @@ module Rubysmith
18
18
 
19
19
  default { Container[:configuration].build_minimum }
20
20
 
21
- def call(*) = input.merge!(input.minimize)
21
+ def call(*) = input.merge! input.minimize
22
22
  end
23
23
  end
24
24
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,13 +9,11 @@ module Rubysmith
10
9
  class Name < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Set project name."
16
13
 
17
14
  on %w[-n --name], argument: "NAME"
18
15
 
19
- def call(name) = input.merge!(project_name: name)
16
+ def call(name) = input.project_name = name
20
17
  end
21
18
  end
22
19
  end
@@ -8,7 +8,7 @@ module Rubysmith
8
8
  module Actions
9
9
  # Publishes project.
10
10
  class Publish < Sod::Action
11
- include Import[:configuration]
11
+ include Import[:input]
12
12
 
13
13
  using ::Refinements::Structs
14
14
 
@@ -21,7 +21,7 @@ module Rubysmith
21
21
  @extension = extension
22
22
  end
23
23
 
24
- def call(version) = extension.call configuration.merge(project_version: version)
24
+ def call(version) = extension.call input.merge(project_version: version)
25
25
 
26
26
  private
27
27
 
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Rake < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Rake gem."
16
13
 
17
14
  on "--[no-]rake"
18
15
 
19
16
  default { Container[:configuration].build_rake }
20
17
 
21
- def call(value = default) = input.merge!(build_rake: value)
18
+ def call(value = nil) = input.build_rake = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Readme < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add readme documentation."
16
13
 
17
14
  on "--[no-]readme"
18
15
 
19
16
  default { Container[:configuration].build_readme }
20
17
 
21
- def call(value = default) = input.merge!(build_readme: value)
18
+ def call(value = nil) = input.build_readme = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Reek < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Reek gem."
16
13
 
17
14
  on "--[no-]reek"
18
15
 
19
16
  default { Container[:configuration].build_reek }
20
17
 
21
- def call(value = default) = input.merge!(build_reek: value)
18
+ def call(value = nil) = input.build_reek = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Refinements < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Refinements gem."
16
13
 
17
14
  on "--[no-]refinements"
18
15
 
19
16
  default { Container[:configuration].build_refinements }
20
17
 
21
- def call(value = default) = input.merge!(build_refinements: value)
18
+ def call(value = nil) = input.build_refinements = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class RSpec < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add RSpec gem."
16
13
 
17
14
  on "--[no-]rspec"
18
15
 
19
16
  default { Container[:configuration].build_rspec }
20
17
 
21
- def call(value = default) = input.merge!(build_rspec: value)
18
+ def call(value = nil) = input.build_rspec = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Security < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add security."
16
13
 
17
14
  on "--[no-]security"
18
15
 
19
16
  default { Container[:configuration].build_security }
20
17
 
21
- def call(value = default) = input.merge!(build_security: value)
18
+ def call(value = nil) = input.build_security = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Setup < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add setup script."
16
13
 
17
14
  on "--[no-]setup"
18
15
 
19
16
  default { Container[:configuration].build_setup }
20
17
 
21
- def call(value = default) = input.merge!(build_setup: value)
18
+ def call(value = nil) = input.build_setup = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class SimpleCov < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add SimpleCov gem."
16
13
 
17
14
  on "--[no-]simple_cov"
18
15
 
19
16
  default { Container[:configuration].build_simple_cov }
20
17
 
21
- def call(value = default) = input.merge!(build_simple_cov: value)
18
+ def call(value = nil) = input.build_simple_cov = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Versions < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add version history."
16
13
 
17
14
  on "--[no-]versions"
18
15
 
19
16
  default { Container[:configuration].build_versions }
20
17
 
21
- def call(value = default) = input.merge!(build_versions: value)
18
+ def call(value = nil) = input.build_versions = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Yard < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Yard gem."
16
13
 
17
14
  on "--[no-]yard"
18
15
 
19
16
  default { Container[:configuration].build_yard }
20
17
 
21
- def call(value = default) = input.merge!(build_yard: value)
18
+ def call(value = nil) = input.build_yard = value
22
19
  end
23
20
  end
24
21
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "refinements/structs"
4
3
  require "sod"
5
4
 
6
5
  module Rubysmith
@@ -10,15 +9,13 @@ module Rubysmith
10
9
  class Zeitwerk < Sod::Action
11
10
  include Import[:input]
12
11
 
13
- using ::Refinements::Structs
14
-
15
12
  description "Add Zeitwerk gem."
16
13
 
17
14
  on "--[no-]zeitwerk"
18
15
 
19
16
  default { Container[:configuration].build_zeitwerk }
20
17
 
21
- def call(value = default) = input.merge!(build_zeitwerk: value)
18
+ def call(value = nil) = input.build_zeitwerk = value
22
19
  end
23
20
  end
24
21
  end
@@ -11,8 +11,8 @@ module Rubysmith
11
11
  include Import[:input, :kernel, :logger]
12
12
 
13
13
  # Order is important.
14
- # rubocop:todo Metrics/CollectionLiteralLength
15
14
  BUILDERS = [
15
+ Builders::Init,
16
16
  Builders::Core,
17
17
  Builders::Version,
18
18
  Builders::Documentation::Readme,
@@ -41,7 +41,6 @@ module Rubysmith
41
41
  Extensions::Rubocop,
42
42
  Builders::Git::Commit
43
43
  ].freeze
44
- # rubocop:enable Metrics/CollectionLiteralLength
45
44
 
46
45
  handle "build"
47
46
 
@@ -6,7 +6,6 @@ require "refinements/strings"
6
6
  require "refinements/structs"
7
7
 
8
8
  module Rubysmith
9
- # rubocop:disable Metrics/ModuleLength
10
9
  module Configuration
11
10
  # Defines the common configuration content for use throughout the gem.
12
11
  Model = Struct.new(
@@ -158,5 +157,4 @@ module Rubysmith
158
157
  end
159
158
  end
160
159
  end
161
- # rubocop:enable Metrics/ModuleLength
162
160
  end
@@ -10,10 +10,14 @@ module Rubysmith
10
10
  include Import[:git]
11
11
  include Dry::Monads[:result]
12
12
 
13
- def call content
14
- return Success content if content[:author_email]
13
+ def call(content) = content[:author_email] ? Success(content) : email_or(content)
15
14
 
16
- git.get("user.email").fmap { |email| content.merge! author_email: email }
15
+ private
16
+
17
+ def email_or content
18
+ git.get("user.email", nil)
19
+ .fmap { |email| email ? content.merge!(author_email: email) : content }
20
+ .or { Success content }
17
21
  end
18
22
  end
19
23
  end
@@ -10,10 +10,14 @@ module Rubysmith
10
10
  include Import[:git]
11
11
  include Dry::Monads[:result]
12
12
 
13
- def call content
14
- return Success content if content[:git_hub_user]
13
+ def call(content) = content[:git_hub_user] ? Success(content) : user_or(content)
15
14
 
16
- git.get("github.user").fmap { |user| content.merge! git_hub_user: user }
15
+ private
16
+
17
+ def user_or content
18
+ git.get("github.user", nil)
19
+ .fmap { |user| user ? content.merge!(git_hub_user: user) : content }
20
+ .or { Success content }
17
21
  end
18
22
  end
19
23
  end
@@ -13,9 +13,19 @@ module Rubysmith
13
13
  def call content
14
14
  return Success content if content[:author_given_name] || content[:author_family_name]
15
15
 
16
- git.get("user.name").fmap do |name|
16
+ name_or content
17
+ end
18
+
19
+ private
20
+
21
+ def name_or(content) = split(content).or { Success content }
22
+
23
+ def split content
24
+ git.get("user.name", nil).fmap do |name|
25
+ next content unless name
26
+
17
27
  first, last = String(name).split
18
- content.merge author_given_name: first, author_family_name: last
28
+ content.merge! author_given_name: first, author_family_name: last
19
29
  end
20
30
  end
21
31
  end
@@ -23,7 +23,7 @@ require "bundler/setup"
23
23
  Reek::Rake::Task.new
24
24
  <% end %>
25
25
  <% if configuration.build_rspec %>
26
- RSpec::Core::RakeTask.new
26
+ RSpec::Core::RakeTask.new { |task| task.verbose = false }
27
27
  <% end %>
28
28
  <% if configuration.build_caliber %>
29
29
  RuboCop::RakeTask.new
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  Bundler.require :tools
5
5
 
6
- require_relative "../lib/<%= configuration.project_path %>"
6
+ require "<%= configuration.project_path %>"
7
7
  require "irb"
8
8
 
9
9
  IRB.start __FILE__
@@ -1,6 +1,3 @@
1
- require "bundler/setup"
2
- Bundler.require :tools
3
-
4
1
  <% if configuration.build_simple_cov %>
5
2
  require "simplecov"
6
3
 
@@ -14,6 +11,8 @@ unless ENV["NO_COVERAGE"]
14
11
  end
15
12
  <% end %>
16
13
 
14
+ Bundler.require :tools
15
+
17
16
  require "<%= configuration.project_path %>"
18
17
  <% if configuration.build_refinements %>
19
18
  require "refinements"
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 = "5.1.0"
5
+ spec.version = "5.3.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://github.com/bkuhlmann/rubysmith"
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: 5.1.0
4
+ version: 5.3.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: 2023-06-17 00:00:00.000000000 Z
38
+ date: 2023-06-22 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -306,6 +306,7 @@ files:
306
306
  - lib/rubysmith/builders/git_hub.rb
307
307
  - lib/rubysmith/builders/git_hub_ci.rb
308
308
  - lib/rubysmith/builders/guard.rb
309
+ - lib/rubysmith/builders/init.rb
309
310
  - lib/rubysmith/builders/rake.rb
310
311
  - lib/rubysmith/builders/reek.rb
311
312
  - lib/rubysmith/builders/rspec/binstub.rb
metadata.gz.sig CHANGED
Binary file