rubysmith 0.1.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/LICENSE.adoc +162 -0
- data/README.adoc +207 -0
- data/bin/rubysmith +11 -0
- data/lib/rubysmith.rb +30 -0
- data/lib/rubysmith/builder.rb +145 -0
- data/lib/rubysmith/builders/bundler.rb +34 -0
- data/lib/rubysmith/builders/console.rb +29 -0
- data/lib/rubysmith/builders/core.rb +29 -0
- data/lib/rubysmith/builders/documentation.rb +60 -0
- data/lib/rubysmith/builders/git/commit.rb +45 -0
- data/lib/rubysmith/builders/git/setup.rb +29 -0
- data/lib/rubysmith/builders/guard.rb +28 -0
- data/lib/rubysmith/builders/pragma.rb +37 -0
- data/lib/rubysmith/builders/rake.rb +32 -0
- data/lib/rubysmith/builders/reek.rb +27 -0
- data/lib/rubysmith/builders/rspec/context.rb +31 -0
- data/lib/rubysmith/builders/rspec/helper.rb +33 -0
- data/lib/rubysmith/builders/rubocop.rb +43 -0
- data/lib/rubysmith/builders/setup.rb +27 -0
- data/lib/rubysmith/cli/configuration.rb +29 -0
- data/lib/rubysmith/cli/defaults.yml +34 -0
- data/lib/rubysmith/cli/parsers/assembler.rb +39 -0
- data/lib/rubysmith/cli/parsers/build.rb +101 -0
- data/lib/rubysmith/cli/parsers/core.rb +59 -0
- data/lib/rubysmith/cli/processors/build.rb +44 -0
- data/lib/rubysmith/cli/processors/config.rb +35 -0
- data/lib/rubysmith/cli/shell.rb +61 -0
- data/lib/rubysmith/identity.rb +11 -0
- data/lib/rubysmith/pathway.rb +37 -0
- data/lib/rubysmith/realm.rb +69 -0
- data/lib/rubysmith/renderers/erb.rb +29 -0
- data/lib/rubysmith/renderers/namespace.rb +47 -0
- data/lib/rubysmith/templates/%project_name%/.reek.yml.erb +3 -0
- data/lib/rubysmith/templates/%project_name%/.rubocop.yml.erb +7 -0
- data/lib/rubysmith/templates/%project_name%/.ruby-version.erb +1 -0
- data/lib/rubysmith/templates/%project_name%/CHANGES.adoc.erb +5 -0
- data/lib/rubysmith/templates/%project_name%/CHANGES.md.erb +5 -0
- data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.adoc.erb +114 -0
- data/lib/rubysmith/templates/%project_name%/CODE_OF_CONDUCT.md.erb +115 -0
- data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.adoc.erb +22 -0
- data/lib/rubysmith/templates/%project_name%/CONTRIBUTING.md.erb +22 -0
- data/lib/rubysmith/templates/%project_name%/Gemfile.erb +33 -0
- data/lib/rubysmith/templates/%project_name%/Guardfile.erb +5 -0
- data/lib/rubysmith/templates/%project_name%/LICENSE-apache.adoc.erb +162 -0
- data/lib/rubysmith/templates/%project_name%/LICENSE-apache.md.erb +162 -0
- data/lib/rubysmith/templates/%project_name%/LICENSE-mit.adoc.erb +20 -0
- data/lib/rubysmith/templates/%project_name%/LICENSE-mit.md.erb +20 -0
- data/lib/rubysmith/templates/%project_name%/README.adoc.erb +78 -0
- data/lib/rubysmith/templates/%project_name%/README.md.erb +66 -0
- data/lib/rubysmith/templates/%project_name%/Rakefile.erb +33 -0
- data/lib/rubysmith/templates/%project_name%/bin/console.erb +11 -0
- data/lib/rubysmith/templates/%project_name%/bin/guard.erb +6 -0
- data/lib/rubysmith/templates/%project_name%/bin/rubocop.erb +7 -0
- data/lib/rubysmith/templates/%project_name%/bin/setup.erb +8 -0
- data/lib/rubysmith/templates/%project_name%/lib/%project_name%.rb.erb +1 -0
- data/lib/rubysmith/templates/%project_name%/lib/%project_name%/identity.rb.erb +8 -0
- data/lib/rubysmith/templates/%project_name%/spec/spec_helper.rb.erb +34 -0
- data/lib/rubysmith/templates/%project_name%/spec/support/shared_contexts/temp_dir.rb.erb +9 -0
- data/lib/rubysmith/text/inserter.rb +31 -0
- metadata +367 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6500ee76663913e7e85d064b5629c7f2e7366e6c4ac0015108c68ef58347be58
|
4
|
+
data.tar.gz: 7999ae8f922c9548314599c551523005c09dfbf4aa72a8c5c4358cc2bc2d8feb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4fa61bddb36ed3e1932c8992ed2ebfefefd294f1d2ff13b309d4b536c4d2984abbf78555fc5fad414814c8aa162ac1f9a6e2aa8c67ba31fdead382838aab6ae0
|
7
|
+
data.tar.gz: 5940e066becdd98146ce18991bb510b2bb8a4d66d165be5c1325b1217e7c3478213323921978fd97e5bc3a88e63acd7ff5fc5f58100ebd5988557ed6772e334b
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/LICENSE.adoc
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
= Apache License
|
2
|
+
|
3
|
+
Version 2.0, January 2004
|
4
|
+
|
5
|
+
http://www.apache.org/licenses
|
6
|
+
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
8
|
+
|
9
|
+
== 1. Definitions
|
10
|
+
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
|
12
|
+
Sections 1 through 9 of this document.
|
13
|
+
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is
|
15
|
+
granting the License.
|
16
|
+
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are
|
18
|
+
controlled by, or are under common control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the direction or management of such
|
20
|
+
entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this
|
24
|
+
License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to
|
27
|
+
software source code, documentation source, and configuration files.
|
28
|
+
|
29
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a
|
30
|
+
Source form, including but not limited to compiled object code, generated documentation, and
|
31
|
+
conversions to other media types.
|
32
|
+
|
33
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the
|
34
|
+
License, as indicated by a copyright notice that is included in or attached to the work (an example
|
35
|
+
is provided in the Appendix below).
|
36
|
+
|
37
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or
|
38
|
+
derived from) the Work and for which the editorial revisions, annotations, elaborations, or other
|
39
|
+
modifications represent, as a whole, an original work of authorship. For the purposes of this
|
40
|
+
License, Derivative Works shall not include works that remain separable from, or merely link (or
|
41
|
+
bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
42
|
+
|
43
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any
|
44
|
+
modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted
|
45
|
+
to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity
|
46
|
+
authorized to submit on behalf of the copyright owner. For the purposes of this definition,
|
47
|
+
"submitted" means any form of electronic, verbal, or written communication sent to the Licensor or
|
48
|
+
its representatives, including but not limited to communication on electronic mailing lists, source
|
49
|
+
code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor
|
50
|
+
for the purpose of discussing and improving the Work, but excluding communication that is
|
51
|
+
conspicuously marked or otherwise designated in writing by the copyright owner as "Not a
|
52
|
+
Contribution."
|
53
|
+
|
54
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a
|
55
|
+
Contribution has been received by Licensor and subsequently incorporated within the Work.
|
56
|
+
|
57
|
+
== 2. Grant of Copyright License
|
58
|
+
|
59
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
60
|
+
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
61
|
+
reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and
|
62
|
+
distribute the Work and such Derivative Works in Source or Object form.
|
63
|
+
|
64
|
+
== 3. Grant of Patent License
|
65
|
+
|
66
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a
|
67
|
+
perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
|
68
|
+
section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer
|
69
|
+
the Work, where such license applies only to those patent claims licensable by such Contributor that
|
70
|
+
are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s)
|
71
|
+
with the Work to which such Contribution(s) was submitted. If You institute patent litigation
|
72
|
+
against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or
|
73
|
+
a Contribution incorporated within the Work constitutes direct or contributory patent infringement,
|
74
|
+
then any patent licenses granted to You under this License for that Work shall terminate as of the
|
75
|
+
date such litigation is filed.
|
76
|
+
|
77
|
+
== 4. Redistribution
|
78
|
+
|
79
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with
|
80
|
+
or without modifications, and in Source or Object form, provided that You meet the following
|
81
|
+
conditions:
|
82
|
+
|
83
|
+
. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
84
|
+
|
85
|
+
. You must cause any modified files to carry prominent notices stating that You changed the files;
|
86
|
+
and
|
87
|
+
|
88
|
+
. You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
|
89
|
+
patent, trademark, and attribution notices from the Source form of the Work, excluding those
|
90
|
+
notices that do not pertain to any part of the Derivative Works; and
|
91
|
+
|
92
|
+
. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works
|
93
|
+
that You distribute must include a readable copy of the attribution notices contained within such
|
94
|
+
NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in
|
95
|
+
at least one of the following places: within a NOTICE text file distributed as part of the
|
96
|
+
Derivative Works; within the Source form or documentation, if provided along with the Derivative
|
97
|
+
Works; or, within a display generated by the Derivative Works, if and wherever such third-party
|
98
|
+
notices normally appear. The contents of the NOTICE file are for informational purposes only and
|
99
|
+
do not modify the License. You may add Your own attribution notices within Derivative Works that
|
100
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such
|
101
|
+
additional attribution notices cannot be construed as modifying the License.
|
102
|
+
|
103
|
+
You may add Your own copyright statement to Your modifications and may provide additional or
|
104
|
+
different license terms and conditions for use, reproduction, or distribution of Your modifications,
|
105
|
+
or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of
|
106
|
+
the Work otherwise complies with the conditions stated in this License.
|
107
|
+
|
108
|
+
== 5. Submission of Contributions
|
109
|
+
|
110
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the
|
111
|
+
Work by You to the Licensor shall be under the terms and conditions of this License, without any
|
112
|
+
additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify
|
113
|
+
the terms of any separate license agreement you may have executed with Licensor regarding such
|
114
|
+
Contributions.
|
115
|
+
|
116
|
+
== 6. Trademarks
|
117
|
+
|
118
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product
|
119
|
+
names of the Licensor, except as required for reasonable and customary use in describing the origin
|
120
|
+
of the Work and reproducing the content of the NOTICE file.
|
121
|
+
|
122
|
+
== 7. Disclaimer of Warranty
|
123
|
+
|
124
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each
|
125
|
+
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
126
|
+
KIND, either express or implied, including, without limitation, any warranties or conditions of
|
127
|
+
TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
|
128
|
+
responsible for determining the appropriateness of using or redistributing the Work and assume any
|
129
|
+
risks associated with Your exercise of permissions under this License.
|
130
|
+
|
131
|
+
== 8. Limitation of Liability
|
132
|
+
|
133
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or
|
134
|
+
otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
|
135
|
+
agreed to in writing, shall any Contributor be liable to You for damages, including any direct,
|
136
|
+
indirect, special, incidental, or consequential damages of any character arising as a result of this
|
137
|
+
License or out of the use or inability to use the Work (including but not limited to damages for
|
138
|
+
loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial
|
139
|
+
damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
140
|
+
|
141
|
+
== 9. Accepting Warranty or Additional Liability
|
142
|
+
|
143
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee
|
144
|
+
for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights
|
145
|
+
consistent with this License. However, in accepting such obligations, You may act only on Your own
|
146
|
+
behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You
|
147
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or
|
148
|
+
claims asserted against, such Contributor by reason of your accepting any such warranty or
|
149
|
+
additional liability.
|
150
|
+
|
151
|
+
END OF TERMS AND CONDITIONS
|
152
|
+
|
153
|
+
Copyright 2020 link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
154
|
+
|
155
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
|
156
|
+
compliance with the License. You may obtain a link:https://www.apache.org/licenses/LICENSE-2.0[copy]
|
157
|
+
of the License.
|
158
|
+
|
159
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is
|
160
|
+
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
161
|
+
implied. See the License for the specific language governing permissions and limitations under the
|
162
|
+
License.
|
data/README.adoc
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
:toc: macro
|
2
|
+
:toclevels: 5
|
3
|
+
:figure-caption!:
|
4
|
+
|
5
|
+
= Rubysmith
|
6
|
+
|
7
|
+
[link=http://badge.fury.io/rb/rubysmith]
|
8
|
+
image::https://badge.fury.io/rb/rubysmith.svg[Gem Version]
|
9
|
+
[link=https://circleci.com/gh/bkuhlmann/rubysmith]
|
10
|
+
image::https://circleci.com/gh/bkuhlmann/rubysmith.svg?style=svg[Circle CI Status]
|
11
|
+
|
12
|
+
A command line interface for smithing Ruby projects.
|
13
|
+
|
14
|
+
toc::[]
|
15
|
+
|
16
|
+
== Features
|
17
|
+
|
18
|
+
* Builds a Ruby project skeleton for custom design and development.
|
19
|
+
* Uses link:https://www.alchemists.io/projects/refinements[Refinements] Ruby core library enhancements.
|
20
|
+
* Uses link:https://www.alchemists.io/projects/runcom[Runcom] for resource configuration management.
|
21
|
+
* Uses link:https://www.alchemists.io/projects/pragmater[Pragmater] for Ruby source pragma directives.
|
22
|
+
* Supports link:https://github.com/rubysec/bundler-audit[Bundler Audit].
|
23
|
+
* Supports link:https://git-scm.com[Git]
|
24
|
+
* Supports link:https://www.alchemists.io/projects/git-lint[Git Lint].
|
25
|
+
* Supports link:https://github.com/guard/guard[Guard].
|
26
|
+
* Supports link:http://pryrepl.org[Pry].
|
27
|
+
* Supports link:https://github.com/troessner/reek[Reek].
|
28
|
+
* Supports link:https://rspec.info[RSpec].
|
29
|
+
* Supports link:https://github.com/rubocop-hq/rubocop[Rubocop].
|
30
|
+
* Supports link:https://github.com/rubocop-hq/rubocop-rspec[Rubocop RSpec].
|
31
|
+
* Supports link:https://github.com/simplecov-ruby/simplecov[SimpleCov].
|
32
|
+
* Supports common settings and a structured layout for building projects.
|
33
|
+
* Provides common documentation:
|
34
|
+
** README
|
35
|
+
** CHANGES
|
36
|
+
** CONTRIBUTING
|
37
|
+
** CODE OF CONDUCT
|
38
|
+
** LICENSE
|
39
|
+
|
40
|
+
== Screencasts
|
41
|
+
|
42
|
+
[link=https://www.alchemists.io/screencasts/rubysmith]
|
43
|
+
image::https://www.alchemists.io/images/screencasts/rubysmith/cover.svg[Screencast,600,240,role=focal_point]
|
44
|
+
|
45
|
+
== Requirements
|
46
|
+
|
47
|
+
. A UNIX-based system.
|
48
|
+
. link:https://www.ruby-lang.org[Ruby].
|
49
|
+
. link:https://rubygems.org[RubyGems].
|
50
|
+
. link:https://github.com/bundler/bundler[Bundler].
|
51
|
+
|
52
|
+
== Setup
|
53
|
+
|
54
|
+
=== Production
|
55
|
+
|
56
|
+
To install, run:
|
57
|
+
|
58
|
+
[source,bash]
|
59
|
+
----
|
60
|
+
gem install rubysmith
|
61
|
+
----
|
62
|
+
|
63
|
+
=== Development
|
64
|
+
|
65
|
+
To contribute, run:
|
66
|
+
|
67
|
+
[source,bash]
|
68
|
+
----
|
69
|
+
git clone https://github.com/bkuhlmann/rubysmith.git
|
70
|
+
cd rubysmith
|
71
|
+
bin/setup
|
72
|
+
----
|
73
|
+
|
74
|
+
You can also use the IRB console for direct access to all objects:
|
75
|
+
|
76
|
+
[source,bash]
|
77
|
+
----
|
78
|
+
bin/console
|
79
|
+
----
|
80
|
+
|
81
|
+
== Usage
|
82
|
+
|
83
|
+
=== Command Line Interface (CLI)
|
84
|
+
|
85
|
+
From the command line, type: `rubysmith --help`
|
86
|
+
|
87
|
+
....
|
88
|
+
USAGE:
|
89
|
+
-v, --version Show gem version.
|
90
|
+
-h, --help Show this message.
|
91
|
+
-c, --config ACTION Manage gem configuration: edit or view.
|
92
|
+
-b, --build NAME [options] Build new gem.
|
93
|
+
|
94
|
+
BUILD OPTIONS:
|
95
|
+
--[no-]bundler-audit Add Bundler Audit.
|
96
|
+
--[no-]console Add console support.
|
97
|
+
--[no-]documentation Add Documentation.
|
98
|
+
--[no-]git Add Git.
|
99
|
+
--[no-]git-lint Add Git Lint.
|
100
|
+
--[no-]guard Add Guard.
|
101
|
+
--[no-]reek Add Reek.
|
102
|
+
--[no-]pry Add Pry.
|
103
|
+
--[no-]rubocop Add Rubocop.
|
104
|
+
--[no-]rspec Add RSpec.
|
105
|
+
--[no-]simple_cov Add SimpleCov.
|
106
|
+
--[no-]setup Add setup support.
|
107
|
+
....
|
108
|
+
|
109
|
+
=== Configuration
|
110
|
+
|
111
|
+
This gem can be configured via a global configuration:
|
112
|
+
|
113
|
+
....
|
114
|
+
$HOME/.config/rubysmith/configuration.yml
|
115
|
+
....
|
116
|
+
|
117
|
+
It can also be configured via link:https://www.alchemists.io/projects/xdg[XDG] environment
|
118
|
+
variables.
|
119
|
+
|
120
|
+
The default configuration is as follows:
|
121
|
+
|
122
|
+
[source,yaml]
|
123
|
+
----
|
124
|
+
:author:
|
125
|
+
:name:
|
126
|
+
:email:
|
127
|
+
:url:
|
128
|
+
:documentation:
|
129
|
+
:format: "md"
|
130
|
+
:license: "mit"
|
131
|
+
:build:
|
132
|
+
:bundler_audit: true
|
133
|
+
:console: true
|
134
|
+
:documentation: true
|
135
|
+
:git: true
|
136
|
+
:git_lint: true
|
137
|
+
:guard: true
|
138
|
+
:pry: true
|
139
|
+
:reek: true
|
140
|
+
:rspec: true
|
141
|
+
:rubocop: true
|
142
|
+
:setup: true
|
143
|
+
:simple_cov: true
|
144
|
+
:builders:
|
145
|
+
:pragmater:
|
146
|
+
:comments:
|
147
|
+
- "# frozen_string_literal: true"
|
148
|
+
:includes:
|
149
|
+
- "**/*.rb"
|
150
|
+
- "**/*bin/console"
|
151
|
+
- "**/*bin/guard"
|
152
|
+
- "**/*bin/rubocop"
|
153
|
+
- "**/*Gemfile"
|
154
|
+
- "**/*Guardfile"
|
155
|
+
- "**/*Rakefile"
|
156
|
+
----
|
157
|
+
|
158
|
+
Feel free to take this default configuration, modify, and save as your own custom
|
159
|
+
`configuration.yml`.
|
160
|
+
|
161
|
+
=== Console
|
162
|
+
|
163
|
+
To use the IRB console to invesitage and/or experiment with all project objects, run:
|
164
|
+
|
165
|
+
[source,bash]
|
166
|
+
----
|
167
|
+
bin/console
|
168
|
+
----
|
169
|
+
|
170
|
+
== Tests
|
171
|
+
|
172
|
+
To test, run:
|
173
|
+
|
174
|
+
[source,bash]
|
175
|
+
----
|
176
|
+
bundle exec rake
|
177
|
+
----
|
178
|
+
|
179
|
+
== Versioning
|
180
|
+
|
181
|
+
Read link:https://semver.org[Semantic Versioning] for details. Briefly, it means:
|
182
|
+
|
183
|
+
* Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
184
|
+
* Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
185
|
+
* Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
186
|
+
|
187
|
+
== Code of Conduct
|
188
|
+
|
189
|
+
Please note that this project is released with a link:CODE_OF_CONDUCT.adoc[CODE OF CONDUCT]. By
|
190
|
+
participating in this project you agree to abide by its terms.
|
191
|
+
|
192
|
+
== Contributions
|
193
|
+
|
194
|
+
Read link:CONTRIBUTING.adoc[CONTRIBUTING] for details.
|
195
|
+
|
196
|
+
== License
|
197
|
+
|
198
|
+
Read link:LICENSE.adoc[LICENSE] for details.
|
199
|
+
|
200
|
+
== History
|
201
|
+
|
202
|
+
Read link:CHANGES.adoc[CHANGES] for details.
|
203
|
+
Built with link:https://www.alchemists.io/projects/gemsmith[Gemsmith].
|
204
|
+
|
205
|
+
== Credits
|
206
|
+
|
207
|
+
Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
|
data/bin/rubysmith
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# TODO: Remove once the Pattern Matching feature is fully supported.
|
5
|
+
Warning[:experimental] = false
|
6
|
+
|
7
|
+
require "rubysmith"
|
8
|
+
require "rubysmith/cli/shell"
|
9
|
+
|
10
|
+
Process.setproctitle Rubysmith::Identity::VERSION_LABEL
|
11
|
+
Rubysmith::CLI::Shell.new.call ARGV
|
data/lib/rubysmith.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubysmith/identity"
|
4
|
+
require "rubysmith/pathway"
|
5
|
+
require "rubysmith/realm"
|
6
|
+
require "rubysmith/renderers/namespace"
|
7
|
+
require "rubysmith/renderers/erb"
|
8
|
+
require "rubysmith/text/inserter"
|
9
|
+
require "rubysmith/builder"
|
10
|
+
require "rubysmith/builders/core"
|
11
|
+
require "rubysmith/builders/documentation"
|
12
|
+
require "rubysmith/builders/git/setup"
|
13
|
+
require "rubysmith/builders/git/commit"
|
14
|
+
require "rubysmith/builders/bundler"
|
15
|
+
require "rubysmith/builders/rake"
|
16
|
+
require "rubysmith/builders/console"
|
17
|
+
require "rubysmith/builders/setup"
|
18
|
+
require "rubysmith/builders/guard"
|
19
|
+
require "rubysmith/builders/reek"
|
20
|
+
require "rubysmith/builders/rspec/context"
|
21
|
+
require "rubysmith/builders/rspec/helper"
|
22
|
+
require "rubysmith/builders/pragma"
|
23
|
+
require "rubysmith/builders/rubocop"
|
24
|
+
require "rubysmith/cli/parsers/core"
|
25
|
+
require "rubysmith/cli/parsers/build"
|
26
|
+
require "rubysmith/cli/parsers/assembler"
|
27
|
+
require "rubysmith/cli/processors/config"
|
28
|
+
require "rubysmith/cli/processors/build"
|
29
|
+
require "rubysmith/cli/configuration"
|
30
|
+
require "rubysmith/cli/shell"
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "refinements/pathnames"
|
4
|
+
require "open3"
|
5
|
+
require "logger"
|
6
|
+
|
7
|
+
module Rubysmith
|
8
|
+
# :reek:TooManyMethods
|
9
|
+
# rubocop:disable Metrics/ClassLength
|
10
|
+
class Builder
|
11
|
+
using Refinements::Pathnames
|
12
|
+
|
13
|
+
LOGGER = Logger.new(
|
14
|
+
STDOUT,
|
15
|
+
formatter: ->(severity, _at, _program, message) { "#{severity} #{message}\n" }
|
16
|
+
)
|
17
|
+
|
18
|
+
HELPERS = {
|
19
|
+
inserter: Text::Inserter,
|
20
|
+
renderer: Renderers::ERB,
|
21
|
+
kernel: Open3,
|
22
|
+
logger: LOGGER
|
23
|
+
}.freeze
|
24
|
+
|
25
|
+
def self.call realm, helpers: HELPERS
|
26
|
+
new realm, helpers: helpers
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize realm, helpers: HELPERS
|
30
|
+
@realm = realm
|
31
|
+
@helpers = helpers
|
32
|
+
end
|
33
|
+
|
34
|
+
def append content
|
35
|
+
logger.info "Appending: #{relative_build_path}"
|
36
|
+
build_path.rewrite { |body| body + content }
|
37
|
+
self
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete
|
41
|
+
logger.info "Deleting: #{relative_build_path}"
|
42
|
+
build_path.delete
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
def insert_before pattern, content
|
47
|
+
logger.info "Inserting content before pattern in: #{relative_build_path}"
|
48
|
+
build_path.write inserter.new(build_path.readlines, :before).call(content, pattern).join
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
def insert_after pattern, content
|
53
|
+
logger.info "Inserting content after pattern in: #{relative_build_path}"
|
54
|
+
build_path.write inserter.new(build_path.readlines, :after).call(content, pattern).join
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def permit mode
|
59
|
+
logger.info "Changing permissions for: #{relative_build_path}"
|
60
|
+
build_path.chmod mode
|
61
|
+
self
|
62
|
+
end
|
63
|
+
|
64
|
+
def prepend content
|
65
|
+
logger.info "Prepending content to: #{relative_build_path}"
|
66
|
+
build_path.rewrite { |body| content + body }
|
67
|
+
self
|
68
|
+
end
|
69
|
+
|
70
|
+
def rename name
|
71
|
+
logger.info "Renaming: #{build_path.basename} to #{name}"
|
72
|
+
build_path.rename build_path.parent.join(name)
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
76
|
+
def render
|
77
|
+
logger.info "Rendering: #{relative_build_path}"
|
78
|
+
|
79
|
+
pathway.start_path.read.then do |content|
|
80
|
+
build_path.make_ancestors.write renderer.call(content)
|
81
|
+
end
|
82
|
+
|
83
|
+
self
|
84
|
+
end
|
85
|
+
|
86
|
+
def replace pattern, content
|
87
|
+
logger.info "Replacing content for patterns in: #{relative_build_path}"
|
88
|
+
build_path.rewrite { |body| body.gsub pattern, content }
|
89
|
+
self
|
90
|
+
end
|
91
|
+
|
92
|
+
def run *command
|
93
|
+
logger.info "Running: #{command}"
|
94
|
+
execute(*command)
|
95
|
+
self
|
96
|
+
rescue StandardError => error
|
97
|
+
logger.error error and self
|
98
|
+
end
|
99
|
+
|
100
|
+
def touch
|
101
|
+
logger.info "Touching: #{relative_build_path}"
|
102
|
+
build_path.make_ancestors.touch
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
attr_reader :realm, :helpers
|
109
|
+
|
110
|
+
def execute *command
|
111
|
+
kernel.capture2e(*command).then do |result, status|
|
112
|
+
logger.error result unless status.success?
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def inserter
|
117
|
+
helpers.fetch __method__
|
118
|
+
end
|
119
|
+
|
120
|
+
def renderer
|
121
|
+
helpers.fetch(__method__).new realm
|
122
|
+
end
|
123
|
+
|
124
|
+
def kernel
|
125
|
+
helpers.fetch __method__
|
126
|
+
end
|
127
|
+
|
128
|
+
def logger
|
129
|
+
helpers.fetch __method__
|
130
|
+
end
|
131
|
+
|
132
|
+
def relative_build_path
|
133
|
+
build_path.relative_path_from realm.build_root
|
134
|
+
end
|
135
|
+
|
136
|
+
def build_path
|
137
|
+
pathway.end_path.gsub("%project_name%", realm.project_name).sub(".erb", "")
|
138
|
+
end
|
139
|
+
|
140
|
+
def pathway
|
141
|
+
realm.to_pathway
|
142
|
+
end
|
143
|
+
end
|
144
|
+
# rubocop:enable Metrics/ClassLength
|
145
|
+
end
|