rubysmith 0.9.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +34 -20
- data/bin/rubysmith +0 -1
- data/lib/rubysmith/builder.rb +17 -35
- data/lib/rubysmith/builders/bundler.rb +7 -9
- data/lib/rubysmith/builders/console.rb +6 -8
- data/lib/rubysmith/builders/core.rb +11 -8
- data/lib/rubysmith/builders/documentation.rb +16 -21
- data/lib/rubysmith/builders/git/commit.rb +7 -11
- data/lib/rubysmith/builders/git/setup.rb +6 -8
- data/lib/rubysmith/builders/guard.rb +9 -9
- data/lib/rubysmith/builders/pragma.rb +8 -13
- data/lib/rubysmith/builders/rake.rb +7 -7
- data/lib/rubysmith/builders/reek.rb +6 -8
- data/lib/rubysmith/builders/rspec/context.rb +10 -11
- data/lib/rubysmith/builders/rspec/helper.rb +6 -8
- data/lib/rubysmith/builders/rubocop/formatter.rb +5 -7
- data/lib/rubysmith/builders/rubocop/setup.rb +7 -9
- data/lib/rubysmith/builders/setup.rb +8 -8
- data/lib/rubysmith/cli/actions/build.rb +42 -0
- data/lib/rubysmith/cli/actions/config.rb +33 -0
- data/lib/rubysmith/cli/configuration/content.rb +78 -0
- data/lib/rubysmith/cli/{defaults.yml → configuration/defaults.yml} +3 -3
- data/lib/rubysmith/cli/configuration/loader.rb +38 -0
- data/lib/rubysmith/cli/parsers/assembler.rb +11 -18
- data/lib/rubysmith/cli/parsers/build.rb +40 -41
- data/lib/rubysmith/cli/parsers/core.rb +15 -14
- data/lib/rubysmith/cli/parsers.rb +11 -0
- data/lib/rubysmith/cli/shell.rb +14 -35
- data/lib/rubysmith/container.rb +37 -0
- data/lib/rubysmith/identity.rb +2 -2
- data/lib/rubysmith/pathway.rb +3 -9
- data/lib/rubysmith/renderers/erb.rb +7 -9
- data/lib/rubysmith/renderers/namespace.rb +2 -4
- data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +2 -2
- data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +46 -50
- data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +5 -5
- data/lib/rubysmith/templates/%project_name%/README.md.erb +5 -5
- data/lib/rubysmith/templates/%project_name%/Rakefile.erb +11 -23
- data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb +12 -0
- data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +6 -4
- data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +3 -3
- data/lib/rubysmith.rb +10 -30
- data.tar.gz.sig +0 -0
- metadata +55 -13
- metadata.gz.sig +0 -0
- data/lib/rubysmith/builders/ruby_critic.rb +0 -27
- data/lib/rubysmith/cli/configuration.rb +0 -30
- data/lib/rubysmith/cli/processors/build.rb +0 -58
- data/lib/rubysmith/cli/processors/config.rb +0 -35
- data/lib/rubysmith/realm.rb +0 -74
- data/lib/rubysmith/templates/%project_name%/.rubycritic.yml.erb +0 -3
- data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa3e01ddcd6743f57757311a125d1e8ab39c44e09c1f1186a53b4a0ca6388d7d
|
4
|
+
data.tar.gz: d0725b76c5829d64fbd5e648506ae2e57adbb9882e992b84bfddaa879f166a0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e14344b8a18601ef9e05ab3463491977eb81a62027dad1658a7cb1012f94f982296fe1981eea3bd90f35aa88668d3b553d3ef4bed5e77c7dddd060a8a2e444a
|
7
|
+
data.tar.gz: 7b1d999af3527fdd1a182dc2405d19b852cfb93ab8d8c70fa2f1b1e5c3261daa8548d13966d062e266911817e53e394f20442c778c59aad4f89fe4b33402380a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -15,8 +15,11 @@ Rubysmith is a command line interface for smithing Ruby projects.
|
|
15
15
|
|
16
16
|
This gem is useful in situations in which you need something more sophisticated than a
|
17
17
|
link:https://bundler.io/guides/bundler_in_a_single_file_ruby_script.html[Bundler Inline] script but
|
18
|
-
less complicated than a
|
19
|
-
|
18
|
+
less complicated than a link:https://www.alchemists.io/projects/gemsmith[Gemsmith] gem. Rubysmith is
|
19
|
+
the foundation of Gemsmith and provides a lot of the same functionality as Gemsmith but solely
|
20
|
+
tailored for pure Ruby projects. Again, this is a great tool for spiking quick Ruby implementations,
|
21
|
+
sharing code snippets with others, or building full blown Ruby projects for collaboration with
|
22
|
+
others.
|
20
23
|
|
21
24
|
toc::[]
|
22
25
|
|
@@ -26,12 +29,12 @@ toc::[]
|
|
26
29
|
* Uses link:https://www.alchemists.io/projects/runcom[Runcom] for resource configuration management.
|
27
30
|
* Uses link:https://www.alchemists.io/projects/pragmater[Pragmater] for Ruby source pragma directives.
|
28
31
|
* Supports link:https://github.com/amazing-print/amazing_print[Amazing Print].
|
29
|
-
* Supports link:https://github.com/rubysec/bundler-audit[Bundler Audit].
|
30
32
|
* Supports link:https://github.com/rubymem/bundler-leak[Bundler Leak].
|
33
|
+
* Supports link:https://github.com/ruby/debug[Debug].
|
31
34
|
* Supports link:https://git-scm.com[Git].
|
32
35
|
* Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
|
33
36
|
* Supports link:https://github.com/guard/guard[Guard].
|
34
|
-
* Supports link:
|
37
|
+
* Supports link:https://github.com/ruby/rake[Rake].
|
35
38
|
* Supports link:https://github.com/troessner/reek[Reek].
|
36
39
|
* Supports link:https://www.alchemists.io/projects/refinements[Refinements].
|
37
40
|
* Supports link:https://rspec.info[RSpec].
|
@@ -39,8 +42,8 @@ toc::[]
|
|
39
42
|
* Supports link:https://docs.rubocop.org/rubocop-performance[Rubocop Performance].
|
40
43
|
* Supports link:https://github.com/rubocop-hq/rubocop-rake[Rubocop Rake].
|
41
44
|
* Supports link:https://github.com/rubocop-hq/rubocop-rspec[Rubocop RSpec].
|
42
|
-
* Supports link:https://github.com/whitesmith/RubyCritic[RubyCritic].
|
43
45
|
* Supports link:https://github.com/simplecov-ruby/simplecov[SimpleCov].
|
46
|
+
* Supports link:https://github.com/fxn/zeitwerk[Zeitwerk].
|
44
47
|
* Supports common settings and a structured layout for building projects.
|
45
48
|
* Provides common documentation:
|
46
49
|
** README
|
@@ -79,28 +82,28 @@ From the command line, type: `rubysmith --help`
|
|
79
82
|
....
|
80
83
|
USAGE:
|
81
84
|
-b, --build NAME [options] Build new project.
|
82
|
-
-v, --version Show gem version.
|
83
|
-
-h, --help Show this message.
|
84
85
|
-c, --config ACTION Manage gem configuration: edit or view.
|
86
|
+
-h, --help Show this message.
|
87
|
+
-v, --version Show gem version.
|
85
88
|
|
86
89
|
BUILD OPTIONS:
|
87
90
|
--[no-]amazing_print Add Amazing Print.
|
88
|
-
--[no-]bundler-audit Add Bundler Audit.
|
89
91
|
--[no-]bundler-leak Add Bundler Leak.
|
90
92
|
--[no-]console Add console script.
|
93
|
+
--[no-]debug Add Debug.
|
91
94
|
--[no-]documentation Add documentation.
|
92
95
|
--[no-]git Add Git.
|
93
96
|
--[no-]git-lint Add Git Lint.
|
94
97
|
--[no-]guard Add Guard.
|
95
|
-
--
|
98
|
+
--min Use minimum/no options.
|
99
|
+
--[no-]rake Add Rake.
|
96
100
|
--[no-]reek Add Reek.
|
97
101
|
--[no-]refinements Add Refinements.
|
98
102
|
--[no-]rspec Add RSpec.
|
99
103
|
--[no-]rubocop Add Rubocop.
|
100
|
-
--[no-]ruby_critic Add RubyCritic.
|
101
104
|
--[no-]setup Add setup script.
|
102
105
|
--[no-]simple_cov Add SimpleCov.
|
103
|
-
--
|
106
|
+
--[no-]zeitwerk Add Zeitwerk.
|
104
107
|
....
|
105
108
|
|
106
109
|
=== Building
|
@@ -118,12 +121,12 @@ to disable specific options, you can use the `--no-*` prefix. Example:
|
|
118
121
|
|
119
122
|
[source,bash]
|
120
123
|
----
|
121
|
-
rubysmith --build demo --no-
|
124
|
+
rubysmith --build demo --no-debug --no-guard
|
122
125
|
----
|
123
126
|
|
124
|
-
With the above example, both
|
125
|
-
project. Taking this a step further, you can also use the `--min` option to generate a
|
126
|
-
bare minimum of options. Example:
|
127
|
+
With the above example, both Debug and Guard support would have been disabled when building the
|
128
|
+
`demo` project. Taking this a step further, you can also use the `--min` option to generate a
|
129
|
+
project with bare minimum of options. Example:
|
127
130
|
|
128
131
|
[source,bash]
|
129
132
|
----
|
@@ -134,8 +137,19 @@ The above is essentially the same as building with _all_ options disabled. This
|
|
134
137
|
situations where you need to quickly script something up for sharing with others yet still want to
|
135
138
|
avoid using a Bundler Inline script so gem dependencies are not installed each time the code is run.
|
136
139
|
|
137
|
-
|
138
|
-
|
140
|
+
As shown earlier, you can combine options but the order options can be handy in certain situations
|
141
|
+
especially when used with the minimum build option. Example:
|
142
|
+
|
143
|
+
[source,bash]
|
144
|
+
----
|
145
|
+
rubysmith --build demo --min --zeitwerk
|
146
|
+
----
|
147
|
+
|
148
|
+
The above will disable _all_ options except for Zeitwerk which will be enabled in this situation.
|
149
|
+
This can be a handy way to build a new project with all options disabled with only a few select
|
150
|
+
options enabled. To have specific options enabled/disabled _every time_ you build a new Ruby
|
151
|
+
project, you can edit your global configuration for making these settings permanent (see below for
|
152
|
+
details).
|
139
153
|
|
140
154
|
=== Configuration
|
141
155
|
|
@@ -161,22 +175,22 @@ The default configuration is as follows:
|
|
161
175
|
:license: "mit"
|
162
176
|
:build:
|
163
177
|
:amazing_print: true
|
164
|
-
:bundler_audit: true
|
165
178
|
:bundler_leak: true
|
166
179
|
:console: true
|
180
|
+
:debug: true
|
167
181
|
:documentation: true
|
168
182
|
:git: true
|
169
183
|
:git_lint: true
|
170
184
|
:guard: true
|
171
185
|
:minimum: false
|
172
|
-
:
|
186
|
+
:rake: true
|
173
187
|
:reek: true
|
174
188
|
:refinements: true
|
175
189
|
:rspec: true
|
176
190
|
:rubocop: true
|
177
|
-
:ruby_critic: true
|
178
191
|
:setup: true
|
179
192
|
:simple_cov: true
|
193
|
+
:zeitwerk: true
|
180
194
|
:builders:
|
181
195
|
:pragmater:
|
182
196
|
:comments:
|
data/bin/rubysmith
CHANGED
data/lib/rubysmith/builder.rb
CHANGED
@@ -6,26 +6,18 @@ require "logger"
|
|
6
6
|
|
7
7
|
module Rubysmith
|
8
8
|
# :reek:TooManyMethods
|
9
|
-
#
|
9
|
+
# Provides common functionality necessary for all builders.
|
10
10
|
class Builder
|
11
11
|
using Refinements::Pathnames
|
12
12
|
|
13
|
-
|
13
|
+
HELPERS = {inserter: Text::Inserter, renderer: Renderers::ERB, kernel: Open3}.freeze
|
14
14
|
|
15
|
-
|
16
|
-
inserter: Text::Inserter,
|
17
|
-
renderer: Renderers::ERB,
|
18
|
-
kernel: Open3,
|
19
|
-
logger: LOGGER
|
20
|
-
}.freeze
|
15
|
+
def self.call(...) = new(...)
|
21
16
|
|
22
|
-
def
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
def initialize realm, helpers: HELPERS
|
27
|
-
@realm = realm
|
17
|
+
def initialize configuration, helpers: HELPERS, container: Container
|
18
|
+
@configuration = configuration
|
28
19
|
@helpers = helpers
|
20
|
+
@container = container
|
29
21
|
end
|
30
22
|
|
31
23
|
def append content
|
@@ -102,7 +94,7 @@ module Rubysmith
|
|
102
94
|
|
103
95
|
private
|
104
96
|
|
105
|
-
attr_reader :
|
97
|
+
attr_reader :configuration, :helpers, :container
|
106
98
|
|
107
99
|
def execute *command
|
108
100
|
kernel.capture2e(*command).then do |result, status|
|
@@ -110,33 +102,23 @@ module Rubysmith
|
|
110
102
|
end
|
111
103
|
end
|
112
104
|
|
113
|
-
def inserter
|
114
|
-
helpers.fetch __method__
|
115
|
-
end
|
105
|
+
def inserter = helpers.fetch(__method__)
|
116
106
|
|
117
|
-
def renderer
|
118
|
-
helpers.fetch(__method__).new realm
|
119
|
-
end
|
107
|
+
def renderer = helpers.fetch(__method__).new(configuration)
|
120
108
|
|
121
|
-
def kernel
|
122
|
-
helpers.fetch __method__
|
123
|
-
end
|
109
|
+
def kernel = helpers.fetch(__method__)
|
124
110
|
|
125
|
-
def logger
|
126
|
-
helpers.fetch __method__
|
127
|
-
end
|
111
|
+
def logger = container[__method__]
|
128
112
|
|
129
|
-
def relative_build_path
|
130
|
-
build_path.relative_path_from realm.build_root
|
131
|
-
end
|
113
|
+
def relative_build_path = build_path.relative_path_from(configuration.target_root)
|
132
114
|
|
133
115
|
def build_path
|
134
|
-
pathway.end_path
|
116
|
+
pathway.end_path
|
117
|
+
.gsub("%project_name%", configuration.project_name)
|
118
|
+
.sub("%project_path%", configuration.project_path)
|
119
|
+
.sub ".erb", ""
|
135
120
|
end
|
136
121
|
|
137
|
-
def pathway
|
138
|
-
realm.to_pathway
|
139
|
-
end
|
122
|
+
def pathway = configuration.to_pathway
|
140
123
|
end
|
141
|
-
# rubocop:enable Metrics/ClassLength
|
142
124
|
end
|
@@ -10,33 +10,31 @@ module Rubysmith
|
|
10
10
|
class Bundler
|
11
11
|
using Refinements::Pathnames
|
12
12
|
|
13
|
-
def self.call
|
14
|
-
new(realm, builder: builder).call
|
15
|
-
end
|
13
|
+
def self.call(...) = new(...).call
|
16
14
|
|
17
|
-
def initialize
|
18
|
-
@
|
15
|
+
def initialize configuration, builder: Builder, client: ::Bundler::CLI
|
16
|
+
@configuration = configuration
|
19
17
|
@builder = builder
|
20
18
|
@client = client
|
21
19
|
end
|
22
20
|
|
23
21
|
def call
|
24
|
-
builder.call(
|
22
|
+
builder.call(configuration.with(template_path: "%project_name%/Gemfile.erb"))
|
25
23
|
.render
|
26
24
|
.replace(/\n\s+group/, "\n\ngroup")
|
27
25
|
.replace(/\n\s+gem/, "\n gem")
|
28
|
-
.replace(/ (?=.+refinements)/, "")
|
26
|
+
.replace(/ (?=.+(refinements|zeitwerk))/, "")
|
29
27
|
.replace(/(\n+|\s+)end/, "\nend")
|
30
28
|
.replace(/\n\ngroup :(code_quality|test|tools) do\nend/, "")
|
31
29
|
.replace(/org"\n+/, "org\"\n\n")
|
32
30
|
|
33
|
-
|
31
|
+
configuration.project_root.change_dir { client.start %w[install --quiet] }
|
34
32
|
nil
|
35
33
|
end
|
36
34
|
|
37
35
|
private
|
38
36
|
|
39
|
-
attr_reader :
|
37
|
+
attr_reader :configuration, :builder, :client
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
@@ -4,26 +4,24 @@ module Rubysmith
|
|
4
4
|
module Builders
|
5
5
|
# Builds project skeleton console for object inspection and exploration.
|
6
6
|
class Console
|
7
|
-
def self.call
|
8
|
-
new(realm, builder: builder).call
|
9
|
-
end
|
7
|
+
def self.call(...) = new(...).call
|
10
8
|
|
11
|
-
def initialize
|
12
|
-
@
|
9
|
+
def initialize configuration, builder: Builder
|
10
|
+
@configuration = configuration
|
13
11
|
@builder = builder
|
14
12
|
end
|
15
13
|
|
16
14
|
def call
|
17
|
-
return unless
|
15
|
+
return unless configuration.build_console
|
18
16
|
|
19
|
-
builder.call(
|
17
|
+
builder.call(configuration.with(template_path: "%project_name%/bin/console.erb"))
|
20
18
|
.render
|
21
19
|
.permit 0o755
|
22
20
|
end
|
23
21
|
|
24
22
|
private
|
25
23
|
|
26
|
-
attr_reader :
|
24
|
+
attr_reader :configuration, :builder
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
@@ -4,24 +4,27 @@ module Rubysmith
|
|
4
4
|
module Builders
|
5
5
|
# Builds project skeleton core structure and minimum file support.
|
6
6
|
class Core
|
7
|
-
def self.call
|
8
|
-
new(realm, builder: builder).call
|
9
|
-
end
|
7
|
+
def self.call(...) = new(...).call
|
10
8
|
|
11
|
-
def initialize
|
12
|
-
@
|
9
|
+
def initialize configuration, builder: Builder
|
10
|
+
@configuration = configuration
|
13
11
|
@builder = builder
|
14
12
|
end
|
15
13
|
|
16
14
|
def call
|
17
|
-
builder.call(
|
18
|
-
|
15
|
+
builder.call(configuration.with(template_path: "%project_name%/lib/%project_path%.rb.erb"))
|
16
|
+
.render
|
17
|
+
.replace(" require", "require")
|
18
|
+
.replace(/ (?=(Zeit|\.tap|\.setup))/, "")
|
19
|
+
.replace("\n \n", "\n\n")
|
20
|
+
|
21
|
+
builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
|
19
22
|
nil
|
20
23
|
end
|
21
24
|
|
22
25
|
private
|
23
26
|
|
24
|
-
attr_reader :
|
27
|
+
attr_reader :configuration, :builder
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
@@ -4,59 +4,54 @@ module Rubysmith
|
|
4
4
|
module Builders
|
5
5
|
# Builds project skeleton documentation.
|
6
6
|
class Documentation
|
7
|
-
def self.call
|
8
|
-
new(realm, builder: builder).call
|
9
|
-
end
|
7
|
+
def self.call(...) = new(...).call
|
10
8
|
|
11
|
-
def initialize
|
12
|
-
@
|
9
|
+
def initialize configuration, builder: Builder
|
10
|
+
@configuration = configuration
|
13
11
|
@builder = builder
|
14
12
|
end
|
15
13
|
|
16
14
|
def call
|
17
|
-
return unless
|
15
|
+
return unless configuration.build_documentation
|
18
16
|
|
19
17
|
private_methods.sort.grep(/render_/).each { |method| __send__ method }
|
20
18
|
end
|
21
19
|
|
22
20
|
private
|
23
21
|
|
24
|
-
attr_reader :
|
22
|
+
attr_reader :configuration, :builder
|
25
23
|
|
26
24
|
def render_changes
|
27
|
-
builder.call(
|
25
|
+
builder.call(configuration.with(template_path: "%project_name%/CHANGES.#{kind}.erb"))
|
28
26
|
.render
|
29
27
|
end
|
30
28
|
|
31
29
|
def render_conduct
|
32
|
-
|
33
|
-
|
30
|
+
configuration.with(template_path: "%project_name%/CODE_OF_CONDUCT.#{kind}.erb")
|
31
|
+
.then { |updated_configuration| builder.call(updated_configuration).render }
|
34
32
|
end
|
35
33
|
|
36
34
|
def render_contributions
|
37
|
-
builder.call(
|
35
|
+
builder.call(configuration.with(template_path: "%project_name%/CONTRIBUTING.#{kind}.erb"))
|
38
36
|
.render
|
39
37
|
end
|
40
38
|
|
41
39
|
def render_license
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
configuration.with(template_path: "%project_name%/LICENSE-#{license}.#{kind}.erb")
|
41
|
+
.then do |updated_configuration|
|
42
|
+
builder.call(updated_configuration).render.rename "LICENSE.#{kind}"
|
43
|
+
end
|
45
44
|
end
|
46
45
|
|
47
46
|
def render_readme
|
48
|
-
builder.call(
|
47
|
+
builder.call(configuration.with(template_path: "%project_name%/README.#{kind}.erb"))
|
49
48
|
.render
|
50
49
|
.replace("\n\n\n", "\n\n")
|
51
50
|
end
|
52
51
|
|
53
|
-
def kind
|
54
|
-
realm.documentation_format || "md"
|
55
|
-
end
|
52
|
+
def kind = configuration.documentation_format || "md"
|
56
53
|
|
57
|
-
def license
|
58
|
-
realm.documentation_license || "mit"
|
59
|
-
end
|
54
|
+
def license = configuration.documentation_license || "mit"
|
60
55
|
end
|
61
56
|
end
|
62
57
|
end
|
@@ -5,19 +5,17 @@ module Rubysmith
|
|
5
5
|
module Git
|
6
6
|
# Builds project skeleton initial Git commit message.
|
7
7
|
class Commit
|
8
|
-
def self.call
|
9
|
-
new(realm, builder: builder).call
|
10
|
-
end
|
8
|
+
def self.call(...) = new(...).call
|
11
9
|
|
12
|
-
def initialize
|
13
|
-
@
|
10
|
+
def initialize configuration, builder: Builder
|
11
|
+
@configuration = configuration
|
14
12
|
@builder = builder
|
15
13
|
end
|
16
14
|
|
17
15
|
def call
|
18
|
-
return unless
|
16
|
+
return unless configuration.build_git
|
19
17
|
|
20
|
-
builder.call(
|
18
|
+
builder.call(configuration)
|
21
19
|
.run("git add .", chdir: project_name)
|
22
20
|
.run(
|
23
21
|
%(git commit --all --message "Added project skeleton" --message "#{body}"),
|
@@ -27,7 +25,7 @@ module Rubysmith
|
|
27
25
|
|
28
26
|
private
|
29
27
|
|
30
|
-
attr_reader :
|
28
|
+
attr_reader :configuration, :builder
|
31
29
|
|
32
30
|
def body
|
33
31
|
<<~CONTENT
|
@@ -36,9 +34,7 @@ module Rubysmith
|
|
36
34
|
CONTENT
|
37
35
|
end
|
38
36
|
|
39
|
-
def project_name
|
40
|
-
realm.project_name
|
41
|
-
end
|
37
|
+
def project_name = configuration.project_name
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|