app_archetype 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.doxie.json +25 -0
- data/.github/workflows/build.yml +25 -0
- data/.gitignore +22 -0
- data/.rubocop.yml +35 -0
- data/.ruby-version +1 -0
- data/CONTRIBUTING.md +51 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +172 -0
- data/LICENSE +21 -0
- data/README.md +138 -0
- data/Rakefile +19 -0
- data/app_archetype.gemspec +39 -0
- data/bin/archetype +20 -0
- data/lib/app_archetype.rb +14 -0
- data/lib/app_archetype/cli.rb +204 -0
- data/lib/app_archetype/cli/presenters.rb +106 -0
- data/lib/app_archetype/cli/prompts.rb +152 -0
- data/lib/app_archetype/generators.rb +95 -0
- data/lib/app_archetype/logger.rb +69 -0
- data/lib/app_archetype/renderer.rb +116 -0
- data/lib/app_archetype/template.rb +12 -0
- data/lib/app_archetype/template/helpers.rb +216 -0
- data/lib/app_archetype/template/manifest.rb +193 -0
- data/lib/app_archetype/template/plan.rb +172 -0
- data/lib/app_archetype/template/source.rb +39 -0
- data/lib/app_archetype/template/variable.rb +237 -0
- data/lib/app_archetype/template/variable_manager.rb +75 -0
- data/lib/app_archetype/template_manager.rb +113 -0
- data/lib/app_archetype/version.rb +6 -0
- data/lib/core_ext/string.rb +67 -0
- data/spec/app_archetype/cli/presenters_spec.rb +99 -0
- data/spec/app_archetype/cli/prompts_spec.rb +292 -0
- data/spec/app_archetype/cli_spec.rb +132 -0
- data/spec/app_archetype/generators_spec.rb +119 -0
- data/spec/app_archetype/logger_spec.rb +86 -0
- data/spec/app_archetype/renderer_spec.rb +291 -0
- data/spec/app_archetype/template/helpers_spec.rb +251 -0
- data/spec/app_archetype/template/manifest_spec.rb +245 -0
- data/spec/app_archetype/template/plan_spec.rb +191 -0
- data/spec/app_archetype/template/source_spec.rb +60 -0
- data/spec/app_archetype/template/variable_manager_spec.rb +103 -0
- data/spec/app_archetype/template/variable_spec.rb +245 -0
- data/spec/app_archetype/template_manager_spec.rb +221 -0
- data/spec/core_ext/string_spec.rb +143 -0
- data/spec/spec_helper.rb +29 -0
- metadata +370 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2a10af9366de2e0735df447d87d1cbe3660601702b038fffff206a7489687c70
|
4
|
+
data.tar.gz: 4708824cee9cb49c3731038b1f13dc88b61ecb732a1de7fe45d1a483a0e66120
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0bd5e63c6bdcdf49aa85266c2b63d09d5994113d192349051740829b3ce47d3727f7ee9455459aca5dec39b240d3d734df0c247dc8a8dfd4d6e3c0149d8cca07
|
7
|
+
data.tar.gz: a80ecdeaeb2e2ca8e2e91e6dbfbaaf78762cdd6eb8b3b3e94961696c3e3722f06170185b2404807a694db22e7be9e0737a44b886039b05a74077f307cf808612
|
data/.doxie.json
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"uploads": {
|
3
|
+
"yardoc": {
|
4
|
+
"source": "doc",
|
5
|
+
"target": {
|
6
|
+
"bucket": "docs-biggerconcept-com",
|
7
|
+
"key": "bitbucket.org/biggerconcept/app_archetype/doc"
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"coverage": {
|
11
|
+
"source": "target/reports/coverage",
|
12
|
+
"target": {
|
13
|
+
"bucket": "docs-biggerconcept-com",
|
14
|
+
"key": "bitbucket.org/biggerconcept/app_archetype/coverage"
|
15
|
+
}
|
16
|
+
},
|
17
|
+
"critique": {
|
18
|
+
"source": "target/reports/critique",
|
19
|
+
"target": {
|
20
|
+
"bucket": "docs-biggerconcept-com",
|
21
|
+
"key": "bitbucket.org/biggerconcept/app_archetype/critique"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: ['2.6', '2.7']
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Run tests
|
25
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/pkg/
|
6
|
+
/spec/reports/
|
7
|
+
/tmp/
|
8
|
+
|
9
|
+
# rspec failure tracking
|
10
|
+
.rspec_status
|
11
|
+
|
12
|
+
# byebug history
|
13
|
+
.byebug_history
|
14
|
+
|
15
|
+
*.gem
|
16
|
+
target/reports
|
17
|
+
|
18
|
+
.DS_Store
|
19
|
+
|
20
|
+
/doc/
|
21
|
+
|
22
|
+
vendor/cache
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
TargetRubyVersion: 2.4
|
4
|
+
|
5
|
+
Style/FrozenStringLiteralComment:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Style/SpecialGlobalVars:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/MissingRespondToMissing:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Metrics/ClassLength:
|
15
|
+
Max: 200
|
16
|
+
|
17
|
+
Metrics/MethodLength:
|
18
|
+
Max: 20
|
19
|
+
|
20
|
+
Metrics/AbcSize:
|
21
|
+
Max: 20
|
22
|
+
|
23
|
+
Lint/AssignmentInCondition:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Metrics/BlockLength:
|
27
|
+
Exclude:
|
28
|
+
- 'app_archetype.gemspec'
|
29
|
+
- 'spec/**/*'
|
30
|
+
|
31
|
+
Gemspec/RequiredRubyVersion:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/IfUnlessModifier:
|
35
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.4
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
When contributing to App Archetype, please take note of the following requests.
|
4
|
+
|
5
|
+
## Pull Request Process
|
6
|
+
|
7
|
+
1. Before raising a pull request, please first discuss the change by raising an issue.
|
8
|
+
2. Ensure any changes that change the behaviour or would be useful to implementers of this gem are documented within the README.md
|
9
|
+
3. Increase the version number in any PR raised. The versioning scheme we use is [SemVer](https://semver.org/)
|
10
|
+
|
11
|
+
## Code of Conduct
|
12
|
+
|
13
|
+
### Our Pledge
|
14
|
+
|
15
|
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
16
|
+
|
17
|
+
### Our Standards
|
18
|
+
|
19
|
+
Examples of behavior that contributes to creating a positive environment include:
|
20
|
+
|
21
|
+
- Using welcoming and inclusive language
|
22
|
+
- Being respectful of differing viewpoints and experiences
|
23
|
+
- Gracefully accepting constructive criticism
|
24
|
+
- Focusing on what is best for the community
|
25
|
+
- Showing empathy towards other community members
|
26
|
+
|
27
|
+
Examples of unacceptable behavior by participants include:
|
28
|
+
|
29
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
30
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
31
|
+
- Public or private harassment
|
32
|
+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
33
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
34
|
+
|
35
|
+
### Our Responsibilities
|
36
|
+
|
37
|
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
38
|
+
|
39
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
40
|
+
|
41
|
+
### Scope
|
42
|
+
|
43
|
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
44
|
+
|
45
|
+
### Enforcement
|
46
|
+
|
47
|
+
Instances of abusive, harassing or otherwise unacceptable behaviour may be reported by contacting the project team. The project team will decide how to respond to any compliants.
|
48
|
+
|
49
|
+
### Attribution
|
50
|
+
|
51
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org/version/1/4), version 1.4, available at http://contributor-covenant.org/version/1/4
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
app_archetype (1.2.3)
|
5
|
+
cli-format (~> 0.2)
|
6
|
+
highline (~> 2.0)
|
7
|
+
json (~> 2.3)
|
8
|
+
json-schema (~> 2.8)
|
9
|
+
jsonnet (~> 0.3.0)
|
10
|
+
logger (~> 1.4.2)
|
11
|
+
os (~> 1.1)
|
12
|
+
ostruct (~> 0.3)
|
13
|
+
ruby-handlebars (~> 0.4)
|
14
|
+
thor (~> 1.0)
|
15
|
+
|
16
|
+
GEM
|
17
|
+
remote: https://rubygems.org/
|
18
|
+
specs:
|
19
|
+
activesupport (6.1.3.2)
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
+
i18n (>= 1.6, < 2)
|
22
|
+
minitest (>= 5.1)
|
23
|
+
tzinfo (~> 2.0)
|
24
|
+
zeitwerk (~> 2.3)
|
25
|
+
addressable (2.7.0)
|
26
|
+
public_suffix (>= 2.0.2, < 5.0)
|
27
|
+
ast (2.4.1)
|
28
|
+
axiom-types (0.1.1)
|
29
|
+
descendants_tracker (~> 0.0.4)
|
30
|
+
ice_nine (~> 0.11.0)
|
31
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
32
|
+
bump (0.9.0)
|
33
|
+
cli-format (0.2.0)
|
34
|
+
activesupport
|
35
|
+
text-table
|
36
|
+
zeitwerk
|
37
|
+
coderay (1.1.3)
|
38
|
+
coercible (1.0.0)
|
39
|
+
descendants_tracker (~> 0.0.1)
|
40
|
+
concurrent-ruby (1.1.9)
|
41
|
+
descendants_tracker (0.0.4)
|
42
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
43
|
+
diff-lcs (1.4.4)
|
44
|
+
docile (1.3.2)
|
45
|
+
equalizer (0.0.11)
|
46
|
+
erubis (2.7.0)
|
47
|
+
flay (2.12.1)
|
48
|
+
erubis (~> 2.7.0)
|
49
|
+
path_expander (~> 1.0)
|
50
|
+
ruby_parser (~> 3.0)
|
51
|
+
sexp_processor (~> 4.0)
|
52
|
+
flog (4.6.4)
|
53
|
+
path_expander (~> 1.0)
|
54
|
+
ruby_parser (~> 3.1, > 3.1.0)
|
55
|
+
sexp_processor (~> 4.8)
|
56
|
+
highline (2.0.3)
|
57
|
+
i18n (1.8.10)
|
58
|
+
concurrent-ruby (~> 1.0)
|
59
|
+
ice_nine (0.11.2)
|
60
|
+
json (2.5.1)
|
61
|
+
json-schema (2.8.1)
|
62
|
+
addressable (>= 2.4)
|
63
|
+
jsonnet (0.3.0)
|
64
|
+
mini_portile2 (>= 2.2.0)
|
65
|
+
kwalify (0.7.2)
|
66
|
+
launchy (2.5.0)
|
67
|
+
addressable (~> 2.7)
|
68
|
+
logger (1.4.3)
|
69
|
+
method_source (1.0.0)
|
70
|
+
mini_portile2 (2.6.1)
|
71
|
+
minitest (5.14.4)
|
72
|
+
os (1.1.1)
|
73
|
+
ostruct (0.3.3)
|
74
|
+
parallel (1.19.2)
|
75
|
+
parser (2.7.1.5)
|
76
|
+
ast (~> 2.4.1)
|
77
|
+
parslet (1.8.2)
|
78
|
+
path_expander (1.1.0)
|
79
|
+
private_gem (1.1.4)
|
80
|
+
bundler (> 1.7, < 3.0)
|
81
|
+
thor
|
82
|
+
pry (0.13.1)
|
83
|
+
coderay (~> 1.1)
|
84
|
+
method_source (~> 1.0)
|
85
|
+
psych (3.1.0)
|
86
|
+
public_suffix (4.0.6)
|
87
|
+
rainbow (3.0.0)
|
88
|
+
rake (13.0.1)
|
89
|
+
reek (6.0.1)
|
90
|
+
kwalify (~> 0.7.0)
|
91
|
+
parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
|
92
|
+
psych (~> 3.1.0)
|
93
|
+
rainbow (>= 2.0, < 4.0)
|
94
|
+
regexp_parser (1.8.1)
|
95
|
+
rexml (3.2.4)
|
96
|
+
rspec (3.9.0)
|
97
|
+
rspec-core (~> 3.9.0)
|
98
|
+
rspec-expectations (~> 3.9.0)
|
99
|
+
rspec-mocks (~> 3.9.0)
|
100
|
+
rspec-core (3.9.3)
|
101
|
+
rspec-support (~> 3.9.3)
|
102
|
+
rspec-expectations (3.9.2)
|
103
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
104
|
+
rspec-support (~> 3.9.0)
|
105
|
+
rspec-mocks (3.9.1)
|
106
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
107
|
+
rspec-support (~> 3.9.0)
|
108
|
+
rspec-support (3.9.3)
|
109
|
+
rubocop (0.92.0)
|
110
|
+
parallel (~> 1.10)
|
111
|
+
parser (>= 2.7.1.5)
|
112
|
+
rainbow (>= 2.2.2, < 4.0)
|
113
|
+
regexp_parser (>= 1.7)
|
114
|
+
rexml
|
115
|
+
rubocop-ast (>= 0.5.0)
|
116
|
+
ruby-progressbar (~> 1.7)
|
117
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
118
|
+
rubocop-ast (0.7.1)
|
119
|
+
parser (>= 2.7.1.5)
|
120
|
+
ruby-handlebars (0.4.0)
|
121
|
+
parslet (~> 1.6, >= 1.6.2)
|
122
|
+
ruby-progressbar (1.10.1)
|
123
|
+
ruby_parser (3.15.0)
|
124
|
+
sexp_processor (~> 4.9)
|
125
|
+
rubycritic (4.5.2)
|
126
|
+
flay (~> 2.8)
|
127
|
+
flog (~> 4.4)
|
128
|
+
launchy (>= 2.0.0)
|
129
|
+
parser (>= 2.6.0)
|
130
|
+
rainbow (~> 3.0)
|
131
|
+
reek (~> 6.0, < 7.0)
|
132
|
+
ruby_parser (~> 3.8)
|
133
|
+
simplecov (>= 0.17.0)
|
134
|
+
tty-which (~> 0.4.0)
|
135
|
+
virtus (~> 1.0)
|
136
|
+
sexp_processor (4.15.1)
|
137
|
+
simplecov (0.19.0)
|
138
|
+
docile (~> 1.1)
|
139
|
+
simplecov-html (~> 0.11)
|
140
|
+
simplecov-html (0.12.3)
|
141
|
+
text-table (1.2.4)
|
142
|
+
thor (1.0.1)
|
143
|
+
thread_safe (0.3.6)
|
144
|
+
tty-which (0.4.2)
|
145
|
+
tzinfo (2.0.4)
|
146
|
+
concurrent-ruby (~> 1.0)
|
147
|
+
unicode-display_width (1.7.0)
|
148
|
+
virtus (1.0.5)
|
149
|
+
axiom-types (~> 0.1)
|
150
|
+
coercible (~> 1.0)
|
151
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
152
|
+
equalizer (~> 0.0, >= 0.0.9)
|
153
|
+
yard (0.9.25)
|
154
|
+
zeitwerk (2.4.2)
|
155
|
+
|
156
|
+
PLATFORMS
|
157
|
+
ruby
|
158
|
+
|
159
|
+
DEPENDENCIES
|
160
|
+
app_archetype!
|
161
|
+
bump (~> 0.9)
|
162
|
+
private_gem (~> 1.1)
|
163
|
+
pry (~> 0.13)
|
164
|
+
rake (~> 13.0)
|
165
|
+
rspec (~> 3.9)
|
166
|
+
rubocop (~> 0.92)
|
167
|
+
rubycritic (~> 4.5)
|
168
|
+
simplecov (~> 0.19)
|
169
|
+
yard (~> 0.9)
|
170
|
+
|
171
|
+
BUNDLED WITH
|
172
|
+
2.2.15
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Andrew Bigger
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# App Archetype
|
2
|
+
|
3
|
+
[![Ruby](https://github.com/andrewbigger/app_archetype/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/andrewbigger/app_archetype/actions/workflows/build.yml)
|
4
|
+
|
5
|
+
Code project template renderer
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add the following to your Gemfile
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'app_archetype'
|
13
|
+
```
|
14
|
+
|
15
|
+
Or install the gem into your system:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
gem install app_archetype
|
19
|
+
```
|
20
|
+
|
21
|
+
If installed as a system gem, you'll need to create a template directory and set it in your environment:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
mkdir $HOME/Code/templates
|
25
|
+
|
26
|
+
# zshrc
|
27
|
+
echo '# App Archetype:' >> $HOME/.zshrc
|
28
|
+
echo 'export ARCHETYPE_TEMPLATE_DIR="$HOME/Code/templates"' >> $HOME/.zshrc
|
29
|
+
|
30
|
+
# bash
|
31
|
+
echo '# App Archetype:' >> $HOME/.bashrc
|
32
|
+
echo 'export ARCHETYPE_TEMPLATE_DIR="$HOME/Code/templates"' >> $HOME/.bashrc
|
33
|
+
```
|
34
|
+
|
35
|
+
Finally you'll need to set a editor environment variable for viewing files from app archetype:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# zshrc
|
39
|
+
echo 'export ARCHETYPE_EDITOR="vi"' >> $HOME/.zshrc # sets vim as default editor
|
40
|
+
|
41
|
+
# bash
|
42
|
+
echo 'export ARCHETYPE_EDITOR="vi"' >> $HOME/.bashrc # sets vim as default editor
|
43
|
+
```
|
44
|
+
|
45
|
+
## Usage
|
46
|
+
|
47
|
+
### Creating a template
|
48
|
+
|
49
|
+
Templates are a collection of files in the template folder with a manifest. The structure is thus:
|
50
|
+
|
51
|
+
```text
|
52
|
+
- $ARCHETYPE_TEMPLATE_DIR
|
53
|
+
| - my_template
|
54
|
+
| - | - template/
|
55
|
+
| - | - | - file.erb
|
56
|
+
| - | - | - file2.txt
|
57
|
+
| - | - manifest.json
|
58
|
+
```
|
59
|
+
|
60
|
+
Each template must include a manifest which has instructions necessary to render the template at run time.
|
61
|
+
|
62
|
+
To create a blank template run the new command with the relative (from your template directory) path to your new template. For example to create a ruby gem you might:
|
63
|
+
|
64
|
+
```bash
|
65
|
+
archetype new ruby/gem # creates a template at $ARCHETYPE_TEMPLATE_DIR/ruby/gem
|
66
|
+
|
67
|
+
# or
|
68
|
+
|
69
|
+
archetype new ruby_gem # creates a template at $ARCHETYPE_TEMPLATE_DIR/ruby_gem
|
70
|
+
|
71
|
+
# or
|
72
|
+
|
73
|
+
archetype new ruby/gem/on_rails # creates a template at $ARCHETYPE_TEMPLATE_DIR/ruby/gem/on_rails
|
74
|
+
|
75
|
+
# etc.
|
76
|
+
```
|
77
|
+
|
78
|
+
#### Template Manifests
|
79
|
+
|
80
|
+
A manifest has a name, version and set of variables. A sample manifest looks like this:
|
81
|
+
|
82
|
+
```json
|
83
|
+
{
|
84
|
+
"name": "my_template",
|
85
|
+
"version": "0.1.1",
|
86
|
+
"metadata": {
|
87
|
+
"app_archetype": {
|
88
|
+
"version": "0.1.2"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"variables": {
|
92
|
+
"foo": "bar",
|
93
|
+
}
|
94
|
+
}
|
95
|
+
```
|
96
|
+
|
97
|
+
- `name` should be a unique name that identifies a manifest for you
|
98
|
+
- `version` should be the version of the template
|
99
|
+
- `metadata.app_archetype` is information about the manifest for the app archetype gem. `metadata.app_archetype.version` is required, and must be less than the version of the currently installed gem.
|
100
|
+
- `variables` is a schemaless object that you may use to provide variables at render time
|
101
|
+
|
102
|
+
##### Jsonnet support
|
103
|
+
|
104
|
+
If plain ol' JSON isn't quite enough for you - manifests can also be expressed in jsonnet language. This permits you to use functions and objects to generate your template manifest. All manifest.json/manifest.jsonnet files will be parsed as you might expect.
|
105
|
+
|
106
|
+
See [https://jsonnet.org/](https://jsonnet.org/) for more jsonnet documentation
|
107
|
+
|
108
|
+
#### Template Files
|
109
|
+
|
110
|
+
Templates are a collection of files within a folder. You may put any files you want in side the `/template` directory and when it comes time to use the template.
|
111
|
+
|
112
|
+
ERB templates or handlebar templates will be rendered using the variables specified in the manifest.json. Anything that's not ERB or HBS will be copied across to the destination as is.
|
113
|
+
|
114
|
+
You can include handlebars in file names, and like template files, the variables will be used to render the filenames.
|
115
|
+
|
116
|
+
### Rendering a Template
|
117
|
+
|
118
|
+
Adjust the template manifest to include the variables you want, and then run:
|
119
|
+
|
120
|
+
```bash
|
121
|
+
mkdir where_id_like_to_render
|
122
|
+
cd where_id_like_to_render
|
123
|
+
archetype render my_template
|
124
|
+
```
|
125
|
+
|
126
|
+
And the template will be rendered with the instructions in the manifest to the destinaton location as simple as that.
|
127
|
+
|
128
|
+
### Listing Templates
|
129
|
+
|
130
|
+
You can list the templates in your template directory at any time by running the list command:
|
131
|
+
|
132
|
+
```bash
|
133
|
+
archetype list
|
134
|
+
```
|
135
|
+
|
136
|
+
## Licence
|
137
|
+
|
138
|
+
This gem is covered by the terms of the MIT licence. See LICENCE for more information
|