rubysmith 0.13.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +93 -32
- data/{bin → exe}/rubysmith +0 -0
- data/lib/rubysmith/builder.rb +1 -1
- data/lib/rubysmith/builders/bundler.rb +1 -1
- data/lib/rubysmith/builders/circle_ci.rb +26 -0
- data/lib/rubysmith/builders/documentation/change.rb +32 -0
- data/lib/rubysmith/builders/documentation/conduct.rb +32 -0
- data/lib/rubysmith/builders/documentation/contribution.rb +32 -0
- data/lib/rubysmith/builders/documentation/license.rb +36 -0
- data/lib/rubysmith/builders/documentation/readme.rb +44 -0
- data/lib/rubysmith/builders/git_hub.rb +34 -0
- data/lib/rubysmith/cli/actions/build.rb +7 -1
- data/lib/rubysmith/cli/configuration/content.rb +26 -7
- data/lib/rubysmith/cli/configuration/defaults.yml +13 -6
- data/lib/rubysmith/cli/configuration/enhancers/current_time.rb +26 -0
- data/lib/rubysmith/cli/configuration/enhancers/git_hub_user.rb +33 -0
- data/lib/rubysmith/cli/configuration/enhancers/version.rb +26 -0
- data/lib/rubysmith/cli/configuration/loader.rb +13 -5
- data/lib/rubysmith/cli/parsers/build.rb +145 -21
- data/lib/rubysmith/cli/parsers/core.rb +1 -1
- data/lib/rubysmith/cli/shell.rb +4 -2
- data/lib/rubysmith/identity.rb +1 -1
- data/lib/rubysmith/templates/%project_name%/.circleci/config.yml.erb +31 -0
- data/lib/rubysmith/templates/%project_name%/.github/ISSUE_TEMPLATE.md.erb +14 -0
- data/lib/rubysmith/templates/%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb +8 -0
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +9 -6
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +4 -0
- data/lib/rubysmith/templates/%project_name%/README.md.erb +3 -0
- data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +0 -3
- data/lib/rubysmith.rb +4 -1
- data.tar.gz.sig +0 -0
- metadata +51 -10
- metadata.gz.sig +0 -0
- data/lib/rubysmith/builders/documentation.rb +0 -57
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21ba13c365014da4af272c863f73039576988a70be1902d1f1ad40ea582c0a2e
|
4
|
+
data.tar.gz: ddf90e3d3926ddba623408dac31fd6c03c9fbddcbc16c816a9c4ef5936636e5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25b33429b1a31468b5d725ac0871344ff243077be87eb6c7f253665856dc8cf4f9d5851d3252841d13a6d112ee0e3fc5f90d28ee3fd8bc0b41a1896cae03412b
|
7
|
+
data.tar.gz: 3aa34ce901418a4be760dd6a34bab1199cd562e6784a08503f294d47f93234628db017adf06a221e33645c2babb704034d65cc1a256dcca8067a9e1cc9937e2d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -30,8 +30,10 @@ toc::[]
|
|
30
30
|
* Uses link:https://www.alchemists.io/projects/pragmater[Pragmater] for Ruby source pragma directives.
|
31
31
|
* Supports link:https://github.com/amazing-print/amazing_print[Amazing Print].
|
32
32
|
* Supports link:https://github.com/rubymem/bundler-leak[Bundler Leak].
|
33
|
+
* Supports link:https://circleci.com[Circle CI].
|
33
34
|
* Supports link:https://github.com/ruby/debug[Debug].
|
34
35
|
* Supports link:https://git-scm.com[Git].
|
36
|
+
* Supports link:https://github.com[GitHub].
|
35
37
|
* Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
|
36
38
|
* Supports link:https://github.com/guard/guard[Guard].
|
37
39
|
* Supports link:https://github.com/ruby/rake[Rake].
|
@@ -48,8 +50,8 @@ toc::[]
|
|
48
50
|
* Provides common documentation:
|
49
51
|
** README
|
50
52
|
** CHANGES
|
51
|
-
** CONTRIBUTING
|
52
53
|
** CODE OF CONDUCT
|
54
|
+
** CONTRIBUTING
|
53
55
|
** LICENSE
|
54
56
|
|
55
57
|
// == Screencasts
|
@@ -87,23 +89,30 @@ USAGE:
|
|
87
89
|
-v, --version Show gem version.
|
88
90
|
|
89
91
|
BUILD OPTIONS:
|
90
|
-
--[no-]amazing_print Add Amazing Print.
|
91
|
-
--[no-]bundler-leak Add Bundler Leak.
|
92
|
-
--[no-]
|
93
|
-
--[no-]
|
94
|
-
--[no-]
|
95
|
-
--[no-]
|
96
|
-
--[no-]
|
97
|
-
--[no-]
|
98
|
-
--
|
99
|
-
--[no-]
|
100
|
-
--[no-]
|
101
|
-
--[no-]
|
102
|
-
--[no-]
|
103
|
-
--
|
104
|
-
--
|
105
|
-
--[no-]
|
106
|
-
--[no-]
|
92
|
+
--[no-]amazing_print Add Amazing Print gem. Default: true.
|
93
|
+
--[no-]bundler-leak Add Bundler Leak gem. Default: true.
|
94
|
+
--[no-]changes Add CHANGES documentation. Default: true.
|
95
|
+
--[no-]circle_ci Add Circle CI configuration and badge. Default: false.
|
96
|
+
--[no-]conduct Add CODE_OF_CONDUCT documentation. Default: true.
|
97
|
+
--[no-]console Add console script. Default: true.
|
98
|
+
--[no-]contributions Add CONTRIBUTING documentation. Default: true.
|
99
|
+
--[no-]debug Add Debug gem. Default: true.
|
100
|
+
--[no-]git Add Git. Default: true.
|
101
|
+
--[no-]git_hub Add GitHub templates. Default: false.
|
102
|
+
--[no-]git-lint Add Git Lint gem. Default: true.
|
103
|
+
--[no-]guard Add Guard gem. Default: true.
|
104
|
+
--[no-]license Add LICENSE documentation. Default: true.
|
105
|
+
--max Use maximum/enabled options. Default: false.
|
106
|
+
--min Use minimum/disabled options. Default: false.
|
107
|
+
--[no-]rake Add Rake gem. Default: true.
|
108
|
+
--[no-]readme Add README documentation. Default: true.
|
109
|
+
--[no-]reek Add Reek gem. Default: true.
|
110
|
+
--[no-]refinements Add Refinements gem. Default: true.
|
111
|
+
--[no-]rspec Add RSpec gem. Default: true.
|
112
|
+
--[no-]rubocop Add Rubocop gems. Default: true.
|
113
|
+
--[no-]setup Add setup script. Default: true.
|
114
|
+
--[no-]simple_cov Add SimpleCov gem. Default: true.
|
115
|
+
--[no-]zeitwerk Add Zeitwerk gem. Default: true.
|
107
116
|
....
|
108
117
|
|
109
118
|
=== Building
|
@@ -137,19 +146,20 @@ The above is essentially the same as building with _all_ options disabled. This
|
|
137
146
|
situations where you need to quickly script something up for sharing with others yet still want to
|
138
147
|
avoid using a Bundler Inline script so gem dependencies are not installed each time the code is run.
|
139
148
|
|
140
|
-
As shown earlier, you can combine options but
|
141
|
-
|
149
|
+
As shown earlier, you can combine options but be aware that order matters. Take the following, for
|
150
|
+
example, where both minimum and maximum options are used in conjunction with other options:
|
142
151
|
|
143
152
|
[source,bash]
|
144
153
|
----
|
145
154
|
rubysmith --build demo --min --zeitwerk
|
155
|
+
rubysmith --build demo --max --no-debug
|
146
156
|
----
|
147
157
|
|
148
|
-
|
149
|
-
This can be a handy way to build a new
|
150
|
-
|
151
|
-
|
152
|
-
details).
|
158
|
+
With the above examples, the first line will _disable_ all options except for Zeitwerk while the
|
159
|
+
second line will _enable_ all options except for Debug. This can be a handy way to build a new
|
160
|
+
project with all options either disabled or enabled with only a few select options modified. To have
|
161
|
+
specific options enabled/disabled _every time_ you build a new Ruby project, you can edit your
|
162
|
+
global configuration for making these settings permanent (see below for details).
|
153
163
|
|
154
164
|
=== Configuration
|
155
165
|
|
@@ -160,9 +170,7 @@ $HOME/.config/rubysmith/configuration.yml
|
|
160
170
|
....
|
161
171
|
|
162
172
|
It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment
|
163
|
-
variables.
|
164
|
-
|
165
|
-
The default configuration is as follows:
|
173
|
+
variables. The default configuration is as follows:
|
166
174
|
|
167
175
|
[source,yaml]
|
168
176
|
----
|
@@ -170,20 +178,24 @@ The default configuration is as follows:
|
|
170
178
|
:name:
|
171
179
|
:email:
|
172
180
|
:url:
|
173
|
-
:documentation:
|
174
|
-
:format: "md"
|
175
|
-
:license: "mit"
|
176
181
|
:build:
|
177
182
|
:amazing_print: true
|
178
183
|
:bundler_leak: true
|
184
|
+
:changes: true
|
185
|
+
:circle_ci: false
|
186
|
+
:conduct: true
|
179
187
|
:console: true
|
188
|
+
:contributions: true
|
180
189
|
:debug: true
|
181
|
-
:documentation: true
|
182
190
|
:git: true
|
191
|
+
:git_hub: false
|
183
192
|
:git_lint: true
|
184
193
|
:guard: true
|
194
|
+
:license: true
|
195
|
+
:maximum: false
|
185
196
|
:minimum: false
|
186
197
|
:rake: true
|
198
|
+
:readme: true
|
187
199
|
:reek: true
|
188
200
|
:refinements: true
|
189
201
|
:rspec: true
|
@@ -203,11 +215,55 @@ The default configuration is as follows:
|
|
203
215
|
- "**/*Gemfile"
|
204
216
|
- "**/*Guardfile"
|
205
217
|
- "**/*Rakefile"
|
218
|
+
:documentation:
|
219
|
+
:format: "md"
|
220
|
+
:license: "mit"
|
221
|
+
:git_hub:
|
222
|
+
:user:
|
206
223
|
----
|
207
224
|
|
208
225
|
Feel free to take this default configuration, modify, and save as your own custom
|
209
226
|
`configuration.yml`.
|
210
227
|
|
228
|
+
==== Author
|
229
|
+
|
230
|
+
Author information is used when generating project documentation and is recommended you fill this
|
231
|
+
information in before building a project. Example:
|
232
|
+
|
233
|
+
:author:
|
234
|
+
:name: Jill Smith
|
235
|
+
:email: jsmith@example.com
|
236
|
+
:url: https://www.exmaple.com/team/jsmith
|
237
|
+
|
238
|
+
==== Build
|
239
|
+
|
240
|
+
Build options are booleans so can only be `true` or `false` by default. Should you want a different
|
241
|
+
configuration than what is enabled/disabled by default, you'll want to customize these options as
|
242
|
+
you see fit. When changing build options, they will dynamically show up when viewing usage (i.e.
|
243
|
+
`rubysmith --help`).
|
244
|
+
|
245
|
+
==== Builders
|
246
|
+
|
247
|
+
Builders are additional tooling which can be configured specifically for Rubysmith. At the moment,
|
248
|
+
only link:https://www.alchemists.io/projects/pragmater[Pragmater] is supported so view the Pragmater
|
249
|
+
project page to learn more.
|
250
|
+
|
251
|
+
==== Documentation
|
252
|
+
|
253
|
+
Documentation can be configured as follows:
|
254
|
+
|
255
|
+
* *Format*: Use `md` for Markdown or `adoc` for ASCCI Doc.
|
256
|
+
* *License*: Use `mit` for MIT or `Apache` for Apache 2.0.0 license.
|
257
|
+
|
258
|
+
No other licenses are supported at this time but might be expanded up on in the future.
|
259
|
+
|
260
|
+
==== GitHub
|
261
|
+
|
262
|
+
Your GitHub user is whatever handle you setup when you creating your GitHub account. This
|
263
|
+
information is used for documentation purposes and Circle CI badge association. If you don't define
|
264
|
+
this information, Rubysmith will automatically fallback to pulling this information from your Git
|
265
|
+
configuration (i.e. `github.user`). If all else fails, then nothing will be used.
|
266
|
+
|
211
267
|
== Development
|
212
268
|
|
213
269
|
To contribute, run:
|
@@ -252,6 +308,11 @@ participating in this project you agree to abide by its terms.
|
|
252
308
|
|
253
309
|
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
254
310
|
|
311
|
+
== Community
|
312
|
+
|
313
|
+
Feel free to link:https://www.alchemists.io/community[join the commmunity] for discussions related
|
314
|
+
to this project and much more.
|
315
|
+
|
255
316
|
== License
|
256
317
|
|
257
318
|
Read link:LICENSE.adoc[LICENSE] for details.
|
data/{bin → exe}/rubysmith
RENAMED
File without changes
|
data/lib/rubysmith/builder.rb
CHANGED
@@ -25,7 +25,7 @@ module Rubysmith
|
|
25
25
|
.replace(/\n\s+gem/, "\n gem")
|
26
26
|
.replace(/ (?=.+(refinements|zeitwerk))/, "")
|
27
27
|
.replace(/(\n+|\s+)end/, "\nend")
|
28
|
-
.replace(/\n\ngroup :(code_quality|test|tools) do\nend/, "")
|
28
|
+
.replace(/\n\ngroup :(code_quality|development|test|tools) do\nend/, "")
|
29
29
|
.replace(/org"\n+/, "org\"\n\n")
|
30
30
|
|
31
31
|
configuration.project_root.change_dir { client.start %w[install --quiet] }
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rubysmith
|
4
|
+
module Builders
|
5
|
+
# Builds project skeleton Circle CI configuration.
|
6
|
+
class CircleCI
|
7
|
+
def self.call(...) = new(...).call
|
8
|
+
|
9
|
+
def initialize configuration, builder: Builder
|
10
|
+
@configuration = configuration
|
11
|
+
@builder = builder
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
return unless configuration.build_circle_ci
|
16
|
+
|
17
|
+
builder.call(configuration.with(template_path: "%project_name%/.circleci/config.yml.erb"))
|
18
|
+
.render
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :configuration, :builder
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tocer"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Documentation
|
8
|
+
# Builds project skeleton CHANGES documentation.
|
9
|
+
class Change
|
10
|
+
def self.call(...) = new(...).call
|
11
|
+
|
12
|
+
def initialize configuration, builder: Builder
|
13
|
+
@configuration = configuration
|
14
|
+
@builder = builder
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
return unless configuration.build_changes
|
19
|
+
|
20
|
+
builder.call(configuration.with(template_path: "%project_name%/CHANGES.#{kind}.erb"))
|
21
|
+
.render
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :configuration, :builder
|
27
|
+
|
28
|
+
def kind = configuration.documentation_format || "md"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tocer"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Documentation
|
8
|
+
# Builds project skeleton CODE_OF_CONDUCT documentation.
|
9
|
+
class Conduct
|
10
|
+
def self.call(...) = new(...).call
|
11
|
+
|
12
|
+
def initialize configuration, builder: Builder
|
13
|
+
@configuration = configuration
|
14
|
+
@builder = builder
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
return unless configuration.build_conduct
|
19
|
+
|
20
|
+
configuration.with(template_path: "%project_name%/CODE_OF_CONDUCT.#{kind}.erb")
|
21
|
+
.then { |updated_configuration| builder.call(updated_configuration).render }
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :configuration, :builder
|
27
|
+
|
28
|
+
def kind = configuration.documentation_format || "md"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tocer"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Documentation
|
8
|
+
# Builds project skeleton CONTRIBUTING documentation.
|
9
|
+
class Contribution
|
10
|
+
def self.call(...) = new(...).call
|
11
|
+
|
12
|
+
def initialize configuration, builder: Builder
|
13
|
+
@configuration = configuration
|
14
|
+
@builder = builder
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
return unless configuration.build_contributions
|
19
|
+
|
20
|
+
builder.call(configuration.with(template_path: "%project_name%/CONTRIBUTING.#{kind}.erb"))
|
21
|
+
.render
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :configuration, :builder
|
27
|
+
|
28
|
+
def kind = configuration.documentation_format || "md"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tocer"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Documentation
|
8
|
+
# Builds project skeleton LICENSE documentation.
|
9
|
+
class License
|
10
|
+
def self.call(...) = new(...).call
|
11
|
+
|
12
|
+
def initialize configuration, builder: Builder
|
13
|
+
@configuration = configuration
|
14
|
+
@builder = builder
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
return unless configuration.build_license
|
19
|
+
|
20
|
+
configuration.with(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
|
21
|
+
.then do |updated_configuration|
|
22
|
+
builder.call(updated_configuration).render.rename "LICENSE.#{kind}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :configuration, :builder
|
29
|
+
|
30
|
+
def kind = configuration.documentation_format || "md"
|
31
|
+
|
32
|
+
def license = configuration.documentation_license || "mit"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tocer"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module Builders
|
7
|
+
module Documentation
|
8
|
+
# Builds project skeleton README documentation.
|
9
|
+
class Readme
|
10
|
+
def self.call(...) = new(...).call
|
11
|
+
|
12
|
+
def initialize configuration, builder: Builder, tocer: Tocer::Writer.new
|
13
|
+
@configuration = configuration
|
14
|
+
@builder = builder
|
15
|
+
@tocer = tocer
|
16
|
+
end
|
17
|
+
|
18
|
+
def call
|
19
|
+
return unless configuration.build_readme
|
20
|
+
|
21
|
+
private_methods.sort.grep(/render_/).each { |method| __send__ method }
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
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
|
39
|
+
|
40
|
+
def kind = configuration.documentation_format || "md"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rubysmith
|
4
|
+
module Builders
|
5
|
+
# Builds project skeleton GitHub templates.
|
6
|
+
class GitHub
|
7
|
+
def self.call(...) = new(...).call
|
8
|
+
|
9
|
+
def initialize configuration, builder: Builder
|
10
|
+
@configuration = configuration
|
11
|
+
@builder = builder
|
12
|
+
end
|
13
|
+
|
14
|
+
def call
|
15
|
+
return unless configuration.build_git_hub
|
16
|
+
|
17
|
+
builder.call(with_issue_template).render
|
18
|
+
builder.call(with_pull_request_template).render
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :configuration, :builder
|
24
|
+
|
25
|
+
def with_issue_template
|
26
|
+
configuration.with template_path: "%project_name%/.github/ISSUE_TEMPLATE.md.erb"
|
27
|
+
end
|
28
|
+
|
29
|
+
def with_pull_request_template
|
30
|
+
configuration.with template_path: "%project_name%/.github/PULL_REQUEST_TEMPLATE.md.erb"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -8,12 +8,18 @@ module Rubysmith
|
|
8
8
|
# Order is important.
|
9
9
|
BUILDERS = [
|
10
10
|
Builders::Core,
|
11
|
-
Builders::Documentation,
|
11
|
+
Builders::Documentation::Readme,
|
12
|
+
Builders::Documentation::Change,
|
13
|
+
Builders::Documentation::Conduct,
|
14
|
+
Builders::Documentation::Contribution,
|
15
|
+
Builders::Documentation::License,
|
12
16
|
Builders::Git::Setup,
|
13
17
|
Builders::Bundler,
|
14
18
|
Builders::Rake,
|
15
19
|
Builders::Console,
|
20
|
+
Builders::CircleCI,
|
16
21
|
Builders::Setup,
|
22
|
+
Builders::GitHub,
|
17
23
|
Builders::Guard,
|
18
24
|
Builders::Reek,
|
19
25
|
Builders::RSpec::Context,
|
@@ -17,14 +17,21 @@ module Rubysmith
|
|
17
17
|
:author_url,
|
18
18
|
:build_amazing_print,
|
19
19
|
:build_bundler_leak,
|
20
|
+
:build_changes,
|
21
|
+
:build_circle_ci,
|
22
|
+
:build_conduct,
|
20
23
|
:build_console,
|
24
|
+
:build_contributions,
|
21
25
|
:build_debug,
|
22
|
-
:build_documentation,
|
23
26
|
:build_git,
|
27
|
+
:build_git_hub,
|
24
28
|
:build_git_lint,
|
25
29
|
:build_guard,
|
30
|
+
:build_license,
|
31
|
+
:build_maximum,
|
26
32
|
:build_minimum,
|
27
33
|
:build_rake,
|
34
|
+
:build_readme,
|
28
35
|
:build_reek,
|
29
36
|
:build_refinements,
|
30
37
|
:build_rspec,
|
@@ -36,11 +43,13 @@ module Rubysmith
|
|
36
43
|
:builders_pragmater_includes,
|
37
44
|
:documentation_format,
|
38
45
|
:documentation_license,
|
46
|
+
:git_hub_user,
|
39
47
|
:now,
|
40
48
|
:project_name,
|
41
49
|
:target_root,
|
42
50
|
:template_path,
|
43
51
|
:template_root,
|
52
|
+
:version,
|
44
53
|
keyword_init: true
|
45
54
|
) do
|
46
55
|
using Refinements::Strings
|
@@ -54,12 +63,9 @@ module Rubysmith
|
|
54
63
|
|
55
64
|
def with(attributes) = self.class.new(to_h.merge(attributes))
|
56
65
|
|
57
|
-
def
|
58
|
-
|
59
|
-
|
60
|
-
.each { |key, _value| self[key] = false }
|
61
|
-
.then { self }
|
62
|
-
end
|
66
|
+
def maximize = update_build_options(true)
|
67
|
+
|
68
|
+
def minimize = update_build_options(false)
|
63
69
|
|
64
70
|
def project_label = project_name.titleize
|
65
71
|
|
@@ -69,9 +75,22 @@ module Rubysmith
|
|
69
75
|
|
70
76
|
def project_path = project_name.snakecase
|
71
77
|
|
78
|
+
def ascii_doc? = documentation_format == "adoc"
|
79
|
+
|
80
|
+
def markdown? = documentation_format == "md"
|
81
|
+
|
72
82
|
def to_pathway
|
73
83
|
Pathway[start_root: template_root, start_path: template_path, end_root: target_root]
|
74
84
|
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def update_build_options value
|
89
|
+
to_h.except(:build_minimum)
|
90
|
+
.select { |key, _value| key.start_with? "build_" }
|
91
|
+
.each { |key, _value| self[key] = value }
|
92
|
+
.then { self }
|
93
|
+
end
|
75
94
|
end
|
76
95
|
end
|
77
96
|
end
|
@@ -1,23 +1,25 @@
|
|
1
|
-
:project:
|
2
|
-
:name:
|
3
1
|
:author:
|
4
2
|
:name:
|
5
3
|
:email:
|
6
4
|
:url:
|
7
|
-
:documentation:
|
8
|
-
:format: "md"
|
9
|
-
:license: "mit"
|
10
5
|
:build:
|
11
6
|
:amazing_print: true
|
12
7
|
:bundler_leak: true
|
8
|
+
:changes: true
|
9
|
+
:circle_ci: false
|
10
|
+
:conduct: true
|
13
11
|
:console: true
|
12
|
+
:contributions: true
|
14
13
|
:debug: true
|
15
|
-
:documentation: true
|
16
14
|
:git: true
|
15
|
+
:git_hub: false
|
17
16
|
:git_lint: true
|
18
17
|
:guard: true
|
18
|
+
:license: true
|
19
|
+
:maximum: false
|
19
20
|
:minimum: false
|
20
21
|
:rake: true
|
22
|
+
:readme: true
|
21
23
|
:reek: true
|
22
24
|
:refinements: true
|
23
25
|
:rspec: true
|
@@ -37,3 +39,8 @@
|
|
37
39
|
- "**/*Gemfile"
|
38
40
|
- "**/*Guardfile"
|
39
41
|
- "**/*Rakefile"
|
42
|
+
:documentation:
|
43
|
+
:format: "md"
|
44
|
+
:license: "mit"
|
45
|
+
:git_hub:
|
46
|
+
:user:
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/structs"
|
4
|
+
|
5
|
+
module Rubysmith
|
6
|
+
module CLI
|
7
|
+
module Configuration
|
8
|
+
module Enhancers
|
9
|
+
# Adds current time to content.
|
10
|
+
class CurrentTime
|
11
|
+
using Refinements::Structs
|
12
|
+
|
13
|
+
def initialize now = Time.now
|
14
|
+
@now = now
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(content) = content.merge(now: now)
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :now
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "git_plus"
|
4
|
+
require "refinements/strings"
|
5
|
+
require "refinements/structs"
|
6
|
+
|
7
|
+
module Rubysmith
|
8
|
+
module CLI
|
9
|
+
module Configuration
|
10
|
+
module Enhancers
|
11
|
+
# Dynamically adds GitHub user if user is defined.
|
12
|
+
class GitHubUser
|
13
|
+
using Refinements::Strings
|
14
|
+
using Refinements::Structs
|
15
|
+
|
16
|
+
def initialize repository: GitPlus::Repository.new
|
17
|
+
@repository = repository
|
18
|
+
end
|
19
|
+
|
20
|
+
def call content
|
21
|
+
String(content.git_hub_user).blank? ? content.merge(git_hub_user: user) : content
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
attr_reader :repository
|
27
|
+
|
28
|
+
def user = repository.config_get("github.user")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|