rumbda 0.2.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: 00cad3915deb4ba4e1b7c70afec9bd6f48f94245
4
- data.tar.gz: a9679dde4a6e41d129c3bb05a349f137b2ae5946
3
+ metadata.gz: bee1aed26ff8b5a992de1babad49ec150b8f5f6d
4
+ data.tar.gz: d9783a813ebf8ed9d1f2b7306eccedb97db73ed6
5
5
  SHA512:
6
- metadata.gz: dfaf98190c916760eb5367446fb1c0abf008996662ef1d0c0f26ef2ddf504c0fa4e08ffed91a6a48a8d2d9943724d638c3bd14f0cac499d231ff8fce1dbeb9ff
7
- data.tar.gz: fdb88aaa80c75b507e07576ca6c0e92c473c286303b9215b64c1e897005153f5edcf199e1394431e9b9b5016409ba84b1707771d5d04cf1a51293d8d39ebb850
6
+ metadata.gz: 6e4f3d10e848a83f1dfe2b427538d6935a60ec4135ab3e7e6b009d821832f19192ea8f6609680cdcccb2a605453e6d46997370d0281d11653c92ec1a4f4167f8
7
+ data.tar.gz: 6add15aa81a4183d15bd1b627e16b01b82d862f5961ffd583830f2d6c0e7661ab325a66aa8cc82869bf01c003e0f1321461392e8f026c3c65695d0703c657207
data/bin/rumbda CHANGED
@@ -5,11 +5,14 @@ require 'rumbda'
5
5
  class RumbdaCLI < Thor
6
6
  desc 'build', 'Builds the zip file for lambda.'
7
7
  method_option 'cleanup', type: :boolean, aliases: '-c'
8
- def build(dir_to_build = FileUtils.pwd)
9
- Rumbda::Build.run(dir_to_build, options)
8
+ def build
9
+ Rumbda::Build.run(FileUtils.pwd, options)
10
10
  end
11
11
 
12
- private
12
+ desc 'init', 'Sets up the current directory as a rumbda project (creates `source/main.rb`, `.ruby-version`, `Gemfile`, and `.gitignore`).'
13
+ def init
14
+ Rumbda::Init.run(FileUtils.pwd)
15
+ end
13
16
 
14
17
  map '-v' => :version, '--version' => :version
15
18
  desc '-v (--version)', 'Outputs the version of rumbda.'
@@ -15,7 +15,9 @@ module Rumbda
15
15
 
16
16
  FileUtils.mkdir_p(dest_source_code_dir)
17
17
  FileUtils.mkdir_p(vendor_dir)
18
- FileUtils.cp_r(Dir.glob(File.join(dir_to_build, '*')) - [temp_dir], dest_source_code_dir)
18
+ FileUtils.cp_r(Dir.glob(File.join(dir_to_build, 'source', '*')), dest_source_code_dir)
19
+ FileUtils.cp_r(File.join(dir_to_build, 'Gemfile'), dest_source_code_dir)
20
+ FileUtils.cp_r(File.join(dir_to_build, 'Gemfile.lock'), dest_source_code_dir)
19
21
  FileUtils.mv(File.join(dest_source_code_dir, 'Gemfile'), vendor_dir)
20
22
  FileUtils.mv(File.join(dest_source_code_dir, 'Gemfile.lock'), vendor_dir)
21
23
 
@@ -119,17 +121,14 @@ module Rumbda
119
121
  end
120
122
 
121
123
  def self.check_for_files(dir_to_build)
122
- unless File.exist?(File.join(dir_to_build, 'main.rb'))
123
- abort("Must have a file named 'main.rb' in #{dir_to_build}")
124
- end
124
+ main_rb = File.join(dir_to_build, 'source', 'main.rb')
125
+ abort("Must have file #{main_rb}") unless File.exist?(main_rb)
125
126
 
126
- unless File.exist?(File.join(dir_to_build, 'Gemfile'))
127
- abort("Must have a file named 'Gemfile' in #{dir_to_build}")
128
- end
127
+ gemfile = File.join(dir_to_build, 'Gemfile')
128
+ abort("Must have file #{gemfile}") unless File.exist?(gemfile)
129
129
 
130
- unless File.exist?(File.join(dir_to_build, 'Gemfile.lock'))
131
- abort("Must have a file named 'Gemfile.lock' in #{dir_to_build}")
132
- end
130
+ gemfile_lock = File.join(dir_to_build, 'Gemfile.lock')
131
+ abort("Must have file #{gemfile_lock}") unless File.exist?(gemfile_lock)
133
132
  end
134
133
  end
135
134
  end
@@ -0,0 +1,48 @@
1
+ module Rumbda
2
+ GEMFILE_CONTENTS = <<-HEREDOC
3
+ source 'https://rubygems.org'
4
+
5
+ # add runtime dependencies here, they will be included in the index.zip
6
+
7
+ # This is the aws ruby sdk provides a ruby client for interacting with AWS apis.
8
+ # gem 'aws-sdk'
9
+
10
+ # DO NOT REMOVE; bundler version MUST match the version that the traveling ruby uses, which is currently 1.9.9.
11
+ gem 'bundler', '= 1.9.9'
12
+
13
+ # gems in the development group will not be included in the index.zip
14
+ group :development do
15
+ gem 'rumbda'
16
+ end
17
+ HEREDOC
18
+ RUBY_VERSION_FILE_CONTENTS = '2.2.2'.freeze
19
+ GITIGNORE_FILE_CONTENTS = "tmp_rumbda\nindex.zip".freeze
20
+
21
+ class Init
22
+ def self.run(directory)
23
+ source_dir = File.join(directory, 'source')
24
+ FileUtils.mkdir(source_dir)
25
+ puts "Created: #{source_dir}"
26
+
27
+ main_rb = File.join(source_dir, 'main.rb')
28
+ FileUtils.touch(main_rb)
29
+ puts "Created: #{main_rb}"
30
+
31
+ ruby_version_file = File.join(directory, '.ruby-version')
32
+ FileUtils.touch(ruby_version_file)
33
+ File.open(ruby_version_file, 'a') { |f| f.puts RUBY_VERSION_FILE_CONTENTS }
34
+ puts "Created: #{ruby_version_file}"
35
+
36
+ gitignore_file = File.join(directory, '.gitignore')
37
+ FileUtils.touch(gitignore_file)
38
+ File.open(gitignore_file, 'a') { |f| f.puts GITIGNORE_FILE_CONTENTS }
39
+ puts "Created: #{gitignore_file}"
40
+
41
+ gemfile = File.join(directory, 'Gemfile')
42
+ FileUtils.touch(gemfile)
43
+ File.open(gemfile, 'a') do |f|
44
+ f.puts GEMFILE_CONTENTS
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Rumbda
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumbda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kleaver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.9.9
41
- description: A command line tool to build zip files for running ruby on aws lambda.
41
+ description: Run ruby scripts on aws lambda.
42
42
  email: []
43
43
  executables:
44
44
  - rumbda
@@ -51,6 +51,7 @@ files:
51
51
  - lambda/ruby_wrapper.sh
52
52
  - lib/rumbda.rb
53
53
  - lib/rumbda/build.rb
54
+ - lib/rumbda/init.rb
54
55
  - lib/rumbda/version.rb
55
56
  homepage: https://github.com/kleaver/rumbda
56
57
  licenses: