app_archetype 1.5.1 → 1.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5349a7a225f734e2fb9a776dc35901784087f64f408cad6420e9f0e91697bb33
4
- data.tar.gz: 8eb265ac52da61004ebc7a212520fefb3139720230cd5824a7dc690f833c5aad
3
+ metadata.gz: a4960f16cbaf3034a7facdbebc02ff0b0df95819b8f9fa36f74d663112e1d74f
4
+ data.tar.gz: ab95112f6710e036ac76f95e6656b49dd47c0502331587513ba9dc4bdb894dd6
5
5
  SHA512:
6
- metadata.gz: 78a4e55c5dff28403204480a49870a85914436a63187cbb167bbccb9023d87b317101a107a1faf39fbbd3479f7d54f6d6cd074341169f5006f79b62630dd24ee
7
- data.tar.gz: 2fdfd6aaca47c4ddb6e7e45ebc3708dda871e60c927b4b61a30f79afe4b0f008aa1ed6e016a54ea42f028943b28b655f47e17675c7fa6f58efabc5ea3eee59f4
6
+ metadata.gz: '093ab09ba553ef8329890ae26e7b048fdb0d2296223796269282b48ec71d103a4b0f353556211304d53ba6a74984aeb1bab4d175af6fa1178f391378529472ff'
7
+ data.tar.gz: 8e399efb92ef27a6a4a9a24455b8fc0d50517b1ac8b7ac96eb3401b80fcd37abdd6461d82c9c9a5420481a514c092fdd9c32bae71635a8ad2939117d76524da3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_archetype (1.5.1)
4
+ app_archetype (1.5.2)
5
5
  cli-format
6
6
  hashie
7
7
  highline
@@ -33,7 +33,7 @@ GEM
33
33
  ice_nine (~> 0.11.0)
34
34
  thread_safe (~> 0.3, >= 0.3.1)
35
35
  bump (0.10.0)
36
- cli-format (0.2.2)
36
+ cli-format (0.5.0)
37
37
  activesupport
38
38
  text-table
39
39
  zeitwerk
@@ -61,7 +61,7 @@ GEM
61
61
  i18n (1.14.1)
62
62
  concurrent-ruby (~> 1.0)
63
63
  ice_nine (0.11.2)
64
- json (2.6.3)
64
+ json (2.7.1)
65
65
  json-schema (4.1.1)
66
66
  addressable (>= 2.8)
67
67
  jsonnet (0.5.3)
@@ -69,12 +69,12 @@ GEM
69
69
  kwalify (0.7.2)
70
70
  launchy (2.5.0)
71
71
  addressable (~> 2.7)
72
- logger (1.5.3)
72
+ logger (1.6.0)
73
73
  method_source (1.0.0)
74
- mini_portile2 (2.8.4)
74
+ mini_portile2 (2.8.5)
75
75
  minitest (5.20.0)
76
76
  os (1.1.4)
77
- ostruct (0.5.5)
77
+ ostruct (0.6.0)
78
78
  parallel (1.21.0)
79
79
  parser (3.1.0.0)
80
80
  ast (~> 2.4.1)
@@ -161,7 +161,7 @@ GEM
161
161
  tty-cursor (~> 0.7)
162
162
  tty-screen (~> 0.8)
163
163
  wisper (~> 2.0)
164
- tty-screen (0.8.1)
164
+ tty-screen (0.8.2)
165
165
  tty-table (0.12.0)
166
166
  pastel (~> 0.8)
167
167
  strings (~> 0.2.0)
@@ -180,7 +180,7 @@ GEM
180
180
  wisper (2.0.1)
181
181
  yard (0.9.27)
182
182
  webrick (~> 1.7.0)
183
- zeitwerk (2.6.11)
183
+ zeitwerk (2.6.12)
184
184
 
185
185
  PLATFORMS
186
186
  ruby
@@ -204,6 +204,24 @@ module AppArchetype
204
204
  def valid?
205
205
  validate.empty?
206
206
  end
207
+
208
+ ##
209
+ # Setter for variables
210
+ #
211
+ # @param [Hash] value
212
+ def variables=(value)
213
+ var_values = {}
214
+
215
+ value.each do |name, value|
216
+ var_values[name] = {
217
+ name: name,
218
+ description: name,
219
+ value: value
220
+ }
221
+ end
222
+
223
+ @variables = AppArchetype::Template::VariableManager.new(var_values)
224
+ end
207
225
  end
208
226
  end
209
227
  end
@@ -2,5 +2,5 @@ module AppArchetype
2
2
  ##
3
3
  # AppArchetype version
4
4
  #
5
- VERSION = '1.5.1'.freeze
5
+ VERSION = '1.5.2'.freeze
6
6
  end
data/lib/app_archetype.rb CHANGED
@@ -38,12 +38,14 @@ module AppArchetype
38
38
  collection_dir: ENV.fetch('ARCHETYPE_TEMPLATE_DIR'),
39
39
  template_name: '',
40
40
  destination_path: '',
41
- overwrite: false
41
+ overwrite: false,
42
+ variables: nil
42
43
  )
43
44
  manager = AppArchetype::TemplateManager.new(collection_dir)
44
45
  manager.load
45
46
 
46
47
  manifest = manager.find_by_name(template_name)
48
+ manifest.variables = variables unless variables.nil?
47
49
 
48
50
  template = manifest.template
49
51
  template.load
@@ -272,4 +272,30 @@ RSpec.describe AppArchetype::Template::Manifest do
272
272
  end
273
273
  end
274
274
  end
275
+
276
+ describe '#variables=' do
277
+ let(:path) { 'path/to/manifest.json' }
278
+
279
+ let(:data) do
280
+ {
281
+ 'name' => 'test_manifest',
282
+ 'version' => '0.1.0',
283
+ 'variables' => {}
284
+ }
285
+ end
286
+
287
+ let(:vars) do
288
+ {
289
+ 'foo' => 'bar'
290
+ }
291
+ end
292
+
293
+ before do
294
+ subject.variables = vars
295
+ end
296
+
297
+ it 'sets variables from given hash' do
298
+ expect(subject.variables.get('foo').value).to eq 'bar'
299
+ end
300
+ end
275
301
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_archetype
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Bigger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-25 00:00:00.000000000 Z
11
+ date: 2023-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cli-format