planter-cli 0.0.3 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.rubocop.yml +5 -7
- data/CHANGELOG.md +21 -0
- data/README.md +28 -1
- data/Rakefile +54 -18
- data/bin/plant +6 -0
- data/docker/Dockerfile-2.6 +5 -5
- data/docker/Dockerfile-2.7 +3 -3
- data/docker/Dockerfile-3.0 +3 -3
- data/lib/planter/array.rb +51 -0
- data/lib/planter/color.rb +1 -1
- data/lib/planter/errors.rb +14 -0
- data/lib/planter/file.rb +87 -4
- data/lib/planter/fileentry.rb +5 -1
- data/lib/planter/filelist.rb +43 -7
- data/lib/planter/hash.rb +81 -84
- data/lib/planter/plant.rb +4 -10
- data/lib/planter/prompt.rb +6 -3
- data/lib/planter/script.rb +24 -12
- data/lib/planter/string.rb +134 -29
- data/lib/planter/tag.rb +54 -0
- data/lib/planter/version.rb +1 -1
- data/lib/planter.rb +60 -34
- data/planter-cli.gemspec +1 -0
- data/spec/config.yml +2 -0
- data/spec/planter/array_spec.rb +28 -0
- data/spec/planter/file_entry_spec.rb +40 -0
- data/spec/planter/file_spec.rb +19 -0
- data/spec/planter/filelist_spec.rb +15 -0
- data/spec/planter/hash_spec.rb +110 -0
- data/spec/planter/plant_spec.rb +1 -0
- data/spec/planter/script_spec.rb +80 -0
- data/spec/planter/string_spec.rb +215 -2
- data/spec/planter/symbol_spec.rb +23 -0
- data/spec/planter.yml +6 -0
- data/spec/planter_spec.rb +82 -0
- data/spec/scripts/test.sh +3 -0
- data/spec/scripts/test_fail.sh +3 -0
- data/spec/spec_helper.rb +8 -2
- data/spec/templates/test/%%project:snake%%.rtf +10 -0
- data/spec/templates/test/Rakefile +6 -0
- data/spec/templates/test/_planter.yml +12 -0
- data/spec/templates/test/_scripts/test.sh +3 -0
- data/spec/templates/test/_scripts/test_fail.sh +3 -0
- data/spec/templates/test/test.rb +5 -0
- data/spec/test_out/image.png +0 -0
- data/spec/test_out/test2.rb +5 -0
- data/src/_README.md +28 -1
- metadata +57 -2
data/spec/planter/string_spec.rb
CHANGED
@@ -9,12 +9,225 @@ describe ::String do
|
|
9
9
|
|
10
10
|
describe '.to_slug' do
|
11
11
|
it 'slugifies a string' do
|
12
|
-
expect('This is a test string'.to_slug).to match
|
12
|
+
expect('This is a test string'.to_slug).to match(/this-is-a-test-string/)
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'slugifies bad characters' do
|
16
|
-
expect('This: #is a test string!'.to_slug).to match
|
16
|
+
expect('This: #is a test string!'.to_slug).to match(/this-colon-hash-is-a-test-string-bang/)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
describe '.to_class_name' do
|
21
|
+
it 'converts string to CamelCase' do
|
22
|
+
expect('this is a test string'.to_class_name).to eq 'ThisIsATestString'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'handles special characters' do
|
26
|
+
expect('this: #is a test string!'.to_class_name).to eq 'ThisIsATestString'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '.snake_case' do
|
31
|
+
it 'converts CamelCase to snake_case' do
|
32
|
+
expect('ThisIsATestString'.snake_case).to eq 'this_is_a_test_string'
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'handles strings with spaces' do
|
36
|
+
expect('This is a test string'.snake_case).to eq 'this_is_a_test_string'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'handles strings with special characters' do
|
40
|
+
expect('This: #is a test string!'.snake_case).to eq 'this_is_a_test_string'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '.camel_case' do
|
45
|
+
it 'converts snake_case to CamelCase' do
|
46
|
+
expect('this_is_a_test_string'.camel_case).to eq 'thisIsATestString'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'handles strings with spaces' do
|
50
|
+
expect('this is a test string'.camel_case).to eq 'thisIsATestString'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'handles strings with special characters' do
|
54
|
+
expect('this: #is a test string!'.camel_case).to eq 'thisIsATestString'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe '.title_case' do
|
59
|
+
it 'converts a string to Title Case' do
|
60
|
+
expect('this is a test string'.title_case).to eq 'This Is A Test String'
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'handles strings with special characters' do
|
64
|
+
expect('this: #is a test string!'.title_case).to eq 'This: #Is A Test String!'
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'handles mixed case strings' do
|
68
|
+
expect('ThIs Is A TeSt StRiNg'.title_case).to eq 'This Is A Test String'
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '.apply_variables' do
|
73
|
+
it 'replaces placeholders with variable values' do
|
74
|
+
template = 'Hello, %%name%%!'
|
75
|
+
variables = { name: 'World' }
|
76
|
+
expect(template.apply_variables(variables: variables)).to eq 'Hello, World!'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'handles multiple variables' do
|
80
|
+
template = 'Hello, %%first_name%% %%last_name%%!'
|
81
|
+
variables = { first_name: 'John', last_name: 'Doe' }
|
82
|
+
expect(template.apply_variables(variables: variables)).to eq 'Hello, John Doe!'
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'handles missing variables gracefully' do
|
86
|
+
template = 'Hello, %%name%%!'
|
87
|
+
variables = {}
|
88
|
+
expect(template.apply_variables(variables: variables)).to eq 'Hello, %%name%%!'
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'handles variables with special characters' do
|
92
|
+
template = 'Hello, %%name%%!'
|
93
|
+
variables = { name: 'John #Doe' }
|
94
|
+
expect(template.apply_variables(variables: variables)).to eq 'Hello, John #Doe!'
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'handles modifiers' do
|
98
|
+
template = 'Hello, %%title:upper%% %%name:title%%!'
|
99
|
+
variables = { title: 'Mr.', name: 'john do' }
|
100
|
+
expect(template.apply_variables(variables: variables)).to eq 'Hello, MR. John Do!'
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'operates in place' do
|
104
|
+
template = 'Hello, %%title:upper%% %%name:title%%!'
|
105
|
+
variables = { title: 'Mr.', name: 'john do' }
|
106
|
+
template.apply_variables!(variables: variables)
|
107
|
+
expect(template).to eq 'Hello, MR. John Do!'
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'handles last_only' do
|
111
|
+
template = 'Hello, %%title%% %%title:upper%%!'
|
112
|
+
variables = { title: 'project title' }
|
113
|
+
expect(template.apply_variables(variables: variables, last_only: true)).to eq 'Hello, %%title%% PROJECT TITLE!'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe '.apply_regexes' do
|
118
|
+
it 'applies a single regex replacement' do
|
119
|
+
template = 'Hello, World!'
|
120
|
+
regexes = { /World/ => 'Universe' }
|
121
|
+
expect(template.apply_regexes(regexes)).to eq 'Hello, Universe!'
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'applies multiple regex replacements' do
|
125
|
+
template = 'Hello, World! Welcome to the World!'
|
126
|
+
regexes = { /World/ => 'Universe', /Welcome/ => 'Greetings' }
|
127
|
+
expect(template.apply_regexes(regexes)).to eq 'Hello, Universe! Greetings to the Universe!'
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'handles no regex replacements' do
|
131
|
+
template = 'Hello, World!'
|
132
|
+
regexes = {}
|
133
|
+
expect(template.apply_regexes(regexes)).to eq 'Hello, World!'
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'handles special characters in regex' do
|
137
|
+
template = 'Hello, World! #Welcome to the World!'
|
138
|
+
regexes = { /#Welcome/ => 'Greetings' }
|
139
|
+
expect(template.apply_regexes(regexes)).to eq 'Hello, World! Greetings to the World!'
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'Operates in place' do
|
143
|
+
template = 'Hello, World! #Welcome to the World!'
|
144
|
+
regexes = { /#Welcome/ => 'Greetings' }
|
145
|
+
template.apply_regexes!(regexes)
|
146
|
+
expect(template).to eq 'Hello, World! Greetings to the World!'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
describe '.ext' do
|
151
|
+
it 'applies an extension' do
|
152
|
+
expect("filename.rb".ext('txt')).to eq 'filename.txt'
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'ignores an existing extension' do
|
156
|
+
expect("filename.rb".ext('rb')).to eq 'filename.rb'
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
describe '.normalize_type' do
|
161
|
+
it 'normalizes a date type' do
|
162
|
+
expect("da".normalize_type.to_s).to eq "date"
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'normalizes an integer type' do
|
166
|
+
expect("int".normalize_type.to_s).to eq "integer"
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'normalizes a float type' do
|
170
|
+
expect("f".normalize_type.to_s).to eq "float"
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'normalizes a multiline type' do
|
174
|
+
expect("multi".normalize_type.to_s).to eq "multiline"
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'normalizes a class type' do
|
178
|
+
expect("c".normalize_type.to_s).to eq "class"
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'normalizes a module type' do
|
182
|
+
expect("m".normalize_type.to_s).to eq "module"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe '.normalize_operator' do
|
187
|
+
it 'normalizes a copy operator' do
|
188
|
+
expect("copy".normalize_operator.to_s).to eq "copy"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe '.coerce' do
|
193
|
+
it 'coerces a date type' do
|
194
|
+
expect("now".coerce(:date)).to match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'coerces an integer type' do
|
198
|
+
expect("10".coerce(:integer)).to eq 10
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'coerces a float type' do
|
202
|
+
expect("10.0".coerce(:float)).to eq 10.0
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'coerces a multiline type' do
|
206
|
+
expect("multi\nline".coerce(:multiline)).to eq "multi\nline"
|
207
|
+
end
|
208
|
+
|
209
|
+
it 'coerces a class type' do
|
210
|
+
expect("Some class".coerce(:class)).to eq "SomeClass"
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
describe '.clean_encode!' do
|
215
|
+
it 'cleans an encoded string' do
|
216
|
+
s = "This is a test string"
|
217
|
+
s.clean_encode!
|
218
|
+
expect(s).to eq "This is a test string"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe '.highlight_character' do
|
223
|
+
it 'highlights characters' do
|
224
|
+
s = "(o)ption 1 (s)econd option"
|
225
|
+
expect(s.highlight_character).to eq "{dw}({xbw}o{dw}){xw}ption 1 {dw}({xbw}s{dw}){xw}econd option"
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'highlights characters with default option' do
|
229
|
+
s = "(o)ption 1 (s)econd option"
|
230
|
+
expect(s.highlight_character(default: 's')).to eq "{dw}({xbw}o{dw}){xw}ption 1 {dw}({xbc}s{dw}){xw}econd option"
|
231
|
+
end
|
232
|
+
end
|
20
233
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe ::Symbol do
|
6
|
+
describe '.to_var' do
|
7
|
+
it 'turns a symbol into a string with _ instead of :' do
|
8
|
+
expect(:var_name.to_var).to eq :var_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '.normalize_type' do
|
13
|
+
it 'normalizes a type symbol' do
|
14
|
+
expect(:string.normalize_type).to eq :string
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.normalize_operator' do
|
19
|
+
it 'normalizes an operator symbol' do
|
20
|
+
expect(:copy.normalize_operator).to eq :copy
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/planter.yml
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe "Planter" do
|
6
|
+
describe '.notify' do
|
7
|
+
it 'prints a warning message stderr' do
|
8
|
+
expect(Planter.notify('hello world', :warn)).to be true
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'prints an info message stderr' do
|
12
|
+
expect(Planter.notify('hello world', :info)).to be true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'prints a debug message to stderr' do
|
16
|
+
Planter.debug = true
|
17
|
+
expect(Planter.notify('hello world', :debug)).to be true
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'does not print a debug message to stderr' do
|
21
|
+
Planter.debug = false
|
22
|
+
expect(Planter.notify('hello world', :debug)).to be false
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'prints an error message and exits' do
|
26
|
+
expect do
|
27
|
+
Planter.notify('Error', :error, exit_code: 10)
|
28
|
+
end.to raise_error(SystemExit)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '.spinner' do
|
33
|
+
it 'initializes a new TTY::Spinner object if not already initialized' do
|
34
|
+
Planter.instance_variable_set(:@spinner, nil) # Ensure spinner is not initialized
|
35
|
+
spinner = Planter.spinner
|
36
|
+
expect(spinner).to be_a(TTY::Spinner)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns the existing TTY::Spinner object if already initialized' do
|
40
|
+
existing_spinner = TTY::Spinner.new
|
41
|
+
Planter.instance_variable_set(:@spinner, existing_spinner)
|
42
|
+
spinner = Planter.spinner
|
43
|
+
expect(spinner).to eq(existing_spinner)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '.config=' do
|
48
|
+
# it 'sets the config' do
|
49
|
+
# path = File.expand_path('spec/noop')
|
50
|
+
# FileUtils.mkdir_p(path)
|
51
|
+
# Planter.base_dir = File.expand_path('spec/noop')
|
52
|
+
# allow(File).to receive(:open).with(File.join(Planter.base_dir, "config.yml"), 'w')
|
53
|
+
# allow(File).to receive(:open).with(File.join(Planter.base_dir, 'templates', 'test', '_planter.yml'),
|
54
|
+
# 'w')
|
55
|
+
# Planter.config = 'test'
|
56
|
+
# expect(File.exist?('spec/noop/config.yml')).to be true
|
57
|
+
# FileUtils.remove_entry_secure(path)
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# it 'creates a new configuration file if it does not exist' do
|
61
|
+
# path = File.expand_path('spec/noop')
|
62
|
+
# FileUtils.mkdir_p(path)
|
63
|
+
# Planter.base_dir = File.expand_path('spec/noop')
|
64
|
+
# allow(File).to receive(:exist?).with(File.join(Planter.base_dir, 'config.yml')).and_return(false)
|
65
|
+
# expect(File).to receive(:open).with(File.join(Planter.base_dir, 'config.yml'), 'w')
|
66
|
+
# Planter.config = 'test'
|
67
|
+
# FileUtils.remove_entry_secure(path)
|
68
|
+
# end
|
69
|
+
|
70
|
+
# it 'creates a new template directory if it does not exist' do
|
71
|
+
# path = File.expand_path('spec/noop')
|
72
|
+
# FileUtils.mkdir_p(path)
|
73
|
+
# Planter.base_dir = File.expand_path('spec/noop')
|
74
|
+
# allow(File).to receive(:exist?).with(File.join(Planter.base_dir, 'templates', 'test',
|
75
|
+
# '_planter.yml')).and_return(false)
|
76
|
+
# allow(File).to receive(:directory?).with(File.join(Planter.base_dir, 'templates', 'test')).and_return(false)
|
77
|
+
# expect(FileUtils).to receive(:mkdir_p).with(File.join(Planter.base_dir, 'templates', 'test'))
|
78
|
+
# Planter.config = 'test'
|
79
|
+
# FileUtils.remove_entry_secure(path)
|
80
|
+
# end
|
81
|
+
end
|
82
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'simplecov'
|
2
|
+
require 'cli-test'
|
3
|
+
require 'fileutils'
|
2
4
|
|
3
5
|
SimpleCov.start
|
4
6
|
|
@@ -13,8 +15,12 @@ require 'planter'
|
|
13
15
|
|
14
16
|
RSpec.configure do |c|
|
15
17
|
c.expect_with(:rspec) { |e| e.syntax = :expect }
|
16
|
-
c.before
|
18
|
+
c.before do
|
19
|
+
ENV["RUBYOPT"] = '-W1'
|
20
|
+
ENV['PLANTER_DEBUG'] = 'true'
|
21
|
+
Planter.base_dir = File.expand_path('spec')
|
17
22
|
allow(FileUtils).to receive(:remove_entry_secure).with(anything)
|
23
|
+
allow(FileUtils).to receive(:mkdir_p).with(anything)
|
18
24
|
end
|
19
|
-
c.add_formatter '
|
25
|
+
c.add_formatter 'd'
|
20
26
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
{\rtf1\ansi\ansicpg1252\cocoartf2761
|
2
|
+
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
3
|
+
{\colortbl;\red255\green255\blue255;}
|
4
|
+
{\*\expandedcolortbl;;}
|
5
|
+
\margl1440\margr1440\vieww11520\viewh8400\viewkind0
|
6
|
+
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
|
7
|
+
|
8
|
+
\f0\fs24 \cf0 Planter\
|
9
|
+
\
|
10
|
+
%%project:title%%}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
variables:
|
3
|
+
- key: var_key
|
4
|
+
prompt: CLI Prompt
|
5
|
+
type: "[string, float, integer, number, date]"
|
6
|
+
value: "(optional, for date type can be today, time, now, etc., empty to prompt)"
|
7
|
+
default: "(optional default value, leave empty or remove key for no default)"
|
8
|
+
min: "(optional, for number type set a minimum value)"
|
9
|
+
max: "(optional, for number type set a maximum value)"
|
10
|
+
git_init: false
|
11
|
+
files:
|
12
|
+
"*.tmp": ignore
|
Binary file
|
data/src/_README.md
CHANGED
@@ -19,7 +19,18 @@ If [Gum](https://github.com/charmbracelet/gum) is available it will be used for
|
|
19
19
|
|
20
20
|
## Configuration
|
21
21
|
|
22
|
-
Planter's base configuration is in `~/.config/planter/
|
22
|
+
Planter's base configuration is in `~/.config/planter/planter.yml`. This file can contain any of the keys used in templates (see below) and will serve as a base configuration for all templates. Any key defined in this file will be overridden if it exists in a template.
|
23
|
+
|
24
|
+
Example config (written on first run):
|
25
|
+
|
26
|
+
```yaml
|
27
|
+
files:
|
28
|
+
.DS_Store: ignore
|
29
|
+
"*.tmp": ignore
|
30
|
+
"*.bak": ignore
|
31
|
+
git_init: false
|
32
|
+
preserve_tags: true
|
33
|
+
```
|
23
34
|
|
24
35
|
### Scripts.
|
25
36
|
|
@@ -54,6 +65,10 @@ replacements: # Dictionary of pattern/replacments for regex substitution, see [R
|
|
54
65
|
repo: # If a repository URL is provided, it will be pulled and duplicated instead of copying a file structure
|
55
66
|
```
|
56
67
|
|
68
|
+
#### Default values in template strings
|
69
|
+
|
70
|
+
In a template you can add a default value for a placholder by adding `%default value` to it. For example, `%%project%Default Project%%` will set the placeholder to `Default Project` if the variable value matches the default value in the configuration. This allows you to accept the default on the command line but have a different value inserted in the template. To use another variable in its place, use `$KEY` in the placeholder, e.g. `%%project%$title%%` will replace the `project` key with the value of `title` if the default is selected. Modifiers can be used on either side of the `%`, e.g. `%%project%$title:snake%%`.
|
71
|
+
|
57
72
|
### File-specific handling
|
58
73
|
|
59
74
|
A `files` dictionary can specify how to handle specific files. Options are `copy`, `overwrite`, `merge`, or `ask`. The key for each entry is a filename or glob that matches the source filename (accounting for template variables if applicable):
|
@@ -72,6 +87,14 @@ Merged content
|
|
72
87
|
// /merge
|
73
88
|
```
|
74
89
|
|
90
|
+
Or
|
91
|
+
|
92
|
+
```
|
93
|
+
# merge
|
94
|
+
Merged content
|
95
|
+
# /merge
|
96
|
+
```
|
97
|
+
|
75
98
|
By default files that already exist in the destination directory are not overwritten, and merging allows you to add missing parts to a Rakefile or Makefile, for example.
|
76
99
|
|
77
100
|
If `ask` is specified, a memu will be provided on the command line asking how to handle a file. If the file doesn't already exist, you will be asked only whether to copy the file or not. If it does exist, `overwrite` and `merge` options will be added.
|
@@ -88,6 +111,10 @@ replacements:
|
|
88
111
|
|
89
112
|
Replacements are performed on both file/directory names and file contents.
|
90
113
|
|
114
|
+
### Finder Tags
|
115
|
+
|
116
|
+
If `preserve_tags` is set to `true` in the config (either base or template), then existing Finder tags on the file or folder will be copied to the new file when a template is planted.
|
117
|
+
|
91
118
|
## Usage
|
92
119
|
|
93
120
|
The executable for Planter is `plant`. You can run `plant TEMPLATE` in any directory and TEMPLATE will be planted in the current directory. You can also use `--in PATH` to plant in another directory.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: planter-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bump
|
@@ -262,6 +262,20 @@ dependencies:
|
|
262
262
|
- - "~>"
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0.10'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: plist
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - "~>"
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: 3.7.1
|
272
|
+
type: :runtime
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - "~>"
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: 3.7.1
|
265
279
|
- !ruby/object:Gem::Dependency
|
266
280
|
name: tty-reader
|
267
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -361,14 +375,35 @@ files:
|
|
361
375
|
- lib/planter/script.rb
|
362
376
|
- lib/planter/string.rb
|
363
377
|
- lib/planter/symbol.rb
|
378
|
+
- lib/planter/tag.rb
|
364
379
|
- lib/planter/version.rb
|
365
380
|
- planter-cli.gemspec
|
366
381
|
- scripts/deploy.rb
|
367
382
|
- scripts/runtests.sh
|
368
383
|
- spec/.rubocop.yml
|
384
|
+
- spec/config.yml
|
385
|
+
- spec/planter.yml
|
386
|
+
- spec/planter/array_spec.rb
|
387
|
+
- spec/planter/file_entry_spec.rb
|
388
|
+
- spec/planter/file_spec.rb
|
389
|
+
- spec/planter/filelist_spec.rb
|
390
|
+
- spec/planter/hash_spec.rb
|
369
391
|
- spec/planter/plant_spec.rb
|
392
|
+
- spec/planter/script_spec.rb
|
370
393
|
- spec/planter/string_spec.rb
|
394
|
+
- spec/planter/symbol_spec.rb
|
395
|
+
- spec/planter_spec.rb
|
396
|
+
- spec/scripts/test.sh
|
397
|
+
- spec/scripts/test_fail.sh
|
371
398
|
- spec/spec_helper.rb
|
399
|
+
- spec/templates/test/%%project:snake%%.rtf
|
400
|
+
- spec/templates/test/Rakefile
|
401
|
+
- spec/templates/test/_planter.yml
|
402
|
+
- spec/templates/test/_scripts/test.sh
|
403
|
+
- spec/templates/test/_scripts/test_fail.sh
|
404
|
+
- spec/templates/test/test.rb
|
405
|
+
- spec/test_out/image.png
|
406
|
+
- spec/test_out/test2.rb
|
372
407
|
- src/_README.md
|
373
408
|
homepage: https://github.com/ttscoff/planter-cli
|
374
409
|
licenses:
|
@@ -395,6 +430,26 @@ specification_version: 4
|
|
395
430
|
summary: Plant files and directories using templates
|
396
431
|
test_files:
|
397
432
|
- spec/.rubocop.yml
|
433
|
+
- spec/config.yml
|
434
|
+
- spec/planter.yml
|
435
|
+
- spec/planter/array_spec.rb
|
436
|
+
- spec/planter/file_entry_spec.rb
|
437
|
+
- spec/planter/file_spec.rb
|
438
|
+
- spec/planter/filelist_spec.rb
|
439
|
+
- spec/planter/hash_spec.rb
|
398
440
|
- spec/planter/plant_spec.rb
|
441
|
+
- spec/planter/script_spec.rb
|
399
442
|
- spec/planter/string_spec.rb
|
443
|
+
- spec/planter/symbol_spec.rb
|
444
|
+
- spec/planter_spec.rb
|
445
|
+
- spec/scripts/test.sh
|
446
|
+
- spec/scripts/test_fail.sh
|
400
447
|
- spec/spec_helper.rb
|
448
|
+
- spec/templates/test/%%project:snake%%.rtf
|
449
|
+
- spec/templates/test/Rakefile
|
450
|
+
- spec/templates/test/_planter.yml
|
451
|
+
- spec/templates/test/_scripts/test.sh
|
452
|
+
- spec/templates/test/_scripts/test_fail.sh
|
453
|
+
- spec/templates/test/test.rb
|
454
|
+
- spec/test_out/image.png
|
455
|
+
- spec/test_out/test2.rb
|