lambda-layer-cake 0.1.1 → 0.2.1

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: '0929fa88af212b2adbd2434aa1f75518fa50990c7b0ec5e1145153d76fde16b8'
4
- data.tar.gz: 2322e1e5922ddf716815de7cb850efa1295947430938de80e167def203b006aa
3
+ metadata.gz: 862e89024d175ec0fac695fb60af13fd28b26f6b292b1f68651d12527e476e45
4
+ data.tar.gz: 4dc8138d2c550df0db3af32be86d55a491e7b7a85b8c59ec84ed476d8facb9be
5
5
  SHA512:
6
- metadata.gz: e823aee747d165029b115ff61455a0354d4cd33e9c73084e65b62a0199bd14ca75520ff026884e9ac59ac5c9dd5370d09b90311fb7ddb049cfa4f0750a95783b
7
- data.tar.gz: fd1b85928ef49acd74b93408994bfb5513c51d06d8166d14d3e96ce38d102cbed9faeb090f94d81dbce6b63a66183a6c62e34d72729ff31544808856bc087e29
6
+ metadata.gz: 3e7dc86198a59c89de3d35647086019402fb1aa94e98a122e9d4dc96bd0e5a9d3f0947ac4f8bbfb3ebfde0b27d5c2341080266cf4e133127e91e9c1906414e39
7
+ data.tar.gz: 1f5dbdecebe976d3f7629374b835b5116847eed7e28d2d4546d3d589d2be64eb190140aa5202088a5737a5aff3ac0f2d036abd0cb479027df1f9d4719b822138
@@ -18,6 +18,7 @@ def main
18
18
  if(File.exist?('system-packages.txt'))
19
19
  STDERR.puts("Installing System Packages")
20
20
  build_deps = File.read("system-packages.txt").split
21
+ STDERR.puts("Packages: #{build_deps.join(',')}")
21
22
  unless(system("yum", "install", "-y", *(build_deps)))
22
23
  STDERR.puts("Could not install build dependency pacakges")
23
24
  exit 2
@@ -26,7 +27,7 @@ def main
26
27
 
27
28
  STDERR.puts("Building Gems")
28
29
  FileUtils.mkdir_p("/tmp/build/bundle")
29
- unless(system("bundle","install","--deployment","--path=/tmp/build/bundle"))
30
+ unless(system("bundle","install","--deployment","--path=/tmp/build/bundle","--without","test","development"))
30
31
  STDERR.puts("Couldn't build gems")
31
32
  exit 3
32
33
  end
@@ -66,11 +67,13 @@ def main
66
67
  FileUtils.mkdir_p('/tmp/outputs/lib')
67
68
  FileUtils.cp(libs.to_a, '/tmp/outputs/lib')
68
69
 
70
+ #This directory is not needed at runtime
71
+ STDERR.puts("Removing extra files")
72
+ FileUtils.rm_rf(Dir["/tmp/build/bundle/ruby/*/cache"])
73
+ FileUtils.rm_rf(Dir["/tmp/build/bundle/ruby/*/gems/*/test"])
74
+
69
75
  STDERR.puts("Moving Bundle into place")
70
76
  FileUtils.cp_r("/tmp/build/bundle", "/tmp/outputs")
71
- #This directory is not needed at runtime
72
- #STDERR.puts("Removing extra files")
73
- #FileUtils.rm_rf("/tmp/outputs/bundle/ruby/2.5.0/cache")
74
77
 
75
78
  STDERR.puts("All Done!")
76
79
  end
@@ -26,7 +26,7 @@ module LambdaLayerCake
26
26
  -v #{inputs_dir}:/tmp/inputs
27
27
  -v #{outputs_dir}:/tmp/outputs
28
28
  -v #{File.expand_path(__dir__ + "/../../build_env")}:/var/task
29
- lambci/lambda:build-ruby2.5 ruby build_ruby.rb}
29
+ lambci/lambda:#{docker_tag} ruby build_ruby.rb}
30
30
  STDERR.puts("Excuting cmd: #{cmd.join(' ')}")
31
31
  system(*cmd) or raise
32
32
  end
@@ -55,7 +55,7 @@ module LambdaLayerCake
55
55
  desc "Build the current layer version and symlink it to the versioned zip"
56
56
  file ".layer_cake/layer.zip": ".layer_cake/layer-#{input_hash}.zip" do
57
57
  FileUtils.ln_s("layer-#{input_hash}.zip",".layer_cake/layer.zip", force: true)
58
- end
58
+ end
59
59
  end
60
60
 
61
61
  def app_task_definitions!
@@ -67,6 +67,7 @@ module LambdaLayerCake
67
67
  system(*cmd) or raise
68
68
 
69
69
  #Insert a symlink into the app.zip
70
+ FileUtils.rm_r(working_dir("app/")) if(File.exists?(working_dir("app")))
70
71
  FileUtils.mkdir_p(working_dir("app/vendor"))
71
72
  FileUtils.ln_s("/tmp", working_dir("app/tmp"))
72
73
  FileUtils.ln_s("/opt/bundle", working_dir("app/vendor/bundle"), force: true)
@@ -80,7 +81,13 @@ module LambdaLayerCake
80
81
  desc "Output the version hash for the current input files (Gemfile, Gemfile.lock, system-packages.txt)"
81
82
  task :version do
82
83
  $stdout.write input_hash
83
- end
84
+ end
85
+
86
+ desc "Reports the ruby version of the lambda environment"
87
+ task :ruby_version do
88
+ $stdout.write ruby_version
89
+ end
90
+
84
91
  end
85
92
 
86
93
  def clean_task_definitions!
@@ -117,5 +124,19 @@ module LambdaLayerCake
117
124
  )
118
125
  )
119
126
  end
127
+
128
+ def docker_tag
129
+ "build-ruby#{/^\d+\.\d+/.match(RUBY_VERSION)[0]}"
130
+ end
131
+
132
+ def ruby_version
133
+ cmd = %W{docker run --rm
134
+ -v #{inputs_dir}:/tmp/inputs
135
+ -v #{outputs_dir}:/tmp/outputs
136
+ -v #{File.expand_path(__dir__ + "/../../build_env")}:/var/task
137
+ lambci/lambda:#{docker_tag} ruby -e }.push '$stdout.write RUBY_VERSION'
138
+ STDERR.puts("Excuting cmd: #{cmd.join(' ')}")
139
+ system(*cmd) or raise
140
+ end
120
141
  end
121
142
  end
@@ -1,3 +1,3 @@
1
1
  module LambdaLayerCake
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda-layer-cake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Bowers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2020-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -73,7 +73,7 @@ homepage: http://github.com/loganb/lambda-layer-cake
73
73
  licenses:
74
74
  - MIT
75
75
  metadata: {}
76
- post_install_message:
76
+ post_install_message:
77
77
  rdoc_options: []
78
78
  require_paths:
79
79
  - lib
@@ -88,9 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubyforge_project:
92
- rubygems_version: 2.7.10
93
- signing_key:
91
+ rubygems_version: 3.1.2
92
+ signing_key:
94
93
  specification_version: 4
95
94
  summary: A set of Rake tasks to bundle Rails apps for use on AWS Lambda
96
95
  test_files: []