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.
- checksums.yaml +4 -4
- data/.gitmodules +3 -3
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +23 -1
- data/jets.gemspec +1 -2
- data/lib/jets.rb +5 -11
- data/lib/jets/builders/gem_replacer.rb +12 -96
- data/lib/jets/builders/ruby_packager.rb +3 -4
- data/lib/jets/builders/tidy.rb +9 -0
- data/lib/jets/commands.rb +1 -0
- data/lib/jets/commands/base.rb +10 -1
- data/lib/jets/commands/gems.rb +25 -0
- data/lib/jets/commands/help/gems/check.md +7 -0
- data/lib/jets/commands/help/import/rails.md +3 -3
- data/lib/jets/commands/import.rb +4 -0
- data/lib/jets/commands/import/base.rb +10 -0
- data/lib/jets/commands/import/cheatsheet.rb +35 -0
- data/lib/jets/commands/import/rail.rb +7 -0
- data/lib/jets/commands/import/sequence.rb +63 -47
- data/lib/jets/commands/import/templates/submodules-cheatsheet.md +89 -0
- data/lib/jets/db.rb +9 -0
- data/lib/jets/version.rb +1 -1
- data/vendor/jets-gems/Gemfile +6 -0
- data/vendor/jets-gems/Gemfile.lock +39 -0
- data/vendor/jets-gems/LICENSE.txt +21 -0
- data/vendor/jets-gems/README.md +19 -0
- data/vendor/{lambdagem → jets-gems}/Rakefile +2 -2
- data/vendor/jets-gems/bin/console +14 -0
- data/vendor/jets-gems/bin/setup +8 -0
- data/vendor/jets-gems/jets-gems.gemspec +30 -0
- data/vendor/jets-gems/lib/jets-gems.rb +1 -0
- data/vendor/jets-gems/lib/jets/gems.rb +16 -0
- data/vendor/jets-gems/lib/jets/gems/check.rb +156 -0
- data/vendor/jets-gems/lib/jets/gems/exist.rb +54 -0
- data/vendor/jets-gems/lib/jets/gems/extract.rb +7 -0
- data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/base.rb +25 -6
- data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/gem.rb +10 -8
- data/vendor/{lambdagem/lib/lambdagem → jets-gems/lib/jets/gems}/extract/ruby.rb +6 -7
- data/vendor/jets-gems/lib/jets/gems/report.rb +53 -0
- data/vendor/jets-gems/lib/jets/gems/version.rb +5 -0
- data/vendor/jets-gems/spec/jets/gems_spec.rb +5 -0
- data/vendor/jets-gems/spec/spec_helper.rb +14 -0
- metadata +41 -53
- data/vendor/lambdagem/CHANGELOG.md +0 -27
- data/vendor/lambdagem/Gemfile +0 -6
- data/vendor/lambdagem/Gemfile.lock +0 -73
- data/vendor/lambdagem/Guardfile +0 -12
- data/vendor/lambdagem/LICENSE.txt +0 -22
- data/vendor/lambdagem/README.md +0 -139
- data/vendor/lambdagem/exe/lambdagem +0 -14
- data/vendor/lambdagem/lambdagem.gemspec +0 -32
- data/vendor/lambdagem/lib/lambdagem.rb +0 -18
- data/vendor/lambdagem/lib/lambdagem/base.rb +0 -53
- data/vendor/lambdagem/lib/lambdagem/build.rb +0 -202
- data/vendor/lambdagem/lib/lambdagem/clean.rb +0 -8
- data/vendor/lambdagem/lib/lambdagem/cli.rb +0 -62
- data/vendor/lambdagem/lib/lambdagem/command.rb +0 -38
- data/vendor/lambdagem/lib/lambdagem/exist.rb +0 -50
- data/vendor/lambdagem/lib/lambdagem/extract.rb +0 -8
- data/vendor/lambdagem/lib/lambdagem/extract/class_methods.rb +0 -50
- data/vendor/lambdagem/lib/lambdagem/help.rb +0 -9
- data/vendor/lambdagem/lib/lambdagem/help/all.md +0 -11
- data/vendor/lambdagem/lib/lambdagem/help/build.md +0 -14
- data/vendor/lambdagem/lib/lambdagem/help/clean.md +0 -5
- data/vendor/lambdagem/lib/lambdagem/help/extract_gem.md +0 -5
- data/vendor/lambdagem/lib/lambdagem/help/extract_ruby.md +0 -5
- data/vendor/lambdagem/lib/lambdagem/help/package.md +0 -20
- data/vendor/lambdagem/lib/lambdagem/help/upload.md +0 -7
- data/vendor/lambdagem/lib/lambdagem/package.rb +0 -33
- data/vendor/lambdagem/lib/lambdagem/upload.rb +0 -39
- data/vendor/lambdagem/lib/lambdagem/util.rb +0 -30
- data/vendor/lambdagem/lib/lambdagem/version.rb +0 -3
- data/vendor/lambdagem/spec/lib/build_spec.rb +0 -32
- data/vendor/lambdagem/spec/lib/cli_spec.rb +0 -24
- data/vendor/lambdagem/spec/lib/upload_spec.rb +0 -25
- data/vendor/lambdagem/spec/spec_helper.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9682b366c1e6cff9d63140310ff2c32d0a132996f1383ad2d1381a43952e3fd
|
4
|
+
data.tar.gz: 128f7f3d161210124c8c551ca9b0cc1d45b9050d92d80aa9294d66512eaf1e70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4455ad5c44a56286a1f7a5572afa27e0d3119d5822e2bea2f1bbc5f30493a0da397a92ad8724eecdbae17c4dda76dc0475a5e1013a23f0257ef4cb31d21c7387
|
7
|
+
data.tar.gz: 52122940d1a971055d18d36632d828823349340b311c1b2b76e3dd5e0da0d4e0268078c6f48704115724e6cd44217ab5c1e7aa3fe99ebd40f44178a874312414
|
data/.gitmodules
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[submodule "vendor/lambdagem"]
|
2
|
-
path = vendor/lambdagem
|
3
|
-
url = https://github.com/tongueroo/lambdagem.git
|
4
1
|
[submodule "vendor/dynomite"]
|
5
2
|
path = vendor/dynomite
|
6
3
|
url = https://github.com/tongueroo/dynomite.git
|
4
|
+
[submodule "vendor/jets-gems"]
|
5
|
+
path = vendor/jets-gems
|
6
|
+
url = https://github.com/tongueroo/jets-gems
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.2]
|
7
|
+
- jets import:rails --submodule option. pull request #54 from tongueroo/import
|
8
|
+
- upgrade to jets-gems. pull request #53 from tongueroo/gems
|
9
|
+
- jets gems:check command
|
10
|
+
- jets gems:sources hidden command
|
11
|
+
|
6
12
|
## [1.0.1]
|
7
13
|
- jets upgrade:v1 command
|
8
14
|
- Merge pull request #52 from tongueroo/upgrade-command
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -23,6 +23,21 @@ The official documentation is at: [Ruby on Jets](http://rubyonjets.com).
|
|
23
23
|
|
24
24
|
Refer to the official docs for more info, but here's a quick intro.
|
25
25
|
|
26
|
+
### Jets Functions
|
27
|
+
|
28
|
+
Jets supports writing AWS Lambda functions with Ruby. You define them in the `app/functions` folder. A function looks like this:
|
29
|
+
|
30
|
+
app/functions/simple.rb:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
def handle(event, context)
|
34
|
+
puts "hello world"
|
35
|
+
{hello: "world"}
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
Though simple functions are supported by Jets, aside from the ability to use Ruby, they do not as much value as other ways to write code with Jets.
|
40
|
+
|
26
41
|
### Jets Controllers
|
27
42
|
|
28
43
|
A Jets controller handles a web request and renders a response. Here's an example:
|
@@ -115,6 +130,10 @@ After deployment, you can test the Lambda functions with the AWS Lambda console
|
|
115
130
|
|
116
131
|
Here's a [Live Demo](https://demo.rubyonjets.com/posts) of the quintessential CRUD Jets app.
|
117
132
|
|
133
|
+
### Rails Support
|
134
|
+
|
135
|
+
Jets [Mega Mode](http://rubyonjets.com/docs/megamode/) provides Rails support with little effort. This allows you run a Rails application on AWS Lambda. Refer to the [Rails Support](http://rubyonjets.com/docs/rails-support/) docs for more info.
|
136
|
+
|
118
137
|
### More Info
|
119
138
|
|
120
139
|
For more documentation, check out the official docs: [Ruby on Jets](http://rubyonjets.com/). Here's a list of useful links:
|
@@ -127,15 +146,18 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
|
|
127
146
|
* [App Configuration](http://rubyonjets.com/app-config/)
|
128
147
|
* [Database Support](http://rubyonjets.com/docs/database-support/)
|
129
148
|
* [Polymorphic Support](http://rubyonjets.com/docs/polymorphic-support/)
|
149
|
+
* [Rails Support](http://rubyonjets.com/docs/rails-support/)
|
130
150
|
* [Tutorials](http://rubyonjets.com/docs/tutorials/)
|
131
151
|
* [Prewarming](http://rubyonjets.com/docs/prewarming/)
|
152
|
+
* [Custom Resources](http://rubyonjets.com/docs/associated-resources/)
|
153
|
+
* [Shared Resources](http://rubyonjets.com/docs/shared-resources/)
|
132
154
|
* [Installation](http://rubyonjets.com/docs/install/)
|
133
155
|
* [CLI Reference](http://rubyonjets.com/reference/)
|
134
156
|
* [Contributing](http://rubyonjets.com/docs/contributing/)
|
135
157
|
* [Support Jets](http://rubyonjets.com/support-jets/)
|
136
158
|
* [Example Projects](https://github.com/tongueroo/jets-examples)
|
137
159
|
|
138
|
-
##
|
160
|
+
## Learning Content
|
139
161
|
|
140
162
|
* [Introducing Jets: A Ruby Serverless Framework](https://blog.boltops.com/2018/08/18/introducing-jets-a-ruby-serverless-framework)
|
141
163
|
* [AWS Lambda Ruby Support at Native Speed with Jets](https://blog.boltops.com/2018/09/02/aws-lambda-ruby-support-at-native-speed-with-jets)
|
data/jets.gemspec
CHANGED
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_dependency "aws-sdk-sns"
|
40
40
|
spec.add_dependency "colorize"
|
41
41
|
spec.add_dependency "dotenv"
|
42
|
+
spec.add_dependency "gems" # jets-gems dependency
|
42
43
|
spec.add_dependency "hashie"
|
43
44
|
spec.add_dependency "json"
|
44
45
|
spec.add_dependency "kramdown"
|
@@ -50,8 +51,6 @@ Gem::Specification.new do |spec|
|
|
50
51
|
spec.add_dependency "text-table"
|
51
52
|
spec.add_dependency "thor"
|
52
53
|
|
53
|
-
spec.add_dependency "gems" # lambdagem dependency
|
54
|
-
|
55
54
|
spec.add_development_dependency "byebug"
|
56
55
|
spec.add_development_dependency "bundler"
|
57
56
|
spec.add_development_dependency "rake"
|
data/lib/jets.rb
CHANGED
@@ -8,7 +8,7 @@ require "fileutils"
|
|
8
8
|
require "memoist"
|
9
9
|
|
10
10
|
module Jets
|
11
|
-
# When we update Jets::RUBY_VERSION, need to update
|
11
|
+
# When we update Jets::RUBY_VERSION, need to update jets-gems/base.rb: def jets_ruby_version also
|
12
12
|
RUBY_VERSION = "2.5.0"
|
13
13
|
|
14
14
|
autoload :Application, "jets/application"
|
@@ -22,6 +22,7 @@ module Jets
|
|
22
22
|
autoload :Commands, "jets/commands"
|
23
23
|
autoload :Controller, 'jets/controller'
|
24
24
|
autoload :Core, "jets/core"
|
25
|
+
autoload :Db, 'jets/db'
|
25
26
|
autoload :Dotenv, 'jets/dotenv'
|
26
27
|
autoload :Erb, "jets/erb"
|
27
28
|
autoload :Generator, "jets/generator"
|
@@ -52,9 +53,8 @@ end
|
|
52
53
|
|
53
54
|
require "jets/core_ext/kernel"
|
54
55
|
|
55
|
-
$:.unshift(File.expand_path("../../vendor/
|
56
|
-
require "
|
57
|
-
require "gems" # lambdagem dependency
|
56
|
+
$:.unshift(File.expand_path("../../vendor/jets-gems/lib", __FILE__))
|
57
|
+
require "jets-gems"
|
58
58
|
|
59
59
|
# lazy loaded dependencies: depends what project. Mainly determined by Gemfile
|
60
60
|
# and config files.
|
@@ -63,10 +63,4 @@ if File.exist?("#{Jets.root}config/dynamodb.yml")
|
|
63
63
|
require "dynomite"
|
64
64
|
end
|
65
65
|
|
66
|
-
#
|
67
|
-
# TODO: move require "pg" into loader class and abstract to support more gems
|
68
|
-
if File.exist?("#{Jets.root}config/database.yml")
|
69
|
-
require "active_record"
|
70
|
-
require "pg" if Gem.loaded_specs.has_key?('pg')
|
71
|
-
require "mysql2" if Gem.loaded_specs.has_key?('mysql2')
|
72
|
-
end
|
66
|
+
Jets::Db # trigger autoload
|
@@ -1,88 +1,35 @@
|
|
1
|
-
# def extract_gems
|
2
|
-
# headline "Replacing compiled gems with Lambda Linux versions."
|
3
|
-
# Lambdagem::Extract::Gem.new(Jets::RUBY_VERSION,
|
4
|
-
# s3: "lambdagems",
|
5
|
-
# dest: full(cache_area),
|
6
|
-
# ).run
|
7
|
-
# end
|
8
1
|
class Jets::Builders
|
9
2
|
class GemReplacer
|
10
3
|
extend Memoist
|
11
|
-
attr_reader :missing_gems
|
12
4
|
def initialize(ruby_version, options)
|
13
5
|
@ruby_version = ruby_version
|
14
6
|
@options = options
|
15
|
-
@missing_gems = [] # keeps track of gems that are not found in any of the lambdagems sources
|
16
7
|
end
|
17
8
|
|
18
9
|
def run
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
found_gems = {}
|
29
|
-
compiled_gems.each do |gem_name|
|
30
|
-
gem_exists = false
|
31
|
-
Jets.config.lambdagems.sources.each do |source|
|
32
|
-
exist = Lambdagem::Exist.new(lambdagems_url: source)
|
33
|
-
found = exist.check(gem_name)
|
34
|
-
# gem exists on at least of the lambdagem sources
|
35
|
-
if found
|
36
|
-
gem_exists = true
|
37
|
-
found_gems[gem_name] = source
|
38
|
-
break
|
39
|
-
end
|
40
|
-
end
|
41
|
-
unless gem_exists
|
42
|
-
@missing_gems << gem_name
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Exits early if not all the linux gems are available.
|
47
|
-
# It better to error now than deploy a broken package to AWS Lambda.
|
48
|
-
# Provide users with message about using their own lambdagems source.
|
49
|
-
unless @missing_gems.empty?
|
50
|
-
puts missing_gems_message
|
10
|
+
check = Jets::Gems::Check.new
|
11
|
+
found_gems = check.run
|
12
|
+
if check.missing?
|
13
|
+
# Exits early if not all the linux gems are available.
|
14
|
+
# Better to error now than deploy a broken package to AWS Lambda.
|
15
|
+
# Provide users with message about using their own lambdagems source.
|
16
|
+
puts check.missing_message
|
17
|
+
Jets::Gems::Report.missing(check.missing_gems)
|
51
18
|
exit 1
|
52
19
|
end
|
53
20
|
|
54
|
-
# Reaching here means
|
55
|
-
Lambdagem.log_level = :info
|
21
|
+
# Reaching here means its safe to download and extract the gems
|
56
22
|
found_gems.each do |gem_name, source|
|
57
|
-
|
23
|
+
options = @options.merge(source_url: source)
|
24
|
+
gem_extractor = Jets::Gems::Extract::Gem.new(gem_name, options)
|
58
25
|
gem_extractor.run
|
59
26
|
end
|
60
27
|
|
61
28
|
tidy
|
62
29
|
end
|
63
30
|
|
64
|
-
def
|
65
|
-
template = <<-EOL
|
66
|
-
Your project requires compiled gems were not available in any of your lambdagems sources. Unavailable pre-compiled gems:
|
67
|
-
<% missing_gems.each do |gem| %>
|
68
|
-
* <%= gem -%>
|
69
|
-
<% end %>
|
70
|
-
|
71
|
-
Your current lambdagems sources:
|
72
|
-
<% Jets.config.lambdagems.sources.map do |source| %>
|
73
|
-
* <%= source -%>
|
74
|
-
<% end %>
|
75
|
-
|
76
|
-
Jets is unable to build a deployment package that will work on AWS Lambda without the required pre-compiled gems. To remedy this, you can:
|
77
|
-
|
78
|
-
* Build the gem yourself and add it to your own custom lambdagems sources. Refer to the Lambda Gems Docs: http://rubyonjets.com/docs/lambdagems
|
79
|
-
* Wait until it added to lambdagems.com. No need to report this to us, as we've already been notified.
|
80
|
-
* Use another gem that does not require compilation.
|
31
|
+
def report_missing_gems
|
81
32
|
|
82
|
-
Compiled gems usually take some time to figure out how to build as they each depend on different libraries and packages. We make an effort add new gems as soon as we can.
|
83
|
-
EOL
|
84
|
-
erb = ERB.new(template, nil, '-') # trim mode https://stackoverflow.com/questions/4632879/erb-template-removing-the-trailing-line
|
85
|
-
erb.result(binding)
|
86
33
|
end
|
87
34
|
|
88
35
|
# remove unnecessary files to reduce package size
|
@@ -120,36 +67,5 @@ EOL
|
|
120
67
|
end
|
121
68
|
end
|
122
69
|
end
|
123
|
-
|
124
|
-
# If there are subfolders compiled_gem_paths might have files deeper
|
125
|
-
# in the directory tree. So lets grab the gem name and figure out the
|
126
|
-
# unique paths of the compiled gems from there.
|
127
|
-
def compiled_gems
|
128
|
-
compiled_gem_paths.map { |p| gem_name_from_path(p) }.uniq# + ["whatever-0.0.1"]
|
129
|
-
end
|
130
|
-
memoize :compiled_gems
|
131
|
-
|
132
|
-
# Use pre-compiled gem because the gem could have development header shared
|
133
|
-
# object file dependencies. The shared dependencies are packaged up as part
|
134
|
-
# of the pre-compiled gem so it is available in the Lambda execution environment.
|
135
|
-
#
|
136
|
-
# Example paths:
|
137
|
-
# Macosx:
|
138
|
-
# bundled/gems/ruby/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/nokogiri-1.8.1
|
139
|
-
# bundled/gems/ruby/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/byebug-9.1.0
|
140
|
-
# Official AWS Lambda Linux AMI:
|
141
|
-
# bundled/gems/ruby/2.5.0/extensions/x86_64-linux/2.5.0-static/nokogiri-1.8.1
|
142
|
-
# Circleci Ubuntu based Linux:
|
143
|
-
# bundled/gems/ruby/2.5.0/extensions/x86_64-linux/2.5.0/pg-0.21.0
|
144
|
-
def compiled_gem_paths
|
145
|
-
Dir.glob("#{Jets.build_root}/cache/bundled/gems/ruby/*/extensions/**/**/*.{so,bundle}")
|
146
|
-
end
|
147
|
-
|
148
|
-
# Input: bundled/gems/ruby/2.5.0/extensions/x86_64-darwin-16/2.5.0-static/byebug-9.1.0
|
149
|
-
# Output: byebug-9.1.0
|
150
|
-
def gem_name_from_path(path)
|
151
|
-
regexp = /gems\/ruby\/\d+\.\d+\.\d+\/extensions\/.*?\/.*?\/(.*?)\//
|
152
|
-
gem_name = path.match(regexp)[1]
|
153
|
-
end
|
154
70
|
end
|
155
71
|
end
|
@@ -161,7 +161,7 @@ EOL
|
|
161
161
|
IO.write(bundle_config, text)
|
162
162
|
end
|
163
163
|
|
164
|
-
def
|
164
|
+
def gems_options
|
165
165
|
{
|
166
166
|
s3: "lambdagems",
|
167
167
|
build_root: cache_area, # used in lambdagem
|
@@ -171,13 +171,12 @@ EOL
|
|
171
171
|
|
172
172
|
def extract_ruby
|
173
173
|
headline "Setting up a vendored copy of ruby."
|
174
|
-
|
175
|
-
Lambdagem::Extract::Ruby.new(Jets::RUBY_VERSION, lambdagem_options).run
|
174
|
+
Jets::Gems::Extract::Ruby.new(Jets::RUBY_VERSION, gems_options).run
|
176
175
|
end
|
177
176
|
|
178
177
|
def extract_gems
|
179
178
|
headline "Replacing compiled gems with AWS Lambda Linux compiled versions."
|
180
|
-
GemReplacer.new(Jets::RUBY_VERSION,
|
179
|
+
GemReplacer.new(Jets::RUBY_VERSION, gems_options).run
|
181
180
|
end
|
182
181
|
|
183
182
|
def copy_bundled_cache
|
data/lib/jets/builders/tidy.rb
CHANGED
@@ -57,6 +57,15 @@ class Jets::Builders
|
|
57
57
|
|
58
58
|
rm_rf(path)
|
59
59
|
end
|
60
|
+
|
61
|
+
remove_gem_cache
|
62
|
+
end
|
63
|
+
|
64
|
+
# Reason do not remove the cache folder generally is because some gems have
|
65
|
+
# actual cache folders that they used.
|
66
|
+
def remove_gem_cache
|
67
|
+
ruby_minor_version = Jets::RUBY_VERSION.split('.')[0..1].join('.') + '.0'
|
68
|
+
FileUtils.rm_rf("#{@project_root}/bundled/gems/ruby/#{ruby_minor_version}/cache")
|
60
69
|
end
|
61
70
|
|
62
71
|
def rm_rf(path)
|
data/lib/jets/commands.rb
CHANGED
@@ -9,6 +9,7 @@ module Jets::Commands
|
|
9
9
|
autoload :Delete, "jets/commands/delete"
|
10
10
|
autoload :Deploy, "jets/commands/deploy"
|
11
11
|
autoload :Dynamodb, "jets/commands/dynamodb"
|
12
|
+
autoload :Gems, 'jets/commands/gems'
|
12
13
|
autoload :Help, "jets/commands/help"
|
13
14
|
autoload :Import, "jets/commands/import"
|
14
15
|
autoload :Main, "jets/commands/main"
|
data/lib/jets/commands/base.rb
CHANGED
@@ -63,7 +63,7 @@ class Jets::Commands::Base < Thor
|
|
63
63
|
.sub(/\.rb$/,'')
|
64
64
|
.sub(%r{.*/jets/commands}, 'jets/commands')
|
65
65
|
.classify
|
66
|
-
class_name
|
66
|
+
class_name = special_class_map(class_name)
|
67
67
|
# NOTE: Weird thing where Jets::Commands::Db::Task => Thor::Command
|
68
68
|
# because Task is a class available to Thor I believe.
|
69
69
|
# puts "eager_load! loading path: #{path} class_name: #{class_name}" if ENV['JETS_DEBUG']
|
@@ -124,10 +124,19 @@ class Jets::Commands::Base < Thor
|
|
124
124
|
else
|
125
125
|
class_name = namespace.gsub(':','/')
|
126
126
|
class_name = "Jets::Commands::#{class_name.classify}"
|
127
|
+
class_name = special_class_map(class_name)
|
127
128
|
class_name.constantize
|
128
129
|
end
|
129
130
|
end
|
130
131
|
|
132
|
+
def special_class_map(class_name)
|
133
|
+
map = {
|
134
|
+
'Jets::Commands::RakeTask' => 'Jets::Commands::RakeTasks',
|
135
|
+
'Jets::Commands::Gem' => 'Jets::Commands::Gems',
|
136
|
+
}
|
137
|
+
map[class_name] || class_name
|
138
|
+
end
|
139
|
+
|
131
140
|
# If this fails to find a match then return the original full command
|
132
141
|
def autocomplete(full_command)
|
133
142
|
return nil if full_command.nil? # jets help
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Jets::Commands
|
2
|
+
class Gems < Jets::Commands::Base
|
3
|
+
desc "check", "Check if pre-built Lambda gems are available from the sources"
|
4
|
+
long_desc Help.text("gems:check")
|
5
|
+
def check
|
6
|
+
check = Jets::Gems::Check.new(cli: true)
|
7
|
+
check.run
|
8
|
+
if check.missing?
|
9
|
+
puts check.missing_message
|
10
|
+
Jets::Gems::Report.missing(check.missing_gems)
|
11
|
+
else
|
12
|
+
puts "Congrats! All gems are available in as pre-built Lambda gems 👍"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "sources", "List configured sources", hide: true
|
17
|
+
long_desc Help.text("gems:sources")
|
18
|
+
def sources
|
19
|
+
puts "Your pre-built lambda gem sources are:"
|
20
|
+
Jets.config.lambdagems.sources.each do |source|
|
21
|
+
puts " #{source}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,10 +2,10 @@ Imports a Rails application into a Jets project and configures it for [Mega Mode
|
|
2
2
|
|
3
3
|
## Example
|
4
4
|
|
5
|
-
jets import:rails http://github.com/tongueroo/
|
5
|
+
jets import:rails http://github.com/tongueroo/demo-rails.git
|
6
6
|
|
7
7
|
## More Examples
|
8
8
|
|
9
|
-
jets import:rails tongueroo/
|
10
|
-
jets import:rails git@github.com:tongueroo/
|
9
|
+
jets import:rails tongueroo/demo-rails # expands to github
|
10
|
+
jets import:rails git@github.com:tongueroo/demo-rails.git
|
11
11
|
jets import:rails /path/to/folder/jets-examples-rails
|
data/lib/jets/commands/import.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
module Jets::Commands
|
2
2
|
class Import < Jets::Commands::Base
|
3
3
|
autoload :Base, 'jets/commands/import/base'
|
4
|
+
autoload :Cheatsheet, 'jets/commands/import/cheatsheet'
|
4
5
|
autoload :Rack, 'jets/commands/import/rack'
|
5
6
|
autoload :Rail, 'jets/commands/import/rail'
|
6
7
|
autoload :Sequence, 'jets/commands/import/sequence'
|
7
8
|
|
9
|
+
Jets::Commands::Import::Base.cli_options.each do |args|
|
10
|
+
class_option(*args)
|
11
|
+
end
|
8
12
|
long_desc Help.text('import:rails')
|
9
13
|
register(Jets::Commands::Import::Rail, "rails", "rails", "Imports rails project in the rack subfolder")
|
10
14
|
|
@@ -1,5 +1,15 @@
|
|
1
1
|
class Jets::Commands::Import
|
2
2
|
class Base < Sequence
|
3
|
+
# Ugly, but when the class_option is only defined in the Thor::Group class
|
4
|
+
# it doesnt show up with jets new help :(
|
5
|
+
# If anyone knows how to fix this let me know.
|
6
|
+
def self.cli_options
|
7
|
+
[
|
8
|
+
[:submodule, type: :boolean, default: false, desc: "Imports the project as a submodule"],
|
9
|
+
]
|
10
|
+
end
|
11
|
+
cli_options.each { |args| class_option(*args) }
|
12
|
+
|
3
13
|
# Since setup is public it will automatically run in the subclasses
|
4
14
|
def setup
|
5
15
|
start_message
|