rubysmith 0.8.0 → 0.11.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/README.adoc +2 -5
- data/bin/rubysmith +0 -4
- data/lib/rubysmith.rb +3 -2
- data/lib/rubysmith/builder.rb +12 -27
- data/lib/rubysmith/builders/bundler.rb +11 -9
- 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 +9 -14
- 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 +68 -0
- data/lib/rubysmith/cli/{defaults.yml → configuration/defaults.yml} +0 -1
- 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 -12
- data/lib/rubysmith/cli/parsers/core.rb +5 -9
- data/lib/rubysmith/cli/processors/build.rb +10 -11
- data/lib/rubysmith/cli/processors/config.rb +3 -7
- data/lib/rubysmith/cli/shell.rb +9 -17
- 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 +5 -5
- 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 +16 -17
- 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 +13 -19
- 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 +8 -3
- data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +4 -4
- metadata +19 -18
- 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: ae1f7e375e5e5d37e378cb82620d52dead76d846f2ea22cbbd32b76f714fc076
|
4
|
+
data.tar.gz: c2fb2727fd8af69b4cbbc35e55b9ff3dc1cdc96f0d05609d505ffaf10ba2e444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee1ad6e82cac22883971e4cf1ff46c606173385f507908be37cc2839fe9c4b9fd8104c1354a74fb7784c592f2cf0bcae44ae5feee71f4db12892c4a971b9fef
|
7
|
+
data.tar.gz: e29e0e144ca76fe0819bfceb8ca936171b0267c67c144acfd6c5aebc6cca8d84f3ecb165cd9f7f69f142a6c28685d2be20c45b68f605d741dfaec25e782eb459
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -26,7 +26,6 @@ toc::[]
|
|
26
26
|
* Uses link:https://www.alchemists.io/projects/runcom[Runcom] for resource configuration management.
|
27
27
|
* Uses link:https://www.alchemists.io/projects/pragmater[Pragmater] for Ruby source pragma directives.
|
28
28
|
* Supports link:https://github.com/amazing-print/amazing_print[Amazing Print].
|
29
|
-
* Supports link:https://github.com/rubysec/bundler-audit[Bundler Audit].
|
30
29
|
* Supports link:https://github.com/rubymem/bundler-leak[Bundler Leak].
|
31
30
|
* Supports link:https://git-scm.com[Git].
|
32
31
|
* Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
|
@@ -79,13 +78,12 @@ From the command line, type: `rubysmith --help`
|
|
79
78
|
....
|
80
79
|
USAGE:
|
81
80
|
-b, --build NAME [options] Build new project.
|
82
|
-
-v, --version Show gem version.
|
83
|
-
-h, --help Show this message.
|
84
81
|
-c, --config ACTION Manage gem configuration: edit or view.
|
82
|
+
-h, --help Show this message.
|
83
|
+
-v, --version Show gem version.
|
85
84
|
|
86
85
|
BUILD OPTIONS:
|
87
86
|
--[no-]amazing_print Add Amazing Print.
|
88
|
-
--[no-]bundler-audit Add Bundler Audit.
|
89
87
|
--[no-]bundler-leak Add Bundler Leak.
|
90
88
|
--[no-]console Add console script.
|
91
89
|
--[no-]documentation Add documentation.
|
@@ -161,7 +159,6 @@ The default configuration is as follows:
|
|
161
159
|
:license: "mit"
|
162
160
|
:build:
|
163
161
|
:amazing_print: true
|
164
|
-
:bundler_audit: true
|
165
162
|
:bundler_leak: true
|
166
163
|
:console: true
|
167
164
|
:documentation: true
|
data/bin/rubysmith
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# TODO: Remove once the Pattern Matching feature is fully supported.
|
5
|
-
Warning[:experimental] = false
|
6
|
-
|
7
4
|
require "rubysmith"
|
8
|
-
require "rubysmith/cli/shell"
|
9
5
|
|
10
6
|
Process.setproctitle Rubysmith::Identity::VERSION_LABEL
|
11
7
|
Rubysmith::CLI::Shell.new.call ARGV
|
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,10 @@ module Rubysmith
|
|
19
19
|
logger: LOGGER
|
20
20
|
}.freeze
|
21
21
|
|
22
|
-
def self.call
|
23
|
-
new realm, helpers: helpers
|
24
|
-
end
|
22
|
+
def self.call(configuration, helpers: HELPERS) = new(configuration, helpers: helpers)
|
25
23
|
|
26
|
-
def initialize
|
27
|
-
@
|
24
|
+
def initialize configuration, helpers: HELPERS
|
25
|
+
@configuration = configuration
|
28
26
|
@helpers = helpers
|
29
27
|
end
|
30
28
|
|
@@ -102,7 +100,7 @@ module Rubysmith
|
|
102
100
|
|
103
101
|
private
|
104
102
|
|
105
|
-
attr_reader :
|
103
|
+
attr_reader :configuration, :helpers
|
106
104
|
|
107
105
|
def execute *command
|
108
106
|
kernel.capture2e(*command).then do |result, status|
|
@@ -110,33 +108,20 @@ module Rubysmith
|
|
110
108
|
end
|
111
109
|
end
|
112
110
|
|
113
|
-
def inserter
|
114
|
-
helpers.fetch __method__
|
115
|
-
end
|
111
|
+
def inserter = helpers.fetch(__method__)
|
116
112
|
|
117
|
-
def renderer
|
118
|
-
helpers.fetch(__method__).new realm
|
119
|
-
end
|
113
|
+
def renderer = helpers.fetch(__method__).new(configuration)
|
120
114
|
|
121
|
-
def kernel
|
122
|
-
helpers.fetch __method__
|
123
|
-
end
|
115
|
+
def kernel = helpers.fetch(__method__)
|
124
116
|
|
125
|
-
def logger
|
126
|
-
helpers.fetch __method__
|
127
|
-
end
|
117
|
+
def logger = helpers.fetch(__method__)
|
128
118
|
|
129
|
-
def relative_build_path
|
130
|
-
build_path.relative_path_from realm.build_root
|
131
|
-
end
|
119
|
+
def relative_build_path = build_path.relative_path_from(configuration.build_root)
|
132
120
|
|
133
121
|
def build_path
|
134
|
-
pathway.end_path.gsub("%project_name%",
|
122
|
+
pathway.end_path.gsub("%project_name%", configuration.project_name).sub ".erb", ""
|
135
123
|
end
|
136
124
|
|
137
|
-
def pathway
|
138
|
-
realm.to_pathway
|
139
|
-
end
|
125
|
+
def pathway = configuration.to_pathway
|
140
126
|
end
|
141
|
-
# rubocop:enable Metrics/ClassLength
|
142
127
|
end
|
@@ -2,23 +2,24 @@
|
|
2
2
|
|
3
3
|
require "bundler"
|
4
4
|
require "bundler/cli"
|
5
|
+
require "refinements/pathnames"
|
5
6
|
|
6
7
|
module Rubysmith
|
7
8
|
module Builders
|
8
9
|
# Builds Bundler Gemfile configuration and installs gem dependencies for project skeleton.
|
9
10
|
class Bundler
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
using Refinements::Pathnames
|
12
|
+
|
13
|
+
def self.call(configuration, builder: Builder) = new(configuration, builder: builder).call
|
13
14
|
|
14
|
-
def initialize
|
15
|
-
@
|
15
|
+
def initialize configuration, builder: Builder, client: ::Bundler::CLI
|
16
|
+
@configuration = configuration
|
16
17
|
@builder = builder
|
17
|
-
@
|
18
|
+
@client = client
|
18
19
|
end
|
19
20
|
|
20
21
|
def call
|
21
|
-
builder.call(
|
22
|
+
builder.call(configuration.with(template_path: "%project_name%/Gemfile.erb"))
|
22
23
|
.render
|
23
24
|
.replace(/\n\s+group/, "\n\ngroup")
|
24
25
|
.replace(/\n\s+gem/, "\n gem")
|
@@ -26,13 +27,14 @@ module Rubysmith
|
|
26
27
|
.replace(/(\n+|\s+)end/, "\nend")
|
27
28
|
.replace(/\n\ngroup :(code_quality|test|tools) do\nend/, "")
|
28
29
|
.replace(/org"\n+/, "org\"\n\n")
|
29
|
-
|
30
|
+
|
31
|
+
configuration.project_root.change_dir { client.start %w[install --quiet] }
|
30
32
|
nil
|
31
33
|
end
|
32
34
|
|
33
35
|
private
|
34
36
|
|
35
|
-
attr_reader :
|
37
|
+
attr_reader :configuration, :builder, :client
|
36
38
|
end
|
37
39
|
end
|
38
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
|