gemsmith 21.7.0 → 21.8.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: 640d17bff5a491317535eddaa974bdb07a64ed346d160706a22dc61704f79346
4
- data.tar.gz: aae0e3c20ccba22dd0c7a82e5e765b92f067d6d6b1427c361a5c1ad0d534b012
3
+ metadata.gz: c3b27c0e32cbffc4cce574fa8fa1ba16afbd6e04d77e1bc86e41d631afd69429
4
+ data.tar.gz: 671c7adebf43e417a764e86bb4d9322b560e6b7825999cb6fe87bc3cda06709d
5
5
  SHA512:
6
- metadata.gz: 9be8c650172ac7fdaf478eb6e8468f394bc3a43c7a6cf93f62e040cc92d6e5b8823f339f7a82bbefc8bbe84745a8ad8475b589f21552976116a7af90d414a65d
7
- data.tar.gz: be0e134585b8a77faeb8c109b0c23779a4b5154ca3a7c3efcab772582c9583a6f0c77422339919aa97d414da042bdae24b77e0f9274bb95fd22fe7ec8f7c147b
6
+ metadata.gz: 6c44e884b4f7cb1f15c4a864c0c5f9f06b794ceeda21a38322344d41d17a5e3bacde3815164f1e0ebd2d66519e40abde2af0514eeedf03eee7e6977cbd430eaa
7
+ data.tar.gz: e6b6e9c6f456a5701de8460b1f93b5f9ee93008557456a9e0f443b971c07902584bb46850829e7df507f15bb0fd6ae88f1233079700bd5afeedaf2846260a2e4
checksums.yaml.gz.sig CHANGED
Binary file
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.7.0"
5
+ spec.version = "21.8.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/gemsmith"
@@ -28,11 +28,11 @@ Gem::Specification.new do |spec|
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.3"
31
+ spec.add_dependency "etcher", "~> 1.5"
32
32
  spec.add_dependency "infusible", "~> 3.5"
33
- spec.add_dependency "milestoner", "~> 17.7"
33
+ spec.add_dependency "milestoner", "~> 17.8"
34
34
  spec.add_dependency "refinements", "~> 12.1"
35
- spec.add_dependency "rubysmith", "~> 6.7"
35
+ spec.add_dependency "rubysmith", "~> 6.8"
36
36
  spec.add_dependency "runcom", "~> 11.0"
37
37
  spec.add_dependency "sod", "~> 0.8"
38
38
  spec.add_dependency "spek", "~> 3.0"
@@ -5,16 +5,9 @@ require "refinements/struct"
5
5
  module Gemsmith
6
6
  module Builders
7
7
  # Builds project skeleton with Gemfile configuration.
8
- class Bundler
8
+ class Bundler < Rubysmith::Builders::Abstract
9
9
  using Refinements::Struct
10
10
 
11
- def self.call(...) = new(...).call
12
-
13
- def initialize configuration, builder: Rubysmith::Builder
14
- @configuration = configuration
15
- @builder = builder
16
- end
17
-
18
11
  def call
19
12
  builder.call(configuration.merge(template_path: "%project_name%/Gemfile.erb"))
20
13
  .insert_after("source", "\ngemspec\n")
@@ -25,10 +18,6 @@ module Gemsmith
25
18
 
26
19
  configuration
27
20
  end
28
-
29
- private
30
-
31
- attr_reader :configuration, :builder
32
21
  end
33
22
  end
34
23
  end
@@ -5,16 +5,9 @@ require "refinements/struct"
5
5
  module Gemsmith
6
6
  module Builders
7
7
  # Builds project skeleton Circle CI configuration.
8
- class CircleCI
8
+ class CircleCI < Rubysmith::Builders::Abstract
9
9
  using Refinements::Struct
10
10
 
11
- def self.call(...) = new(...).call
12
-
13
- def initialize configuration, builder: Rubysmith::Builder
14
- @configuration = configuration
15
- @builder = builder
16
- end
17
-
18
11
  def call
19
12
  return configuration unless configuration.build_circle_ci
20
13
 
@@ -27,8 +20,6 @@ module Gemsmith
27
20
 
28
21
  private
29
22
 
30
- attr_reader :configuration, :builder
31
-
32
23
  def project_name = configuration.project_name
33
24
  end
34
25
  end
@@ -5,16 +5,9 @@ require "refinements/struct"
5
5
  module Gemsmith
6
6
  module Builders
7
7
  # Builds project skeleton CLI templates.
8
- class CLI
8
+ class CLI < Rubysmith::Builders::Abstract
9
9
  using Refinements::Struct
10
10
 
11
- def self.call(...) = new(...).call
12
-
13
- def initialize configuration, builder: Rubysmith::Builder
14
- @configuration = configuration
15
- @builder = builder
16
- end
17
-
18
11
  def call
19
12
  return configuration unless configuration.build_cli
20
13
 
@@ -24,8 +17,6 @@ module Gemsmith
24
17
 
25
18
  private
26
19
 
27
- attr_reader :configuration, :builder
28
-
29
20
  def render = private_methods.sort.grep(/render_/).each { |method| __send__ method }
30
21
 
31
22
  def render_exe
@@ -6,20 +6,15 @@ module Gemsmith
6
6
  module Builders
7
7
  module Documentation
8
8
  # Builds project skeleton README documentation.
9
- class Readme
9
+ class Readme < Rubysmith::Builders::Documentation::Readme
10
10
  using Refinements::Struct
11
11
 
12
- def self.call(...) = new(...).call
13
-
14
- def initialize configuration, builder: Rubysmith::Builder
15
- @configuration = configuration
16
- @builder = builder
17
- end
18
-
19
12
  def call
20
13
  return configuration unless configuration.build_readme
21
14
 
15
+ super
22
16
  builder.call(configuration.merge(template_path: "%project_name%/README.#{kind}.erb"))
17
+ .replace(/Setup.+Usage/m, setup)
23
18
  .replace("Rubysmith", "Gemsmith")
24
19
  .replace("rubysmith", "gemsmith")
25
20
 
@@ -28,9 +23,118 @@ module Gemsmith
28
23
 
29
24
  private
30
25
 
31
- attr_reader :configuration, :builder
26
+ def setup = kind == "adoc" ? ascii_setup : markdown_setup
27
+
28
+ def ascii_setup = configuration.build_security ? ascii_secure : ascii_insecure
29
+
30
+ def ascii_secure
31
+ project_name = configuration.project_name
32
+
33
+ <<~CONTENT.strip
34
+ Setup
35
+
36
+ To install _with_ security, run:
37
+
38
+ [source,bash]
39
+ ----
40
+ # 💡 Skip this line if you already have the public certificate installed.
41
+ gem cert --add <(curl --compressed --location #{configuration.organization_url}/gems.pem)
42
+ gem install #{project_name} --trust-policy HighSecurity
43
+ ----
44
+
45
+ To install _without_ security, run:
46
+
47
+ [source,bash]
48
+ ----
49
+ gem install #{project_name}
50
+ ----
51
+
52
+ #{ascii_common}
53
+ CONTENT
54
+ end
55
+
56
+ def ascii_insecure
57
+ <<~CONTENT.strip
58
+ Setup
59
+
60
+ To install, run:
61
+
62
+ [source,bash]
63
+ ----
64
+ gem install #{configuration.project_name}
65
+ ----
66
+
67
+ #{ascii_common}
68
+ CONTENT
69
+ end
70
+
71
+ def ascii_common
72
+ <<~CONTENT.strip
73
+ You can also add the gem directly to your project:
74
+
75
+ [source,bash]
76
+ ----
77
+ bundle add #{configuration.project_name}
78
+ ----
79
+
80
+ Once the gem is installed, you only need to require it:
81
+
82
+ [source,ruby]
83
+ ----
84
+ require "#{configuration.project_path}"
85
+ ----
32
86
 
33
- def kind = configuration.documentation_format
87
+ == Usage
88
+ CONTENT
89
+ end
90
+
91
+ def markdown_setup = configuration.build_security ? markdown_secure : markdown_insecure
92
+
93
+ def markdown_secure
94
+ project_name = configuration.project_name
95
+
96
+ <<~CONTENT.strip
97
+ Setup
98
+
99
+ To install _with_ security, run:
100
+
101
+ # 💡 Skip this line if you already have the public certificate installed.
102
+ gem cert --add <(curl --compressed --location #{configuration.organization_url}/gems.pem)
103
+ gem install #{project_name} --trust-policy HighSecurity
104
+
105
+ To install _without_ security, run:
106
+
107
+ gem install #{project_name}
108
+
109
+ #{markdown_common}
110
+ CONTENT
111
+ end
112
+
113
+ def markdown_insecure
114
+ <<~CONTENT.strip
115
+ Setup
116
+
117
+ To install, run:
118
+
119
+ gem install #{configuration.project_name}
120
+
121
+ #{markdown_common}
122
+ CONTENT
123
+ end
124
+
125
+ def markdown_common
126
+ <<~CONTENT.strip
127
+ You can also add the gem directly to your project:
128
+
129
+ bundle add #{configuration.project_name}
130
+
131
+ Once the gem is installed, you only need to require it:
132
+
133
+ require "#{configuration.project_path}"
134
+
135
+ ## Usage
136
+ CONTENT
137
+ end
34
138
  end
35
139
  end
36
140
  end
@@ -6,31 +6,22 @@ module Gemsmith
6
6
  module Builders
7
7
  module Git
8
8
  # Builds project skeleton Git ignore.
9
- class Ignore
9
+ class Ignore < Rubysmith::Builders::Abstract
10
10
  using Refinements::Struct
11
11
 
12
- def self.call(...) = new(...).call
13
-
14
- def initialize configuration, builder: Rubysmith::Builder
15
- @configuration = configuration
16
- @builder = builder
17
- end
18
-
19
12
  def call
20
13
  return configuration unless configuration.build_git
21
14
 
22
15
  builder.call(configuration.merge(template_path: "%project_name%/.gitignore.erb"))
23
16
  .touch
24
17
  .prepend("*.gem\n")
25
- .insert_before("tmp\n", "Gemfile.lock\n")
26
- .insert_before("tmp\n", "pkg\n")
18
+ .insert_before "tmp\n", <<~CONTENT
19
+ Gemfile.lock
20
+ pkg
21
+ CONTENT
27
22
 
28
23
  configuration
29
24
  end
30
-
31
- private
32
-
33
- attr_reader :configuration, :builder
34
25
  end
35
26
  end
36
27
  end
@@ -6,16 +6,9 @@ module Gemsmith
6
6
  module Builders
7
7
  module RSpec
8
8
  # Builds RSpec spec helper for project skeleton.
9
- class Helper
9
+ class Helper < Rubysmith::Builders::Abstract
10
10
  using Refinements::Struct
11
11
 
12
- def self.call(...) = new(...).call
13
-
14
- def initialize configuration, builder: Rubysmith::Builder
15
- @configuration = configuration
16
- @builder = builder
17
- end
18
-
19
12
  def call
20
13
  return configuration unless configuration.build_rspec && configuration.build_cli
21
14
 
@@ -24,10 +17,6 @@ module Gemsmith
24
17
  .replace("%r(^/spec/)", "%r((.+/container\\.rb|^/spec/))")
25
18
  configuration
26
19
  end
27
-
28
- private
29
-
30
- attr_reader :configuration, :builder
31
20
  end
32
21
  end
33
22
  end
@@ -5,16 +5,9 @@ require "refinements/struct"
5
5
  module Gemsmith
6
6
  module Builders
7
7
  # Builds project skeleton gem specification for use by RubyGems.
8
- class Specification
8
+ class Specification < Rubysmith::Builders::Abstract
9
9
  using Refinements::Struct
10
10
 
11
- def self.call(...) = new(...).call
12
-
13
- def initialize configuration, builder: Rubysmith::Builder
14
- @configuration = configuration
15
- @builder = builder
16
- end
17
-
18
11
  def call
19
12
  config = configuration.merge template_path: "%project_name%/%project_name%.gemspec.erb"
20
13
 
@@ -28,10 +21,6 @@ module Gemsmith
28
21
 
29
22
  configuration
30
23
  end
31
-
32
- private
33
-
34
- attr_reader :configuration, :builder
35
24
  end
36
25
  end
37
26
  end
@@ -22,7 +22,6 @@ module Gemsmith
22
22
  model: Rubysmith::Configuration::Model
23
23
 
24
24
  registry.add_loader(Etcher::Loaders::YAML.new(self[:defaults_path]))
25
- .add_transformer(Rubysmith::Configuration::Transformers::CurrentTime)
26
25
  .add_transformer(Rubysmith::Configuration::Transformers::GitHubUser.new)
27
26
  .add_transformer(Rubysmith::Configuration::Transformers::GitEmail.new)
28
27
  .add_transformer(Rubysmith::Configuration::Transformers::GitUser.new)
@@ -33,6 +32,7 @@ module Gemsmith
33
32
  )
34
33
  )
35
34
  .add_transformer(Rubysmith::Configuration::Transformers::TargetRoot)
35
+ .add_transformer(Etcher::Transformers::Time.new)
36
36
  end
37
37
 
38
38
  register(:specification) { Spek::Loader.call "#{__dir__}/../../gemsmith.gemspec" }
@@ -45,7 +45,7 @@ Gem::Specification.new do |spec|
45
45
  spec.add_dependency "dry-monads", "~> 1.6"
46
46
  <% end %>
47
47
  <% if configuration.build_cli %>
48
- spec.add_dependency "etcher", "~> 1.3"
48
+ spec.add_dependency "etcher", "~> 1.5"
49
49
  <% end %>
50
50
  <% if configuration.build_cli %>
51
51
  spec.add_dependency "infusible", "~> 3.5"
@@ -28,13 +28,13 @@ module Gemsmith
28
28
 
29
29
  # :reek:TooManyStatements
30
30
  def one_time_password
31
- return [] if check_yubikey.failure?
31
+ return Core::EMPTY_ARRAY if check_yubikey.failure?
32
32
 
33
33
  executor.capture3(check_yubikey.success, "oath", "accounts", "code", "--single", "RubyGems")
34
34
  .then { |stdout, _stderr, status| status.success? ? ["--otp", stdout.chomp] : [] }
35
35
  rescue Errno::ENOENT => error
36
36
  logger.debug { "Unable to obtain YubiKey One-Time Password. #{error}." }
37
- []
37
+ Core::EMPTY_ARRAY
38
38
  end
39
39
 
40
40
  def check_yubikey
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.7.0
4
+ version: 21.8.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-05-16 00:00:00.000000000 Z
38
+ date: 2024-05-25 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: cogger
@@ -113,14 +113,14 @@ dependencies:
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '1.3'
116
+ version: '1.5'
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.3'
123
+ version: '1.5'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: infusible
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -141,14 +141,14 @@ dependencies:
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '17.7'
144
+ version: '17.8'
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.7'
151
+ version: '17.8'
152
152
  - !ruby/object:Gem::Dependency
153
153
  name: refinements
154
154
  requirement: !ruby/object:Gem::Requirement
@@ -169,14 +169,14 @@ dependencies:
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '6.7'
172
+ version: '6.8'
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.7'
179
+ version: '6.8'
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: runcom
182
182
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file