jets 1.0.1 → 1.0.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -3
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile.lock +1 -1
  5. data/README.md +23 -1
  6. data/jets.gemspec +1 -2
  7. data/lib/jets.rb +5 -11
  8. data/lib/jets/builders/gem_replacer.rb +12 -96
  9. data/lib/jets/builders/ruby_packager.rb +3 -4
  10. data/lib/jets/builders/tidy.rb +9 -0
  11. data/lib/jets/commands.rb +1 -0
  12. data/lib/jets/commands/base.rb +10 -1
  13. data/lib/jets/commands/gems.rb +25 -0
  14. data/lib/jets/commands/help/gems/check.md +7 -0
  15. data/lib/jets/commands/help/import/rails.md +3 -3
  16. data/lib/jets/commands/import.rb +4 -0
  17. data/lib/jets/commands/import/base.rb +10 -0
  18. data/lib/jets/commands/import/cheatsheet.rb +35 -0
  19. data/lib/jets/commands/import/rail.rb +7 -0
  20. data/lib/jets/commands/import/sequence.rb +63 -47
  21. data/lib/jets/commands/import/templates/submodules-cheatsheet.md +89 -0
  22. data/lib/jets/db.rb +9 -0
  23. data/lib/jets/version.rb +1 -1
  24. data/vendor/jets-gems/Gemfile +6 -0
  25. data/vendor/jets-gems/Gemfile.lock +39 -0
  26. data/vendor/jets-gems/LICENSE.txt +21 -0
  27. data/vendor/jets-gems/README.md +19 -0
  28. data/vendor/{lambdagem → jets-gems}/Rakefile +2 -2
  29. data/vendor/jets-gems/bin/console +14 -0
  30. data/vendor/jets-gems/bin/setup +8 -0
  31. data/vendor/jets-gems/jets-gems.gemspec +30 -0
  32. data/vendor/jets-gems/lib/jets-gems.rb +1 -0
  33. data/vendor/jets-gems/lib/jets/gems.rb +16 -0
  34. data/vendor/jets-gems/lib/jets/gems/check.rb +156 -0
  35. data/vendor/jets-gems/lib/jets/gems/exist.rb +54 -0
  36. data/vendor/jets-gems/lib/jets/gems/extract.rb +7 -0
  37. data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/base.rb +25 -6
  38. data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/gem.rb +10 -8
  39. data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/ruby.rb +6 -7
  40. data/vendor/jets-gems/lib/jets/gems/report.rb +53 -0
  41. data/vendor/jets-gems/lib/jets/gems/version.rb +5 -0
  42. data/vendor/jets-gems/spec/jets/gems_spec.rb +5 -0
  43. data/vendor/jets-gems/spec/spec_helper.rb +14 -0
  44. metadata +41 -53
  45. data/vendor/lambdagem/CHANGELOG.md +0 -27
  46. data/vendor/lambdagem/Gemfile +0 -6
  47. data/vendor/lambdagem/Gemfile.lock +0 -73
  48. data/vendor/lambdagem/Guardfile +0 -12
  49. data/vendor/lambdagem/LICENSE.txt +0 -22
  50. data/vendor/lambdagem/README.md +0 -139
  51. data/vendor/lambdagem/exe/lambdagem +0 -14
  52. data/vendor/lambdagem/lambdagem.gemspec +0 -32
  53. data/vendor/lambdagem/lib/lambdagem.rb +0 -18
  54. data/vendor/lambdagem/lib/lambdagem/base.rb +0 -53
  55. data/vendor/lambdagem/lib/lambdagem/build.rb +0 -202
  56. data/vendor/lambdagem/lib/lambdagem/clean.rb +0 -8
  57. data/vendor/lambdagem/lib/lambdagem/cli.rb +0 -62
  58. data/vendor/lambdagem/lib/lambdagem/command.rb +0 -38
  59. data/vendor/lambdagem/lib/lambdagem/exist.rb +0 -50
  60. data/vendor/lambdagem/lib/lambdagem/extract.rb +0 -8
  61. data/vendor/lambdagem/lib/lambdagem/extract/class_methods.rb +0 -50
  62. data/vendor/lambdagem/lib/lambdagem/help.rb +0 -9
  63. data/vendor/lambdagem/lib/lambdagem/help/all.md +0 -11
  64. data/vendor/lambdagem/lib/lambdagem/help/build.md +0 -14
  65. data/vendor/lambdagem/lib/lambdagem/help/clean.md +0 -5
  66. data/vendor/lambdagem/lib/lambdagem/help/extract_gem.md +0 -5
  67. data/vendor/lambdagem/lib/lambdagem/help/extract_ruby.md +0 -5
  68. data/vendor/lambdagem/lib/lambdagem/help/package.md +0 -20
  69. data/vendor/lambdagem/lib/lambdagem/help/upload.md +0 -7
  70. data/vendor/lambdagem/lib/lambdagem/package.rb +0 -33
  71. data/vendor/lambdagem/lib/lambdagem/upload.rb +0 -39
  72. data/vendor/lambdagem/lib/lambdagem/util.rb +0 -30
  73. data/vendor/lambdagem/lib/lambdagem/version.rb +0 -3
  74. data/vendor/lambdagem/spec/lib/build_spec.rb +0 -32
  75. data/vendor/lambdagem/spec/lib/cli_spec.rb +0 -24
  76. data/vendor/lambdagem/spec/lib/upload_spec.rb +0 -25
  77. data/vendor/lambdagem/spec/spec_helper.rb +0 -24
@@ -1,8 +0,0 @@
1
- module Lambdagem
2
- module Extract
3
- autoload :Base, "lambdagem/extract/base"
4
- #autoload :ClassMethods, "lambdagem/extract/class_methods"
5
- autoload :Gem, "lambdagem/extract/gem"
6
- autoload :Ruby, "lambdagem/extract/ruby"
7
- end
8
- end
@@ -1,50 +0,0 @@
1
- require "net/http"
2
-
3
- module Lambdagem::Extract::ClassMethods
4
- # Exits early if not all the linux gems are available
5
- # It better to error now then later on Lambda
6
- # Provide users with instructions on how to compile gems
7
- #
8
- # We check all the availability before even downloading so we can provide a
9
- # full list of gems they might want to research all at once instead of incrementally
10
- def check_availability(gems)
11
- availabilities = gems.inject({}) do |hash, gem_name|
12
- exist = url_exists?(gem_url(gem_name))
13
- hash[gem_name] = exist
14
- hash.merge(hash)
15
- end
16
-
17
- all_available = availabilities.values.all? {|v| v }
18
- unless all_available
19
- puts "Your project requires some pre-compiled Linux gems that are not yet available as a pre-compiled lambda gem. The build process will not continue because there's no point wasting your time deploying to Lambda and finding out later."
20
- puts "The unavailable gems are:"
21
- availabilities.each do |gem_name, available|
22
- next if available
23
- puts " #{gem_name}"
24
- end
25
- puts <<-EOL
26
- How to fix this:
27
-
28
- 1. Build your jets project on an Amazon Lambda based EC2 Instance and compile your own gems with the proper shared libaries.
29
- 2. Configure jets to lookup your own pre-compiled gems url.
30
- 3. Add the the required gems to boltopslabs/lambdagems and submit a pull request.
31
-
32
- More info: http://lambdagems.com
33
- EOL
34
- exit
35
- end
36
- end
37
-
38
- # Example url:
39
- # https://gems.lambdagems.com/gems/2.5.0/byebug/byebug-9.1.0-x86_64-linux.tgz
40
- def url_exists?(url)
41
- url = URI.parse(url)
42
- req = Net::HTTP.new(url.host, url.port).tap do |http|
43
- http.use_ssl = true
44
- end
45
- res = req.request_head(url.path)
46
- res.code == "200"
47
- rescue SocketError, OpenURI::HTTPError
48
- false
49
- end
50
- end
@@ -1,9 +0,0 @@
1
- module Lambdagem::Help
2
- class << self
3
- def text(namespaced_command)
4
- path = namespaced_command.to_s.gsub(':','/')
5
- path = File.expand_path("../help/#{path}.md", __FILE__)
6
- IO.read(path) if File.exist?(path)
7
- end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- Builds, packages and uploads the gem to s3 all in one step. This is useful for simply compiled gems that do not required any shared .so files during runtime.
2
-
3
- Examples:
4
-
5
- $ lambdagem all byebug --s3 lambdagems
6
-
7
- So the above command is the same as running:
8
-
9
- $ lambdagem build byebug
10
- $ lambdagem package byebug
11
- $ lambdagem upload byebug --s3 lambdagems
@@ -1,14 +0,0 @@
1
- Builds a gem. Examples:
2
-
3
- lambdagem build byebug
4
- lambdagem build byebug-0.9.1
5
-
6
- The lambdagem builds the gem in `/tmp/lambdagem`. This is where you'll find the Gemfile that is produces and where you can test the gem.
7
-
8
- A slim down version of `/tmp/lambdagem/bundled/gems` the is initial created in `/tmp/lambdagem/artifacts/byebug-0.9.1/bundled/gems`. This slim down version contains only the byebug gem files.
9
-
10
- When you are ready, the gem can be packaged to tarball with the `bundle package` command. The tarball is stored at:
11
-
12
- ```
13
- /tmp/lambdagem/artifacts/byebug-9.1.0-x86_64-linux.tar.gz
14
- ```
@@ -1,5 +0,0 @@
1
- Cleans out tmp/downloads cache.
2
-
3
- cd your_app_root
4
-
5
- $ lambdagem clean
@@ -1,5 +0,0 @@
1
- Downloads pre-compiled gem from s3 and extracts it with the same structure as Jets. Examples:
2
-
3
- cd your_app_root
4
-
5
- $ lambdagem extract_gem byebug-0.9.1
@@ -1,5 +0,0 @@
1
- Downloads pre-compiled ruby from s3 and extracts it with the same structure as Jets. Examples:
2
-
3
- cd your_app_root
4
-
5
- $ lambdagem extract_ruby 2.5.0
@@ -1,20 +0,0 @@
1
- Pakcages gem into a tarball. The tarball created is named after the gem name with version, but it contains the "bundled" folder with the underlying full structure.
2
-
3
- It is meant to be extracted via:
4
-
5
- mkdir -p /var/task
6
- tar zxf byebug-0.9.1.tgz -C /var/task
7
- # creates /var/task/bundled
8
-
9
- Same as:
10
-
11
- mkdir -p /var/task
12
- cd /var/task && tar zxf byebug-0.9.1.tgz
13
- # creates /var/task/bundled
14
-
15
- Examples:
16
-
17
- $ lambdagem package byebug
18
-
19
- $ lambdagem package byebug-0.9.1
20
-
@@ -1,7 +0,0 @@
1
- Uplaods the packaged tarball to s3. This expects the gem name and not the path to the tarball.
2
-
3
- Examples:
4
-
5
- $ lambdagem upload byebug
6
-
7
- $ lambdagem upload byebug-0.9.1
@@ -1,33 +0,0 @@
1
- class Lambdagem::Package < Lambdagem::Base
2
- def build
3
- # cd tmp/artifacts
4
- # tar czf byebug-9.1.0.tgz -C byebug-9.1.0 .
5
- command = "cd #{@artifacts_root} && tar czf #{tarball_name} -C #{full_gem_name} ."
6
- puts "=> #{command}"
7
- system(command)
8
- tarball_path = "#{@artifacts_root}/#{tarball_name}"
9
- puts "Tarball files: #{@artifacts_root}/#{full_gem_name}/bundled"
10
- puts "Tarball created: #{tarball_path.colorize(:green)}"
11
- puts "Tarball contains the bundled folder with the original path structure."
12
- puts "Extracting it out would produce: #{example_leaf_path}"
13
- end
14
-
15
- def example_leaf_path
16
- # quicker to get the example leaf path using build_root
17
- leaf_path = Dir.glob("#{@build_root}/bundled/gems/ruby/*/gems/#{full_gem_name}").first
18
- leaf_path.sub("#{@build_root}/", "") + ' ...'
19
- end
20
-
21
- def tarball_name
22
- "#{full_gem_name}-#{RUBY_PLATFORM}.tgz"
23
- end
24
-
25
- # Since user can build without the version number.
26
- # check file system for actual gem that was produced to get the version number.
27
- def full_gem_name
28
- path = Dir.glob("#{@artifacts_root}/#{@name}*").select do |path|
29
- File.directory?(path)
30
- end.first
31
- full_gem_name = File.basename(path)
32
- end
33
- end
@@ -1,39 +0,0 @@
1
- require 'aws-sdk-s3'
2
-
3
- class Lambdagem::Upload < Lambdagem::Base
4
- def upload
5
- # s3_path: s3://boltops-gems/gems/2.4.1/byebug/byebug-9.1.0-x86_64-darwin16.tar.gz
6
- puts "Uploading #{tarball_path.inspect} to #{s3_path(tarball_path)}"
7
-
8
- # raise "Not uploading because on macosx" if RUBY_PLATFORM =~ /darwin/ && !ENV['LAMBDAGEM_MAC_TEST']
9
- # return if ENV['TEST']
10
-
11
- key = s3_key(tarball_path)
12
- obj = s3_resource.bucket(@s3_bucket).object(key)
13
- # use LAMBDAGEM_S3_ACL=private to make private
14
- acl = ENV['LAMBDAGEM_S3_ACL'] || "public-read" # default
15
- obj.upload_file(tarball_path, acl: acl)
16
- end
17
-
18
- def tarball_path
19
- path = Dir.glob("#{@artifacts_root}/#{@name}*-#{RUBY_PLATFORM}.tgz").select do |path|
20
- File.file?(path)
21
- end.first
22
- end
23
-
24
- def s3_path(tarball_path)
25
- "s3://#{@s3_bucket}/#{s3_key(tarball_path)}"
26
- end
27
-
28
- # Example tarball_path: tmp/artifacts/pg-0.21.0/pg-0.21.0-x86_64-linux.tgz
29
- def s3_key(tarball_path)
30
- tarball = File.basename(tarball_path)
31
- gem_folder = tarball.gsub(/-\d+\.\d+\.\d+.*/,'')
32
- full_gem_name = tarball.sub(/-x86_.*/,'') # -x86_...
33
- "gems/#{RUBY_VERSION}/#{gem_folder}/#{tarball}"
34
- end
35
-
36
- def s3_resource
37
- @s3_resource ||= Aws::S3::Resource.new
38
- end
39
- end
@@ -1,30 +0,0 @@
1
- # Can use this a few ways, examples:
2
- #
3
- # Directly usage:
4
- #
5
- # Lambdagem::Util.say("hi")
6
- #
7
- # Include it in your class:
8
- #
9
- # class MyClass
10
- # include Lambdagem::Util
11
- #
12
- # def some_meth
13
- # say "some_meth"
14
- # end
15
- # end
16
- #
17
- module Lambdagem
18
- module Util
19
- @@log_level = :debug
20
- def log_level=(val)
21
- @@log_level = val
22
- end
23
-
24
- def say(message, level=:info)
25
- enabled = @@log_level == :debug || level == :debug
26
- puts(message) if enabled
27
- end
28
- extend self
29
- end
30
- end
@@ -1,3 +0,0 @@
1
- module Lambdagem
2
- VERSION = "0.5.1"
3
- end
@@ -1,32 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Lambdagem::Build do
4
- let(:builder) do
5
- Lambdagem::Build.new(gem, s3: "lambdagems")
6
- end
7
-
8
- context("gem with version number") do
9
- let(:gem) { "byebug-9.1.0" }
10
-
11
- it "gem info" do
12
- expect(builder.gem_name).to eq "byebug"
13
- expect(builder.gem_version).to eq "9.1.0"
14
- end
15
- end
16
-
17
- context("gem without version number") do
18
- let(:gem) { "byebug" }
19
-
20
- it "gem info" do
21
- expect(builder.gem_name).to eq "byebug"
22
- expect(builder.gem_version).to eq nil
23
- end
24
-
25
- it "create_gemfile" do
26
- builder.create_gemfile
27
- content = IO.read("/tmp/lambdagem/Gemfile")
28
- expect(content).to include("byebug")
29
- expect(content).not_to include("9.1.0")
30
- end
31
- end
32
- end
@@ -1,24 +0,0 @@
1
- require "spec_helper"
2
-
3
- # to run specs with what"s remembered from vcr
4
- # $ rake
5
- #
6
- # to run specs with new fresh data from aws api calls
7
- # $ rake clean:vcr ; time rake
8
- describe Lambdagem::CLI do
9
- before(:all) do
10
- @args = "--noop"
11
- end
12
-
13
- describe "lambdagem" do
14
- it "build" do
15
- out = execute("exe/lambdagem build byebug-10.0.0 #{@args}")
16
- expect(out).to include("Building")
17
- end
18
-
19
- it "extract" do
20
- out = execute("exe/lambdagem extract_gem byebug-10.0.0 #{@args}")
21
- expect(out).to include("Looking for byebug")
22
- end
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Lambdagem::Upload do
4
- let(:uploader) do
5
- Lambdagem::Upload.new(gem, s3: "lambdagems")
6
- end
7
-
8
- context("gem with version number") do
9
- let(:gem) { "byebug-9.1.0" }
10
-
11
- it "s3_path" do
12
- s3_path = uploader.s3_path("tmp/gems/ruby/byebug-9.1.0-x86_64-darwin16.tar.gz")
13
- expect(s3_path).to eq "s3://lambdagems/gems/2.5.1/byebug/byebug-9.1.0-x86_64-darwin16.tar.gz"
14
- end
15
- end
16
-
17
- context("gem without version number") do
18
- let(:gem) { "byebug" }
19
-
20
- it "s3_path" do
21
- s3_path = uploader.s3_path("tmp/gems/ruby/byebug-9.1.0-x86_64-darwin16.tar.gz")
22
- expect(s3_path).to eq "s3://lambdagems/gems/2.5.1/byebug/byebug-9.1.0-x86_64-darwin16.tar.gz"
23
- end
24
- end
25
- end
@@ -1,24 +0,0 @@
1
- ENV["TEST"] = "1"
2
- # Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
3
- ENV['HOME'] = "spec/fixtures/home"
4
-
5
- # require "simplecov"
6
- # SimpleCov.start
7
-
8
- require "pp"
9
-
10
- root = File.expand_path("../../", __FILE__)
11
- require "#{root}/lib/lambdagem"
12
-
13
- module Helpers
14
- def execute(cmd)
15
- puts "Running: #{cmd}" if ENV["DEBUG"]
16
- out = `#{cmd}`
17
- puts out if ENV["DEBUG"]
18
- out
19
- end
20
- end
21
-
22
- RSpec.configure do |c|
23
- c.include Helpers
24
- end