lono 6.1.8 → 6.1.9

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: b44dae2e1a33765ce3e3d969e0f2ca6ad0230f027b1ff94863b27bb3077b4e26
4
- data.tar.gz: 280c9073d25b90b02afe7e44aa22514fb21ad8affd3ed3272c4315edd6f2acd6
3
+ metadata.gz: 98eb8c664ca1835e37b72418cff2c983ea5863902b5866597b42deeaef912977
4
+ data.tar.gz: c2f21dfe5e45dcfb28cea9d9a09702cb79f022dc3747a52dad0c8ceeb4077f26
5
5
  SHA512:
6
- metadata.gz: 7ed15e4146cfb29b71e6399f1f7424ec6533bbe0def6886b931e2bf506a1913bdb8bf518a599e100679638de1a603942a814aa1e3b7268b29d49fb1664a1b614
7
- data.tar.gz: 45dfae54e67bdd6b51ac6ad2943b86126c4e1f4d8ac6fe6c1f24d923e9e67d12e514bbcf6f3cc636e08ca0f0a7a352df84dc0c981345bb551dd6e145c70d838f
6
+ metadata.gz: aa93526540aea34e7166ccfd0d64109333019ebd21b43d58705cc10239ed72a2951de01ec696253e60d8066723187d9288ee5ea10ff2226a44301698c11ded74
7
+ data.tar.gz: 5c148cb13bf315292b1173f1acea6f4c89d5825e2432a101f5cecec910045c75d3462bce3d7c9f509c98bd2cfa2f9b150302bf7706adf356a2a42d1badcb2c61
@@ -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.9]
7
+ - #30 fix md5 sum calcuation for single file
8
+ - #31 Add app files ERB support docs
9
+ - options `--sure` and `--iam` add `CAPABILITY_AUTO_EXPAND` for serverless transform
10
+
6
11
  ## [6.1.8]
7
12
  - #28 add user_data_script helper
8
13
  - #29 remove items in Hash structure with nil value at any level
@@ -4,6 +4,11 @@ module Lono::AppFile
4
4
  include Lono::Blueprint::Root
5
5
  extend Memoist
6
6
 
7
+ # What's needed for a Thor::Group or "Sequence". Gives us Thor::Actions commands like create_file
8
+ # Must be included before `def initialize` as we override the Thor initialize
9
+ include Thor::Actions
10
+ include Thor::Base
11
+
7
12
  def initialize(blueprint, options={})
8
13
  @blueprint, @options = blueprint, options
9
14
  @template = @options[:template] || @blueprint
@@ -15,5 +20,16 @@ module Lono::AppFile
15
20
 
16
21
  def initialize_variables
17
22
  end
23
+
24
+ private
25
+ # Hack Thor to be able to dynamically set the source_paths at runtime instance methods
26
+ def override_source_paths(*paths)
27
+ # Using string with instance_eval because block doesnt have access to path at runtime.
28
+ self.class.instance_eval %{
29
+ def self.source_paths
30
+ #{paths.flatten.inspect}
31
+ end
32
+ }
33
+ end
18
34
  end
19
35
  end
@@ -1,3 +1,5 @@
1
+ require "thor"
2
+
1
3
  module Lono::AppFile
2
4
  class Build < Base
3
5
  def initialize_variables
@@ -6,7 +8,6 @@ module Lono::AppFile
6
8
 
7
9
  def run
8
10
  return unless detect_files?
9
-
10
11
  puts "Building app/files for blueprint #{@blueprint}"
11
12
  build_all
12
13
  end
@@ -25,6 +26,12 @@ module Lono::AppFile
25
26
  end
26
27
  end
27
28
 
29
+ def copy_to_output
30
+ override_source_paths("#{Lono.blueprint_root}/app/files")
31
+ self.destination_root = @output_files_path
32
+ directory(".", verbose: false)
33
+ end
34
+
28
35
  def zip_file(item)
29
36
  path = item.path
30
37
  zip_file = item.zip_file_name
@@ -58,13 +65,6 @@ module Lono::AppFile
58
65
  FileUtils.rm_rf(@output_files_path)
59
66
  end
60
67
 
61
- def copy_to_output
62
- src = "#{Lono.blueprint_root}/app/files"
63
- dest = @output_files_path
64
- FileUtils.mkdir_p(File.dirname(dest))
65
- FileUtils.cp_r(src, dest)
66
- end
67
-
68
68
  def detect_files?
69
69
  app_files = Dir["#{Lono.blueprint_root}/app/files/*"]
70
70
  if app_files.empty?
@@ -261,7 +261,7 @@ class Lono::Cfn
261
261
  def capabilities
262
262
  return @options[:capabilities] if @options[:capabilities]
263
263
  if @options[:sure] || @options[:iam]
264
- ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
264
+ ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM", "CAPABILITY_AUTO_EXPAND"]
265
265
  end
266
266
  end
267
267
 
@@ -50,15 +50,22 @@ module Lono
50
50
  Lono::Inspector::Graph.new(blueprint, template, options).run
51
51
  end
52
52
 
53
- desc "seed", "Generates starter configs for a blueprint."
53
+ desc "seed BLUEPRINT", "Generates starter configs for a blueprint."
54
54
  long_desc Help.text("seed")
55
55
  option :param, desc: "override convention and specify the param file to use"
56
56
  option :template, desc: "override convention and specify the template file to use"
57
- add_runtime_options!
57
+ add_runtime_options! # Thor::Action options like --force
58
58
  def seed(blueprint)
59
59
  Seed.new(blueprint, options).create
60
60
  end
61
61
 
62
+ desc "app_files BLUEPRINT", "Builds app files"
63
+ long_desc Help.text("app_files")
64
+ add_runtime_options! # Thor::Action options like --force
65
+ def app_files(blueprint)
66
+ Lono::AppFile::Build.new(blueprint, options).run
67
+ end
68
+
62
69
  desc "clean", "Removes `output` folder."
63
70
  def clean
64
71
  Clean.new(options).run
@@ -15,13 +15,11 @@ module Lono
15
15
  # This checksum within the file name is to mainly make sure that Lambda::Function resources "change" and an update is triggered.
16
16
  # There's another checksum in the upload code that makes sure we don't upload the code again to speed up things.
17
17
  def sum(path)
18
- files = Dir["#{path}/**/*"]
19
- files = files.reject { |f| File.directory?(f) }
20
- .reject { |f| File.symlink?(f) }
21
- files.sort!
22
- content = files.map do |f|
23
- Digest::MD5.file(f).to_s[0..7]
24
- end.join
18
+ content = if File.directory?(path)
19
+ sum_directory(path)
20
+ else
21
+ Digest::MD5.file(path).to_s[0..7]
22
+ end
25
23
 
26
24
  md5 = Digest::MD5.new
27
25
  md5.update(content)
@@ -29,6 +27,17 @@ module Lono
29
27
  end
30
28
  memoize :sum
31
29
 
30
+ def sum_directory(dir)
31
+ files = Dir["#{dir}/**/*"]
32
+ files = files.reject { |f| File.directory?(f) }
33
+ .reject { |f| File.symlink?(f) }
34
+ files.sort!
35
+
36
+ files.map do |f|
37
+ Digest::MD5.file(f).to_s[0..7]
38
+ end.join
39
+ end
40
+
32
41
  def name(path)
33
42
  relative_path = name_without_md5(path)
34
43
  relative_path = relative_path.sub(/\.(\w+)$/,'') # strip extension
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "6.1.8"
2
+ VERSION = "6.1.9"
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.8
4
+ version: 6.1.9
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-09 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport