rubysmith 0.9.1 → 0.10.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.tar.gz.sig +0 -0
- data/bin/rubysmith +0 -1
- data/lib/rubysmith.rb +3 -2
- data/lib/rubysmith/builder.rb +13 -26
- data/lib/rubysmith/builders/bundler.rb +6 -8
- data/lib/rubysmith/builders/console.rb +6 -8
- data/lib/rubysmith/builders/core.rb +7 -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 +5 -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/ruby_critic.rb +6 -8
- data/lib/rubysmith/builders/setup.rb +8 -8
- data/lib/rubysmith/cli/configuration/content.rb +69 -0
- data/lib/rubysmith/cli/{defaults.yml → configuration/defaults.yml} +0 -0
- data/lib/rubysmith/cli/configuration/loader.rb +35 -0
- data/lib/rubysmith/cli/parsers.rb +11 -0
- data/lib/rubysmith/cli/parsers/assembler.rb +10 -15
- data/lib/rubysmith/cli/parsers/build.rb +4 -6
- data/lib/rubysmith/cli/parsers/core.rb +5 -9
- data/lib/rubysmith/cli/processors/build.rb +9 -8
- data/lib/rubysmith/cli/processors/config.rb +3 -7
- data/lib/rubysmith/cli/shell.rb +7 -14
- data/lib/rubysmith/identity.rb +1 -1
- data/lib/rubysmith/pathway.rb +3 -9
- data/lib/rubysmith/renderers/erb.rb +7 -9
- data/lib/rubysmith/renderers/namespace.rb +1 -3
- 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 +14 -14
- 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 +15 -15
- data/lib/rubysmith/templates/%project_name%/bin/console.erb +1 -1
- data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +1 -1
- 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
- metadata +7 -6
- metadata.gz.sig +0 -0
- data/lib/rubysmith/cli/configuration.rb +0 -30
- data/lib/rubysmith/realm.rb +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c99851111508a1453340fd292981281260eb2b197e1c3685fd40207078cfeee5
|
4
|
+
data.tar.gz: e5781a5bf2f57c8129b1049ac817abdb60a2a2548f7a52fcbd29596587f4701c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dcbcf78f012f5fc4eb2409bd7d69ecb42e6033df93a227c510226621d56f8d291458c5528c33bf89673bf81f9849017a003fb8a8fdab649f706c725af862ffe
|
7
|
+
data.tar.gz: f6f050ce4b479505bbdff25a34a880e8ce72afc48524c283692f34d255686dd4eab037b365019b4fbd83fce9dccce9e1394ea1b47295908b0c29d7d27db56c55
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/bin/rubysmith
CHANGED
data/lib/rubysmith.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "rubysmith/identity"
|
4
4
|
require "rubysmith/pathway"
|
5
|
-
require "rubysmith/realm"
|
6
5
|
require "rubysmith/renderers/namespace"
|
7
6
|
require "rubysmith/renderers/erb"
|
8
7
|
require "rubysmith/text/inserter"
|
@@ -23,10 +22,12 @@ require "rubysmith/builders/pragma"
|
|
23
22
|
require "rubysmith/builders/rubocop/setup"
|
24
23
|
require "rubysmith/builders/rubocop/formatter"
|
25
24
|
require "rubysmith/builders/ruby_critic"
|
25
|
+
require "rubysmith/cli/configuration/content"
|
26
|
+
require "rubysmith/cli/configuration/loader"
|
27
|
+
require "rubysmith/cli/parsers"
|
26
28
|
require "rubysmith/cli/parsers/core"
|
27
29
|
require "rubysmith/cli/parsers/build"
|
28
30
|
require "rubysmith/cli/parsers/assembler"
|
29
31
|
require "rubysmith/cli/processors/config"
|
30
32
|
require "rubysmith/cli/processors/build"
|
31
|
-
require "rubysmith/cli/configuration"
|
32
33
|
require "rubysmith/cli/shell"
|
data/lib/rubysmith/builder.rb
CHANGED
@@ -6,7 +6,7 @@ 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
|
|
@@ -19,12 +19,12 @@ module Rubysmith
|
|
19
19
|
logger: LOGGER
|
20
20
|
}.freeze
|
21
21
|
|
22
|
-
def self.call
|
23
|
-
new
|
22
|
+
def self.call configuration, helpers: HELPERS
|
23
|
+
new configuration, helpers: helpers
|
24
24
|
end
|
25
25
|
|
26
|
-
def initialize
|
27
|
-
@
|
26
|
+
def initialize configuration, helpers: HELPERS
|
27
|
+
@configuration = configuration
|
28
28
|
@helpers = helpers
|
29
29
|
end
|
30
30
|
|
@@ -102,7 +102,7 @@ module Rubysmith
|
|
102
102
|
|
103
103
|
private
|
104
104
|
|
105
|
-
attr_reader :
|
105
|
+
attr_reader :configuration, :helpers
|
106
106
|
|
107
107
|
def execute *command
|
108
108
|
kernel.capture2e(*command).then do |result, status|
|
@@ -110,33 +110,20 @@ module Rubysmith
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
def inserter
|
114
|
-
helpers.fetch __method__
|
115
|
-
end
|
113
|
+
def inserter = helpers.fetch(__method__)
|
116
114
|
|
117
|
-
def renderer
|
118
|
-
helpers.fetch(__method__).new realm
|
119
|
-
end
|
115
|
+
def renderer = helpers.fetch(__method__).new(configuration)
|
120
116
|
|
121
|
-
def kernel
|
122
|
-
helpers.fetch __method__
|
123
|
-
end
|
117
|
+
def kernel = helpers.fetch(__method__)
|
124
118
|
|
125
|
-
def logger
|
126
|
-
helpers.fetch __method__
|
127
|
-
end
|
119
|
+
def logger = helpers.fetch(__method__)
|
128
120
|
|
129
|
-
def relative_build_path
|
130
|
-
build_path.relative_path_from realm.build_root
|
131
|
-
end
|
121
|
+
def relative_build_path = build_path.relative_path_from(configuration.build_root)
|
132
122
|
|
133
123
|
def build_path
|
134
|
-
pathway.end_path.gsub("%project_name%",
|
124
|
+
pathway.end_path.gsub("%project_name%", configuration.project_name).sub ".erb", ""
|
135
125
|
end
|
136
126
|
|
137
|
-
def pathway
|
138
|
-
realm.to_pathway
|
139
|
-
end
|
127
|
+
def pathway = configuration.to_pathway
|
140
128
|
end
|
141
|
-
# rubocop:enable Metrics/ClassLength
|
142
129
|
end
|
@@ -10,18 +10,16 @@ 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(configuration, builder: Builder) = new(configuration, builder: builder).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")
|
@@ -30,13 +28,13 @@ module Rubysmith
|
|
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(configuration, builder: Builder) = new(configuration, builder: builder).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,23 @@ 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(configuration, builder: Builder) = new(configuration, builder: builder).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_name%.rb.erb"))
|
16
|
+
.render
|
17
|
+
builder.call(configuration.with(template_path: "%project_name%/.ruby-version.erb")).render
|
19
18
|
nil
|
20
19
|
end
|
21
20
|
|
22
21
|
private
|
23
22
|
|
24
|
-
attr_reader :
|
23
|
+
attr_reader :configuration, :builder
|
25
24
|
end
|
26
25
|
end
|
27
26
|
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(configuration, builder: Builder) = new(configuration, builder: builder).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(configuration, builder: Builder) = new(configuration, builder: builder).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
|
@@ -5,24 +5,22 @@ module Rubysmith
|
|
5
5
|
module Git
|
6
6
|
# Initializes project skeleton as a Git repository.
|
7
7
|
class Setup
|
8
|
-
def self.call
|
9
|
-
new(realm, builder: builder).call
|
10
|
-
end
|
8
|
+
def self.call(configuration, builder: Builder) = new(configuration, builder: builder).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).run("git init", chdir: configuration.project_name)
|
21
19
|
end
|
22
20
|
|
23
21
|
private
|
24
22
|
|
25
|
-
attr_reader :
|
23
|
+
attr_reader :configuration, :builder
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
@@ -4,25 +4,25 @@ module Rubysmith
|
|
4
4
|
module Builders
|
5
5
|
# Builds project skeleton Guard support for a red, green, refactor loop.
|
6
6
|
class Guard
|
7
|
-
def self.call
|
8
|
-
new(realm, builder: builder).call
|
9
|
-
end
|
7
|
+
def self.call(configuration, builder: Builder) = new(configuration, builder: builder).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_guard
|
18
16
|
|
19
|
-
builder.call(
|
20
|
-
|
17
|
+
builder.call(configuration.with(template_path: "%project_name%/bin/guard.erb"))
|
18
|
+
.render
|
19
|
+
.permit 0o755
|
20
|
+
builder.call(configuration.with(template_path: "%project_name%/Guardfile.erb")).render
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
attr_reader :
|
25
|
+
attr_reader :configuration, :builder
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -6,30 +6,25 @@ module Rubysmith
|
|
6
6
|
module Builders
|
7
7
|
# Builds project skeleton pragmas so all Ruby strings are frozen by default.
|
8
8
|
class Pragma
|
9
|
-
def self.call
|
10
|
-
new(realm).call
|
11
|
-
end
|
9
|
+
def self.call(configuration) = new(configuration).call
|
12
10
|
|
13
|
-
def initialize
|
14
|
-
@
|
11
|
+
def initialize configuration, client: Pragmater::Runner
|
12
|
+
@configuration = configuration
|
15
13
|
@client = client
|
16
14
|
end
|
17
15
|
|
18
|
-
def call
|
19
|
-
client.for(**attributes).call
|
20
|
-
nil
|
21
|
-
end
|
16
|
+
def call = client.for(**attributes).call && nil
|
22
17
|
|
23
18
|
private
|
24
19
|
|
25
|
-
attr_reader :
|
20
|
+
attr_reader :configuration, :client
|
26
21
|
|
27
22
|
def attributes
|
28
23
|
{
|
29
24
|
action: :insert,
|
30
|
-
root_dir:
|
31
|
-
comments:
|
32
|
-
includes:
|
25
|
+
root_dir: configuration.project_root,
|
26
|
+
comments: configuration.builders_pragmater_comments,
|
27
|
+
includes: configuration.builders_pragmater_includes
|
33
28
|
}
|
34
29
|
end
|
35
30
|
end
|