lono 6.1.9 → 6.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98eb8c664ca1835e37b72418cff2c983ea5863902b5866597b42deeaef912977
4
- data.tar.gz: c2f21dfe5e45dcfb28cea9d9a09702cb79f022dc3747a52dad0c8ceeb4077f26
3
+ metadata.gz: a497745aa03146372828bb2974c071d971391cfb683a779cf8b6dcb61888b0d5
4
+ data.tar.gz: 8b6f6c39b7c74e7ec3583e85434039ac124e2538d3af059fa0119174ae37b407
5
5
  SHA512:
6
- metadata.gz: aa93526540aea34e7166ccfd0d64109333019ebd21b43d58705cc10239ed72a2951de01ec696253e60d8066723187d9288ee5ea10ff2226a44301698c11ded74
7
- data.tar.gz: 5c148cb13bf315292b1173f1acea6f4c89d5825e2432a101f5cecec910045c75d3462bce3d7c9f509c98bd2cfa2f9b150302bf7706adf356a2a42d1badcb2c61
6
+ metadata.gz: 8b561e711d24e6e6750ed37305c330448916f46cb2da5d628fcf9618ac6d4fe6ecb1eae23c3c51b33168aaf61e928a1ef96333614045c5ae2afb316e041d93b9
7
+ data.tar.gz: 52fa0b0add58c86db1c643025a8e71eca87d31ba47a3e953fa7ee5da519a16798e523dd22baa4ee45185f81ef2ac14c53e7a1dc0d9d26a612b8fd7d74afee445
@@ -3,6 +3,11 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [6.1.10]
7
+ - #32 use lono dsl scope for the app files erb processing
8
+ - #33 fix squeezer for Array. squeeze hashes nested in arrays too
9
+ - #34 fix squeeze for false values
10
+
6
11
  ## [6.1.9]
7
12
  - #30 fix md5 sum calcuation for single file
8
13
  - #31 Add app files ERB support docs
@@ -29,9 +29,14 @@ module Lono::AppFile
29
29
  def copy_to_output
30
30
  override_source_paths("#{Lono.blueprint_root}/app/files")
31
31
  self.destination_root = @output_files_path
32
- directory(".", verbose: false)
32
+ directory(".", verbose: false, context: context.get_binding) # Thor::Action
33
33
  end
34
34
 
35
+ def context
36
+ Lono::Template::Context.new(@blueprint, @options)
37
+ end
38
+ memoize :context
39
+
35
40
  def zip_file(item)
36
41
  path = item.path
37
42
  zip_file = item.zip_file_name
@@ -20,5 +20,11 @@ class Lono::Template
20
20
  instance_variable_set('@' + key.to_s, value)
21
21
  end
22
22
  end
23
+
24
+ # For Lono::AppFile::Build usage of Thor::Action directory
25
+ # For some reason a send(:binding) doesnt work but get_binding like this works.
26
+ def get_binding
27
+ binding
28
+ end
23
29
  end
24
30
  end
@@ -8,7 +8,7 @@ class Lono::Template::Context
8
8
  # config/variables/development.rb - will override any variables in base.rb
9
9
  #
10
10
  def load_variables
11
- options = @options.clone
11
+ options = ActiveSupport::HashWithIndifferentAccess.new(@options.dup)
12
12
  options[:blueprint] = @blueprint
13
13
  options[:stack] ||= @blueprint
14
14
  location = Lono::ConfigLocation.new("variables", options, Lono.env)
@@ -35,7 +35,7 @@ class Lono::Template::Dsl::Builder
35
35
 
36
36
  # Remove items with nil value automatically
37
37
  def clean(data)
38
- HashSqueezer.new(data).squeeze
38
+ Squeezer.new(data).squeeze
39
39
  end
40
40
  end
41
41
  end
@@ -0,0 +1,23 @@
1
+ class Lono::Template::Dsl::Builder
2
+ class Squeezer
3
+ def initialize(data)
4
+ @data = data
5
+ end
6
+
7
+ def squeeze(new_data=nil)
8
+ data = new_data.nil? ? @data : new_data
9
+
10
+ case data
11
+ when Array
12
+ data.map! { |v| squeeze(v) }
13
+ when Hash
14
+ data.each_with_object({}) do |(k,v), squeezed|
15
+ squeezed[k] = squeeze(v) unless v.nil? # only remove nil values within Hash structures
16
+ squeezed
17
+ end
18
+ else
19
+ data # do not transform
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "6.1.9"
2
+ VERSION = "6.1.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.9
4
+ version: 6.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -555,7 +555,6 @@ files:
555
555
  - lib/lono/template/dsl/builder/base.rb
556
556
  - lib/lono/template/dsl/builder/condition.rb
557
557
  - lib/lono/template/dsl/builder/fn.rb
558
- - lib/lono/template/dsl/builder/hash_squeezer.rb
559
558
  - lib/lono/template/dsl/builder/helpers.rb
560
559
  - lib/lono/template/dsl/builder/helpers/core_helper.rb
561
560
  - lib/lono/template/dsl/builder/helpers/param_helper.rb
@@ -566,6 +565,7 @@ files:
566
565
  - lib/lono/template/dsl/builder/resource/property_mover.rb
567
566
  - lib/lono/template/dsl/builder/section.rb
568
567
  - lib/lono/template/dsl/builder/section_methods.rb
568
+ - lib/lono/template/dsl/builder/squeezer.rb
569
569
  - lib/lono/template/dsl/builder/syntax.rb
570
570
  - lib/lono/template/erb.rb
571
571
  - lib/lono/template/evaluate.rb
@@ -1,20 +0,0 @@
1
- # Based on https://stackoverflow.com/questions/32174183/remove-nil-values-from-hash
2
- class Lono::Template::Dsl::Builder
3
- class HashSqueezer
4
- def initialize(data)
5
- @data = data
6
- end
7
-
8
- def squeeze(new_data=nil)
9
- data = new_data || @data
10
- data.each_with_object({}) do |(k, v), squeezed|
11
- if v.is_a?(Hash)
12
- squeezed[k] = squeeze(v)
13
- else
14
- squeezed[k] = v unless v.nil?
15
- end
16
- squeezed
17
- end
18
- end
19
- end
20
- end