lono 7.3.0 → 7.3.1

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: 50634682d0b2bd1142fa36acb73b537e1fcceabde68d7ea88da24621c17b2267
4
- data.tar.gz: 53a2e8a25610f8f039cdee8c6cb71ab15b24732642d0453a61ace628fb925ca4
3
+ metadata.gz: c5a28e2180e7a054b7e98282463ff7dff16c5deac888a2e7e24276a1b5121373
4
+ data.tar.gz: bdba8d533c3e7a984429895e514a4ad59610709c6df98efa688394976637dc1a
5
5
  SHA512:
6
- metadata.gz: a700f987afc86bdf10ffc561e0f9027d7ce7aa661b852395a6ff734d272f06a655f24ff4f44aff316b3cb0c225ce64affccab258bde7ac58c0393ce47eff09b5
7
- data.tar.gz: 1ad6215fc323bd75bd88c085761fe96131d9e71e531cf40ee0d2940cf8f10483c97cb86984c382cf1c3b6ee1522edc60782275a514713b4fc05c5d6627bf184c
6
+ metadata.gz: 7417b4b562eda86bff02b2f9c9eba2530a9929317ce240f22a36b010bf8eb95af4cbcc5deaabf4f2bdb3d83e8211711c7fcdccfadcdf04d5858532de1424a3b1
7
+ data.tar.gz: b7f30f13206e2f7264d076c7e3fc3eb2fda318a6a827ad3306581d6b379682637266d6fc20cdd2b937139b26c89c910dd48f26061517ced9e29e673924a3baeb
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
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
+ ## [7.3.1]
7
+ - #55 lambda layer fixes: allow Gemfile path option to vendor gems
8
+
6
9
  ## [7.3.0]
7
10
  - #54 introduce lambda layer concept
8
11
 
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  class Lono::AppFile::Build::LambdaLayer
2
4
  # Based on jets
3
5
  class RubyPackager
@@ -36,8 +38,7 @@ class Lono::AppFile::Build::LambdaLayer
36
38
 
37
39
  def rsync_and_link(src, dest)
38
40
  FileUtils.mkdir_p(dest)
39
- # Trailing slashes are required
40
- sh "rsync -a --links #{src}/ #{dest}/"
41
+ rsync(src, dest)
41
42
 
42
43
  # create symlink in output path not the cache path
43
44
  symlink_dest = "#{output_area}/vendor/gems/ruby/#{ruby_folder}"
@@ -69,12 +70,12 @@ class Lono::AppFile::Build::LambdaLayer
69
70
  def bundle_install
70
71
  puts "Bundling: running bundle install in cache area: #{cache_area}."
71
72
 
72
- copy_gemfiles(@app_root)
73
+ rsync(output_area, cache_area)
73
74
 
74
75
  # Uncomment out to always remove the cache/vendor/gems to debug
75
76
  # FileUtils.rm_rf("#{cache_area}/vendor/gems")
76
77
 
77
- # Remove .bundle folder so .bundle/config doesnt affect how Jets packages gems.
78
+ # Remove .bundle folder so .bundle/config doesnt affect how gems are packages
78
79
  # Not using BUNDLE_IGNORE_CONFIG=1 to allow home ~/.bundle/config to affect bundling though.
79
80
  # This is useful if you have private gems sources that require authentication. Example:
80
81
  #
@@ -125,18 +126,6 @@ class Lono::AppFile::Build::LambdaLayer
125
126
  FileUtils.cp(src, dest)
126
127
  end
127
128
 
128
- # Clean up extra unneeded files to reduce package size
129
- def copy_gemfiles(app_root)
130
- FileUtils.mkdir_p(cache_area)
131
- FileUtils.cp("#{app_root}/Gemfile", "#{cache_area}/Gemfile")
132
-
133
- gemfile_lock = "#{app_root}/Gemfile.lock"
134
- dest = "#{cache_area}/Gemfile.lock"
135
- return unless File.exist?(gemfile_lock)
136
-
137
- FileUtils.cp(gemfile_lock, dest)
138
- end
139
-
140
129
  def setup_bundle_config(dir)
141
130
  text =<<-EOL
142
131
  ---
@@ -174,7 +163,31 @@ EOL
174
163
  puts "=> #{command}"
175
164
  out = `#{command}`
176
165
  puts out if ENV['LONO_DEBUG_LAMBDA_LAYER']
177
- $?.success?
166
+ success = $?.success?
167
+ raise("ERROR: running command #{command}").color(:red) unless success
168
+ success
169
+ end
170
+
171
+ def rsync(src, dest)
172
+ # Using FileUtils.cp_r doesnt work if there are special files like socket files in the src dir.
173
+ # Instead of using this hack https://bugs.ruby-lang.org/issues/10104
174
+ # Using rsync to perform the copy.
175
+ src.chop! if src.ends_with?('/')
176
+ dest.chop! if dest.ends_with?('/')
177
+ check_rsync_installed!
178
+ # Ensures required trailing slashes
179
+ FileUtils.mkdir_p(File.dirname(dest))
180
+ sh "rsync -a --links --no-specials --no-devices #{Shellwords.escape(src)}/ #{Shellwords.escape(dest)}/"
181
+ end
182
+
183
+ @@rsync_installed = false
184
+ def check_rsync_installed!
185
+ return if @@rsync_installed # only check once
186
+ if system "type rsync > /dev/null 2>&1"
187
+ @@rsync_installed = true
188
+ else
189
+ raise "ERROR: Rsync is required. Rsync does not seem to be installed.".color(:red)
190
+ end
178
191
  end
179
192
  end
180
193
  end
data/lib/lono/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lono
2
- VERSION = "7.3.0"
2
+ VERSION = "7.3.1"
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: 7.3.0
4
+ version: 7.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-12 00:00:00.000000000 Z
11
+ date: 2020-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport