rubysmith 0.2.0 → 0.3.0
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.tar.gz.sig +0 -0
- data/README.adoc +41 -29
- data/lib/rubysmith/builders/bundler.rb +4 -1
- data/lib/rubysmith/builders/rubocop.rb +4 -5
- data/lib/rubysmith/cli/defaults.yml +1 -0
- data/lib/rubysmith/cli/parsers/build.rb +6 -0
- data/lib/rubysmith/cli/processors/build.rb +26 -19
- data/lib/rubysmith/cli/shell.rb +8 -4
- data/lib/rubysmith/identity.rb +1 -1
- data/lib/rubysmith/realm.rb +1 -0
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +33 -31
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +3 -3
- data/lib/rubysmith/templates/%project_name%/README.md.erb +3 -3
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7265bb4446630cf2295f79355fa890b515bc277271b51bdefb0130d35fb3502
|
4
|
+
data.tar.gz: f071cc6e0299ba74bf8515391857e54641c7d7bf9509a2a601059867fa3e69b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c3f3db7a06f7388fef2df0b4bf4df08d0b0baffd98e3bef05a9b3fc5e1cf3d21037f0cdef2b13b9cb4db0179c64c21ddfbe519fadb7f0003442a0c4b9a62296
|
7
|
+
data.tar.gz: 0d6a18e00d270fc3d520cfd1799c233e95a78340334f27788cb2ca876bd92c448e6c483da57a3312cc6e5735a38d0feec499adfdb2c872f4fb3466c0ae853e6a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -56,8 +56,6 @@ toc::[]
|
|
56
56
|
|
57
57
|
== Setup
|
58
58
|
|
59
|
-
=== Production
|
60
|
-
|
61
59
|
To install, run:
|
62
60
|
|
63
61
|
[source,bash]
|
@@ -65,24 +63,6 @@ To install, run:
|
|
65
63
|
gem install rubysmith
|
66
64
|
----
|
67
65
|
|
68
|
-
=== Development
|
69
|
-
|
70
|
-
To contribute, run:
|
71
|
-
|
72
|
-
[source,bash]
|
73
|
-
----
|
74
|
-
git clone https://github.com/bkuhlmann/rubysmith.git
|
75
|
-
cd rubysmith
|
76
|
-
bin/setup
|
77
|
-
----
|
78
|
-
|
79
|
-
You can also use the IRB console for direct access to all objects:
|
80
|
-
|
81
|
-
[source,bash]
|
82
|
-
----
|
83
|
-
bin/console
|
84
|
-
----
|
85
|
-
|
86
66
|
== Usage
|
87
67
|
|
88
68
|
=== Command Line Interface (CLI)
|
@@ -91,15 +71,12 @@ From the command line, type: `rubysmith --help`
|
|
91
71
|
|
92
72
|
....
|
93
73
|
USAGE:
|
94
|
-
-c, --config ACTION Manage gem configuration: edit or view.
|
95
|
-
-b, --build NAME [options] Build new gem.
|
96
74
|
-v, --version Show gem version.
|
97
75
|
-h, --help Show this message.
|
76
|
+
-c, --config ACTION Manage gem configuration: edit or view.
|
77
|
+
-b, --build NAME [options] Build new project.
|
98
78
|
|
99
79
|
BUILD OPTIONS:
|
100
|
-
--[no-]bundler-audit Add Bundler Audit.
|
101
|
-
--[no-]console Add console script.
|
102
|
-
--[no-]documentation Add documentation.
|
103
80
|
--[no-]git Add Git.
|
104
81
|
--[no-]git-lint Add Git Lint.
|
105
82
|
--[no-]guard Add Guard.
|
@@ -109,6 +86,10 @@ BUILD OPTIONS:
|
|
109
86
|
--[no-]rubocop Add Rubocop.
|
110
87
|
--[no-]setup Add setup script.
|
111
88
|
--[no-]simple_cov Add SimpleCov.
|
89
|
+
--min Use minimum/no options.
|
90
|
+
--[no-]bundler-audit Add Bundler Audit.
|
91
|
+
--[no-]console Add console script.
|
92
|
+
--[no-]documentation Add documentation.
|
112
93
|
....
|
113
94
|
|
114
95
|
=== Building
|
@@ -122,16 +103,28 @@ rubysmith --build demo
|
|
122
103
|
----
|
123
104
|
|
124
105
|
Running the above will generate a new `demo` Ruby project with all options enabled. Should you wish
|
125
|
-
to disable
|
106
|
+
to disable specific options, you can use the `--no-*` prefix. Example:
|
126
107
|
|
127
108
|
[source,bash]
|
128
109
|
----
|
129
110
|
rubysmith --build demo --no-pry --no-guard
|
130
111
|
----
|
131
112
|
|
132
|
-
|
133
|
-
|
134
|
-
|
113
|
+
With the above example, both Pry and Guard support would have been disabled when building the `demo`
|
114
|
+
project. Taking this a step further, you can also use the `--min` option to generate a project with
|
115
|
+
bare minimum of options. Example:
|
116
|
+
|
117
|
+
[source,bash]
|
118
|
+
----
|
119
|
+
rubysmith --build demo --min
|
120
|
+
----
|
121
|
+
|
122
|
+
The above is essentially the same as building with _all_ options disabled. This is handy in
|
123
|
+
situations where you need to quickly script something up for sharing with others yet still want to
|
124
|
+
avoid using a Bundler Inline script so gem dependencies are not installed each time the code is run.
|
125
|
+
|
126
|
+
To have specific options enabled/disabled _every time_ you build a new Ruby project, you can edit
|
127
|
+
your global configuration for making these settings permanent (see below for details).
|
135
128
|
|
136
129
|
=== Configuration
|
137
130
|
|
@@ -162,6 +155,7 @@ The default configuration is as follows:
|
|
162
155
|
:git: true
|
163
156
|
:git_lint: true
|
164
157
|
:guard: true
|
158
|
+
:minimum: false
|
165
159
|
:pry: true
|
166
160
|
:reek: true
|
167
161
|
:rspec: true
|
@@ -185,6 +179,24 @@ The default configuration is as follows:
|
|
185
179
|
Feel free to take this default configuration, modify, and save as your own custom
|
186
180
|
`configuration.yml`.
|
187
181
|
|
182
|
+
== Development
|
183
|
+
|
184
|
+
To contribute, run:
|
185
|
+
|
186
|
+
[source,bash]
|
187
|
+
----
|
188
|
+
git clone https://github.com/bkuhlmann/rubysmith.git
|
189
|
+
cd rubysmith
|
190
|
+
bin/setup
|
191
|
+
----
|
192
|
+
|
193
|
+
You can also use the IRB console for direct access to all objects:
|
194
|
+
|
195
|
+
[source,bash]
|
196
|
+
----
|
197
|
+
bin/console
|
198
|
+
----
|
199
|
+
|
188
200
|
== Tests
|
189
201
|
|
190
202
|
To test, run:
|
@@ -20,8 +20,11 @@ module Rubysmith
|
|
20
20
|
def call
|
21
21
|
builder.call(realm.with(template_path: "%project_name%/Gemfile.erb"))
|
22
22
|
.render
|
23
|
-
.replace(
|
23
|
+
.replace(/\n\s*group/, "\n\ngroup")
|
24
24
|
.replace(/\n\s*gem/, "\n gem")
|
25
|
+
.replace(/\s{4}\n/, "")
|
26
|
+
.replace(" end", "end")
|
27
|
+
.replace(/\n{1,}\Z/, "\n")
|
25
28
|
Dir.chdir(realm.project_root) { runner.start %w[install --quiet] }
|
26
29
|
nil
|
27
30
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rubocop"
|
4
|
-
require "
|
4
|
+
require "refinements/ios"
|
5
5
|
|
6
6
|
module Rubysmith
|
7
7
|
module Builders
|
8
8
|
# Builds project skeleton Rubocop code quality support.
|
9
9
|
class Rubocop
|
10
|
+
using Refinements::IOs
|
11
|
+
|
10
12
|
def self.call realm, builder: Builder
|
11
13
|
new(realm, builder: builder).call
|
12
14
|
end
|
@@ -33,10 +35,7 @@ module Rubysmith
|
|
33
35
|
attr_reader :realm, :builder, :runner
|
34
36
|
|
35
37
|
def auto_correct
|
36
|
-
|
37
|
-
$stdout = StringIO.new
|
38
|
-
runner.run ["--auto-correct", "--format", "quiet", realm.project_root.to_s]
|
39
|
-
$stdout = backup
|
38
|
+
STDOUT.squelch { runner.run ["--auto-correct", realm.project_root.to_s] }
|
40
39
|
end
|
41
40
|
end
|
42
41
|
end
|
@@ -24,6 +24,12 @@ module Rubysmith
|
|
24
24
|
|
25
25
|
attr_reader :client, :options
|
26
26
|
|
27
|
+
def add_minimum
|
28
|
+
client.on "--min", "Use minimum/no options." do |value|
|
29
|
+
options[:build_minimum] = value
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
27
33
|
def add_bundler_audit
|
28
34
|
client.on "--[no-]bundler-audit", "Add Bundler Audit." do |value|
|
29
35
|
options[:build_bundler_audit] = value
|
@@ -3,27 +3,34 @@
|
|
3
3
|
module Rubysmith
|
4
4
|
module CLI
|
5
5
|
module Processors
|
6
|
-
# Order is important.
|
7
|
-
BUILDERS = [
|
8
|
-
Builders::Core,
|
9
|
-
Builders::Documentation,
|
10
|
-
Builders::Git::Setup,
|
11
|
-
Builders::Bundler,
|
12
|
-
Builders::Rake,
|
13
|
-
Builders::Console,
|
14
|
-
Builders::Setup,
|
15
|
-
Builders::Guard,
|
16
|
-
Builders::Reek,
|
17
|
-
Builders::RSpec::Context,
|
18
|
-
Builders::RSpec::Helper,
|
19
|
-
Builders::Pragma,
|
20
|
-
Builders::Rubocop,
|
21
|
-
Builders::Git::Commit
|
22
|
-
].freeze
|
23
|
-
|
24
6
|
# Handles the Command Line Interface (CLI) for building of a project skeleton.
|
25
7
|
class Build
|
26
|
-
|
8
|
+
# Order is important.
|
9
|
+
MINIMUM = [
|
10
|
+
Builders::Core,
|
11
|
+
Builders::Bundler,
|
12
|
+
Builders::Pragma
|
13
|
+
].freeze
|
14
|
+
|
15
|
+
# Order is important.
|
16
|
+
MAXIMUM = [
|
17
|
+
Builders::Core,
|
18
|
+
Builders::Documentation,
|
19
|
+
Builders::Git::Setup,
|
20
|
+
Builders::Bundler,
|
21
|
+
Builders::Rake,
|
22
|
+
Builders::Console,
|
23
|
+
Builders::Setup,
|
24
|
+
Builders::Guard,
|
25
|
+
Builders::Reek,
|
26
|
+
Builders::RSpec::Context,
|
27
|
+
Builders::RSpec::Helper,
|
28
|
+
Builders::Pragma,
|
29
|
+
Builders::Rubocop,
|
30
|
+
Builders::Git::Commit
|
31
|
+
].freeze
|
32
|
+
|
33
|
+
def initialize builders: MAXIMUM
|
27
34
|
@builders = builders
|
28
35
|
end
|
29
36
|
|
data/lib/rubysmith/cli/shell.rb
CHANGED
@@ -11,7 +11,8 @@ module Rubysmith
|
|
11
11
|
|
12
12
|
PROCESSORS = {
|
13
13
|
config: Processors::Config.new,
|
14
|
-
|
14
|
+
build_minimum: Processors::Build.new(builders: Processors::Build::MINIMUM),
|
15
|
+
build_maximum: Processors::Build.new
|
15
16
|
}.freeze
|
16
17
|
|
17
18
|
def initialize parser: Parsers::Assembler.new, processors: PROCESSORS
|
@@ -22,13 +23,16 @@ module Rubysmith
|
|
22
23
|
def call arguments = []
|
23
24
|
parse arguments
|
24
25
|
|
26
|
+
# rubocop:disable Style/MethodCallWithArgsParentheses
|
25
27
|
case options
|
26
28
|
in config: action, **remainder then config action
|
27
|
-
in
|
29
|
+
in build_minimum: true, **remainder then build(:build_minimum, options)
|
30
|
+
in build:, **remainder then build(:build_maximum, options)
|
28
31
|
in version:, **remainder then puts version
|
29
32
|
in help:, **remainder then usage
|
30
33
|
else usage
|
31
34
|
end
|
35
|
+
# rubocop:enable Style/MethodCallWithArgsParentheses
|
32
36
|
end
|
33
37
|
|
34
38
|
private
|
@@ -45,8 +49,8 @@ module Rubysmith
|
|
45
49
|
processors.fetch(__method__).call action
|
46
50
|
end
|
47
51
|
|
48
|
-
def build settings
|
49
|
-
processors.fetch(
|
52
|
+
def build kind, settings
|
53
|
+
processors.fetch(kind).call settings.rekey(build: :project_name).merge(now: Time.now)
|
50
54
|
end
|
51
55
|
|
52
56
|
def options
|
data/lib/rubysmith/identity.rb
CHANGED
data/lib/rubysmith/realm.rb
CHANGED
@@ -1,33 +1,35 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
3
|
+
<% unless realm.build_minimum %>
|
4
|
+
group :development do
|
5
|
+
<% if realm.build_bundler_audit %>
|
6
|
+
gem "bundler-audit", "~> 0.7"
|
7
|
+
<% end %>
|
8
|
+
<% if realm.build_git && realm.build_git_lint %>
|
9
|
+
gem "git-lint", "~> 1.0"
|
10
|
+
<% end %>
|
11
|
+
<% if realm.build_guard %>
|
12
|
+
gem "guard-rspec", "~> 4.7"
|
13
|
+
<% end %>
|
14
|
+
<% if realm.build_pry %>
|
15
|
+
gem "pry", "~> 0.13"
|
16
|
+
gem "pry-byebug", "~> 3.9"
|
17
|
+
<% end %>
|
18
|
+
gem "rake", "~> 13.0"
|
19
|
+
<% if realm.build_reek %>
|
20
|
+
gem "reek", "~> 6.0"
|
21
|
+
<% end %>
|
22
|
+
<% if realm.build_rspec %>
|
23
|
+
gem "rspec", "~> 3.9"
|
24
|
+
<% end %>
|
25
|
+
<% if realm.build_rubocop %>
|
26
|
+
gem "rubocop", "~> 0.92"
|
27
|
+
gem "rubocop-performance", "~> 1.8"
|
28
|
+
gem "rubocop-rake", "~> 0.5"
|
29
|
+
gem "rubocop-rspec", "~> 1.43"
|
30
|
+
<% end %>
|
31
|
+
<% if realm.build_simple_cov %>
|
32
|
+
gem "simplecov", "~> 0.19"
|
33
|
+
<% end %>
|
34
|
+
end
|
35
|
+
<% end %>
|
@@ -26,11 +26,11 @@ bin/setup
|
|
26
26
|
<% end %>
|
27
27
|
|
28
28
|
== Usage
|
29
|
-
<% if realm.build_console %>
|
30
29
|
|
31
|
-
|
30
|
+
== Development
|
31
|
+
<% if realm.build_console %>
|
32
32
|
|
33
|
-
|
33
|
+
You can also use the IRB console for direct access to all objects:
|
34
34
|
|
35
35
|
[source,bash]
|
36
36
|
----
|
@@ -20,11 +20,11 @@ To set up the project, run:
|
|
20
20
|
<% end %>
|
21
21
|
|
22
22
|
## Usage
|
23
|
-
<% if realm.build_console %>
|
24
23
|
|
25
|
-
|
24
|
+
## Development
|
25
|
+
<% if realm.build_console %>
|
26
26
|
|
27
|
-
|
27
|
+
You can also use the IRB console for direct access to all objects:
|
28
28
|
|
29
29
|
bin/console
|
30
30
|
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysmith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
|
29
29
|
QWc=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2020-10-
|
31
|
+
date: 2020-10-18 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pragmater
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '7.
|
53
|
+
version: '7.11'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '7.
|
60
|
+
version: '7.11'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rubocop
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
Binary file
|