jets 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -1
  3. data/Gemfile.lock +8 -8
  4. data/README.md +1 -1
  5. data/jets.gemspec +1 -1
  6. data/lib/jets.rb +4 -4
  7. data/lib/jets/application.rb +9 -2
  8. data/lib/jets/aws_info.rb +2 -2
  9. data/lib/jets/aws_services/stack_status.rb +1 -1
  10. data/lib/jets/booter.rb +3 -3
  11. data/lib/jets/builders/code_builder.rb +4 -5
  12. data/lib/jets/builders/code_size.rb +1 -1
  13. data/lib/jets/builders/gem_replacer.rb +1 -1
  14. data/lib/jets/builders/handler_generator.rb +2 -2
  15. data/lib/jets/builders/md5_zip.rb +1 -1
  16. data/lib/jets/builders/tidy.rb +1 -1
  17. data/lib/jets/builders/util.rb +3 -3
  18. data/lib/jets/cfn/ship.rb +1 -1
  19. data/lib/jets/cfn/status.rb +8 -8
  20. data/lib/jets/cfn/upload.rb +3 -3
  21. data/lib/jets/commands/call.rb +4 -4
  22. data/lib/jets/commands/delete.rb +7 -7
  23. data/lib/jets/commands/deploy.rb +5 -5
  24. data/lib/jets/commands/import/sequence.rb +1 -2
  25. data/lib/jets/commands/main.rb +1 -1
  26. data/lib/jets/commands/new.rb +2 -2
  27. data/lib/jets/commands/runner.rb +1 -1
  28. data/lib/jets/commands/sequence.rb +1 -2
  29. data/lib/jets/commands/templates/skeleton/spec/controllers/posts_controller_spec.rb +8 -9
  30. data/lib/jets/commands/templates/skeleton/spec/spec_helper.rb.tt +2 -0
  31. data/lib/jets/commands/url.rb +2 -2
  32. data/lib/jets/core.rb +3 -2
  33. data/lib/jets/erb.rb +2 -2
  34. data/lib/jets/mega/request.rb +17 -3
  35. data/lib/jets/poly_fun/base_executor.rb +1 -1
  36. data/lib/jets/rack_server.rb +1 -1
  37. data/lib/jets/resource/lambda/function/environment.rb +1 -1
  38. data/lib/jets/router.rb +1 -1
  39. data/lib/jets/spec_helpers.rb +52 -0
  40. data/lib/jets/spec_helpers/params.rb +10 -0
  41. data/lib/jets/spec_helpers/request.rb +98 -0
  42. data/lib/jets/spec_helpers/response.rb +5 -0
  43. data/lib/jets/stack/function.rb +1 -1
  44. data/lib/jets/turbo/rail.rb +2 -2
  45. data/lib/jets/version.rb +1 -1
  46. data/vendor/jets-gems/lib/jets/gems/check.rb +1 -1
  47. data/vendor/jets-gems/lib/jets/gems/extract/base.rb +1 -1
  48. metadata +20 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 525a55f0013d6870b5bd4a0fa2f63b981c8af0f82e1fbf6b2cabc847a9e6cb76
4
- data.tar.gz: 17171ba50a0c0e422d7d128465c21c529b13ddfbe7513a7d752f20112a5f81b9
3
+ metadata.gz: 35b8d7335c644339643a2c97c53d4e320967f43761949eeda46909b33f140776
4
+ data.tar.gz: 49d1cd847f9423e21d899107534a81c5d51c368999d60cefe70a89b39b434b9c
5
5
  SHA512:
6
- metadata.gz: ea140c8868652da36b15d10da8a681792d6623cfb76e8480841900e76a2ea7ce9fd0a7fbe30c570d0d51b7d514bc8d0c6a5d8f3259a9f97ff7df6ee85b484df9
7
- data.tar.gz: cc4b2ac99cbb56a2ec20d276d57e6b3a232ca8e292decd9ceb26af704d668acdca1329ae29fdcb4d0b44317c4b6a77747d194c5d767f5fd9b10240388607f6cb
6
+ metadata.gz: fa356ebc6da237b6046e44bf6307af25bfce9fec40746346b52d7a4bc774cdd25ef6a449573c14b3fed5b514ffddc8327c0c7d4fbdc65040abdd7a5749642271
7
+ data.tar.gz: 99b185e759621461ce327b014c51345fe11843732395b79d3604216c60ef668a56ba0004e14ef68faf7151dee2379ae81939084e03e4f6b6bb58cc28e716fcad
@@ -3,6 +3,13 @@
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.6.1]
7
+ - #162 from patchkit-net/feature/spec_helpers
8
+ - #163 from tongueroo/spec-helpers
9
+ - Add jets/spec/helpers.rb with rails-style controller testing helpers
10
+ - #164 from tongueroo/encoding-fix: use encoding from content-type for mega request
11
+ - use rainbow gem for terminal colors
12
+
6
13
  ## [1.6.0]
7
14
  - #158 from mmyoji/fix-docs-urls
8
15
  - #159 from patchkit-net/bugfix/invalid-longpath-collision Fix invalid collision detection on paths that already contains path variables
@@ -58,7 +65,7 @@ This project *loosely tries* to adhere to [Semantic Versioning](http://semver.or
58
65
 
59
66
  ## [1.5.0]
60
67
  - #135 from tongueroo/remove-rails-constant Remove Rails Constant
61
- - #136 from tongueroo/routes-namespace routes namespace support (will be adjusted)
68
+ - #136 from tongueroo/routes-namespace routes namespace support (experimental: will be adjusted)
62
69
 
63
70
  ## [1.4.11]
64
71
  - #133 from tongueroo/custom-layer add custom lambda layer support
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (1.6.0)
14
+ jets (1.6.1)
15
15
  activerecord (~> 5.2.1)
16
16
  activesupport (~> 5.2.1)
17
17
  aws-sdk-apigateway
@@ -22,7 +22,6 @@ PATH
22
22
  aws-sdk-s3
23
23
  aws-sdk-sns
24
24
  aws-sdk-sqs
25
- colorize
26
25
  dotenv
27
26
  gems
28
27
  hashie
@@ -33,6 +32,7 @@ PATH
33
32
  mimemagic
34
33
  rack
35
34
  railties (~> 5.2.1)
35
+ rainbow
36
36
  recursive-open-struct
37
37
  text-table
38
38
  thor
@@ -66,14 +66,14 @@ GEM
66
66
  tzinfo (~> 1.1)
67
67
  arel (9.0.0)
68
68
  aws-eventstream (1.0.1)
69
- aws-partitions (1.133.0)
69
+ aws-partitions (1.135.0)
70
70
  aws-sdk-apigateway (1.23.0)
71
71
  aws-sdk-core (~> 3, >= 3.39.0)
72
72
  aws-sigv4 (~> 1.0)
73
73
  aws-sdk-cloudformation (1.14.0)
74
74
  aws-sdk-core (~> 3, >= 3.39.0)
75
75
  aws-sigv4 (~> 1.0)
76
- aws-sdk-cloudwatchlogs (1.12.0)
76
+ aws-sdk-cloudwatchlogs (1.13.0)
77
77
  aws-sdk-core (~> 3, >= 3.39.0)
78
78
  aws-sigv4 (~> 1.0)
79
79
  aws-sdk-core (3.46.0)
@@ -103,25 +103,24 @@ GEM
103
103
  aws-sigv4 (1.0.3)
104
104
  builder (3.2.3)
105
105
  byebug (10.0.2)
106
- colorize (0.8.1)
107
106
  concurrent-ruby (1.1.4)
108
107
  crass (1.0.4)
109
108
  diff-lcs (1.3)
110
109
  dotenv (2.6.0)
111
- dynomite (1.2.0)
110
+ dynomite (1.2.1)
112
111
  activesupport
113
112
  aws-sdk-dynamodb
114
113
  erubi (1.8.0)
115
114
  gems (1.1.1)
116
115
  json
117
116
  hashie (3.6.0)
118
- i18n (1.5.2)
117
+ i18n (1.5.3)
119
118
  concurrent-ruby (~> 1.0)
120
119
  jets-html-sanitizer (1.0.4)
121
120
  loofah (~> 2.2, >= 2.2.2)
122
121
  jmespath (1.4.0)
123
122
  json (2.1.0)
124
- kramdown (1.17.0)
123
+ kramdown (2.0.0)
125
124
  loofah (2.2.3)
126
125
  crass (~> 1.0.2)
127
126
  nokogiri (>= 1.5.9)
@@ -149,6 +148,7 @@ GEM
149
148
  method_source
150
149
  rake (>= 0.8.7)
151
150
  thor (>= 0.19.0, < 2.0)
151
+ rainbow (3.0.0)
152
152
  rake (12.3.2)
153
153
  recursive-open-struct (1.1.0)
154
154
  rspec (3.8.0)
data/README.md CHANGED
@@ -7,7 +7,7 @@ Ruby and Lambda splat out a baby and that child's name is [Jets](http://rubyonje
7
7
  ![Build Status](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiUE12K3ljQTFQUjVpRW0reGhGVHVQdkplTHlOdUtENnBya2JhVWVXaFIvTU92MlBtV3hIUE9pb25jWGw0MS9jN2RXMERKRHh5Nzhvd01Za0NyeUs5SCtzPSIsIml2UGFyYW1ldGVyU3BlYyI6IkMybEJFaXdzejJEaHNWVmEiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
8
8
  [![CircleCI](https://circleci.com/gh/tongueroo/jets.svg?style=svg)](https://circleci.com/gh/tongueroo/jets)
9
9
  [![Gem Version](https://badge.fury.io/rb/jets.svg)](https://badge.fury.io/rb/jets)
10
- [![Support](https://img.shields.io/badge/Support-Help-blue.svg)](http://rubyonjets.com/docs/support/)
10
+ [![Support](https://img.shields.io/badge/Support-Help-blue.svg)](http://rubyonjets.com/support/)
11
11
 
12
12
  **Upgrading**: If you are upgrading Jets, please check on the [Upgrading Notes](http://rubyonjets.com/docs/upgrading/).
13
13
 
@@ -39,7 +39,6 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency "aws-sdk-s3"
40
40
  spec.add_dependency "aws-sdk-sns"
41
41
  spec.add_dependency "aws-sdk-sqs"
42
- spec.add_dependency "colorize"
43
42
  spec.add_dependency "dotenv"
44
43
  spec.add_dependency "gems" # jets-gems dependency
45
44
  spec.add_dependency "hashie"
@@ -50,6 +49,7 @@ Gem::Specification.new do |spec|
50
49
  spec.add_dependency "mimemagic"
51
50
  spec.add_dependency "rack"
52
51
  spec.add_dependency "railties", "~> 5.2.1" # ActiveRecord database_tasks.rb require this
52
+ spec.add_dependency "rainbow"
53
53
  spec.add_dependency "recursive-open-struct"
54
54
  spec.add_dependency "text-table"
55
55
  spec.add_dependency "thor"
@@ -1,15 +1,15 @@
1
1
  $:.unshift(File.expand_path("../", __FILE__))
2
- require "jets/version"
3
- require "jets/camelizer"
4
2
  require "active_support"
3
+ require "active_support/concern"
5
4
  require "active_support/core_ext"
6
5
  require "active_support/dependencies"
7
6
  require "active_support/ordered_hash"
8
7
  require "active_support/ordered_options"
9
- require "active_support/concern"
10
- require "colorize"
11
8
  require "fileutils"
9
+ require "jets/camelizer"
10
+ require "jets/version"
12
11
  require "memoist"
12
+ require "rainbow/ext/string"
13
13
 
14
14
  module Jets
15
15
  RUBY_VERSION = "2.5.3"
@@ -90,6 +90,13 @@ class Jets::Application
90
90
  config.lambda = ActiveSupport::OrderedOptions.new
91
91
  config.lambda.layers = []
92
92
 
93
+ # Only used for Jets Afterburner, Mega Mode currently. This is a fallback default
94
+ # encoding. Usually, the Rails response will return a content-type header and
95
+ # the encoding in there is used when possible. Example Content-Type header:
96
+ # Content-Type text/html; charset=utf-8
97
+ config.encoding = ActiveSupport::OrderedOptions.new
98
+ config.encoding.default = "utf-8"
99
+
93
100
  config
94
101
  end
95
102
 
@@ -147,8 +154,8 @@ class Jets::Application
147
154
 
148
155
  def deprecated_configs_message
149
156
  unless config.ruby.lazy_load.nil?
150
- puts "Detected config.ruby.lazy_load = #{config.ruby.lazy_load.inspect}".colorize(:yellow)
151
- puts "Deprecated: config.ruby.lazy_load".colorize(:yellow)
157
+ puts "Detected config.ruby.lazy_load = #{config.ruby.lazy_load.inspect}".color(:yellow)
158
+ puts "Deprecated: config.ruby.lazy_load".color(:yellow)
152
159
  puts "Gems are now bundled with with Lambda Layer and there's no need to lazy load them."
153
160
  puts "Please remove the config in your config/application.rb or config/environments files."
154
161
  puts "You can have Jets automatically do this by running:"
@@ -20,10 +20,10 @@ module Jets
20
20
  if exit_code != 0
21
21
  exception_message = region.split("\n").grep(/botocore\.exceptions/).first
22
22
  if exception_message
23
- puts "WARN: #{exception_message}".colorize(:yellow)
23
+ puts "WARN: #{exception_message}".color(:yellow)
24
24
  else
25
25
  # show full message as warning
26
- puts region.colorize(:yellow)
26
+ puts region.color(:yellow)
27
27
  end
28
28
  puts "You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region"
29
29
  region = nil
@@ -36,7 +36,7 @@ module Jets::AwsServices
36
36
  status = resp.stacks[0].stack_status
37
37
  if status =~ /_IN_PROGRESS$/
38
38
  puts "The '#{stack_name}' stack status is #{status}. " \
39
- "Please wait until the stack is ready and try again.".colorize(:red)
39
+ "Please wait until the stack is ready and try again.".color(:red)
40
40
  exit 0
41
41
  elsif resp.stacks[0].outputs.empty? && status != 'ROLLBACK_COMPLETE'
42
42
  # This Happens when the miminal stack fails at the very beginning.
@@ -107,19 +107,19 @@ class Jets::Booter
107
107
  # Cannot call this for the jets new
108
108
  def confirm_jets_project!
109
109
  unless File.exist?("#{Jets.root}config/application.rb")
110
- puts "It does not look like you are running this command within a jets project. Please confirm that you are in a jets project and try again.".colorize(:red)
110
+ puts "It does not look like you are running this command within a jets project. Please confirm that you are in a jets project and try again.".color(:red)
111
111
  exit 1
112
112
  end
113
113
  end
114
114
 
115
115
  def message
116
- "Jets booting up in #{Jets.env.colorize(:green)} mode!"
116
+ "Jets booting up in #{Jets.env.color(:green)} mode!"
117
117
  end
118
118
 
119
119
  def check_config_ru!
120
120
  config_ru = File.read("#{Jets.root}config.ru")
121
121
  unless config_ru.include?("Jets.boot")
122
- puts 'The config.ru file is missing Jets.boot. Please add Jets.boot after require "jets"'.colorize(:red)
122
+ puts 'The config.ru file is missing Jets.boot. Please add Jets.boot after require "jets"'.color(:red)
123
123
  puts "This was changed as made in Jets v1.1.0."
124
124
  puts "To have Jets update the config.fu file for you, you can run:\n\n"
125
125
  puts " jets upgrade"
@@ -1,5 +1,4 @@
1
1
  require "action_view"
2
- require "colorize"
3
2
  require "fileutils"
4
3
  require "net/http"
5
4
  require "open-uri"
@@ -174,7 +173,7 @@ class Jets::Builders
174
173
  # This is because the node and yarn has likely been set up correctly there.
175
174
  def compile_assets
176
175
  if ENV['JETS_SKIP_ASSETS']
177
- puts "Skip compiling assets".colorize(:yellow) # useful for debugging
176
+ puts "Skip compiling assets".color(:yellow) # useful for debugging
178
177
  return
179
178
  end
180
179
 
@@ -206,7 +205,7 @@ class Jets::Builders
206
205
  return unless Jets.rack? && rails? && !rails_api?
207
206
 
208
207
  if ENV['JETS_SKIP_ASSETS']
209
- puts "Skip compiling rack assets".colorize(:yellow) # useful for debugging
208
+ puts "Skip compiling rack assets".color(:yellow) # useful for debugging
210
209
  return
211
210
  end
212
211
 
@@ -270,7 +269,7 @@ class Jets::Builders
270
269
  FileUtils.rm_rf("#{stage_area}/code") # remove current code folder
271
270
  move_node_modules(Jets.root, Jets.build_root)
272
271
  begin
273
- # puts "cp -r #{@full_project_path} #{"#{stage_area}/code"}".colorize(:yellow) # uncomment to debug
272
+ # puts "cp -r #{@full_project_path} #{"#{stage_area}/code"}".color(:yellow) # uncomment to debug
274
273
  Jets::Util.cp_r(@full_project_path, "#{stage_area}/code")
275
274
  ensure
276
275
  move_node_modules(Jets.build_root, Jets.root) # move node_modules directory back
@@ -354,7 +353,7 @@ class Jets::Builders
354
353
  unless ruby_version_supported?
355
354
  puts "You are using Ruby version #{RUBY_VERSION} which is not supported by Jets."
356
355
  ruby_variant = Jets::RUBY_VERSION.split('.')[0..1].join('.') + '.x'
357
- abort("Jets uses Ruby #{Jets::RUBY_VERSION}. You should use a variant of Ruby #{ruby_variant}".colorize(:red))
356
+ abort("Jets uses Ruby #{Jets::RUBY_VERSION}. You should use a variant of Ruby #{ruby_variant}".color(:red))
358
357
  end
359
358
  end
360
359
 
@@ -9,7 +9,7 @@ class Jets::Builders
9
9
 
10
10
  def check
11
11
  return if within_lambda_limit?
12
- say "Over the Lambda size limit of #{LAMBDA_SIZE_LIMIT}MB".colorize(:red)
12
+ say "Over the Lambda size limit of #{LAMBDA_SIZE_LIMIT}MB".color(:red)
13
13
  say "Please reduce the size of your code."
14
14
  display_sizes
15
15
  exit 1
@@ -25,7 +25,7 @@ class Jets::Builders
25
25
  end
26
26
 
27
27
  def sh(command)
28
- puts "=> #{command}".colorize(:green)
28
+ puts "=> #{command}".color(:green)
29
29
  success = system(command)
30
30
  abort("Command Failed") unless success
31
31
  success
@@ -75,7 +75,7 @@ class Jets::Builders
75
75
  end
76
76
 
77
77
  unless missing.empty?
78
- puts "ERROR: Missing source files. Please make sure these source files exist or remove their declarations".colorize(:red)
78
+ puts "ERROR: Missing source files. Please make sure these source files exist or remove their declarations".color(:red)
79
79
  puts missing
80
80
  exit 1
81
81
  end
@@ -114,7 +114,7 @@ class Jets::Builders
114
114
  unless source_path
115
115
  attributes = fun.template.values.first
116
116
  function_name = attributes['Properties']['FunctionName']
117
- puts "WARN: missing source file for: '#{function_name}' function".colorize(:yellow)
117
+ puts "WARN: missing source file for: '#{function_name}' function".color(:yellow)
118
118
  return
119
119
  end
120
120
 
@@ -34,7 +34,7 @@ class Jets::Builders
34
34
  FileUtils.mv(zip_dest, md5_dest)
35
35
 
36
36
  file_size = number_to_human_size(File.size(md5_dest))
37
- puts "Zip file created at: #{md5_dest.colorize(:green)} (#{file_size})"
37
+ puts "Zip file created at: #{md5_dest.color(:green)} (#{file_size})"
38
38
  end
39
39
 
40
40
  # /tmp/jets/demo/stage/zips/code.zip
@@ -90,7 +90,7 @@ class Jets::Builders
90
90
  exists = File.exist?("#{path}/.gitkeep") || File.exist?("#{path}/.keep")
91
91
  return if exists
92
92
 
93
- # say " rm -rf #{path}".colorize(:yellow) # uncomment to debug
93
+ # say " rm -rf #{path}".color(:yellow) # uncomment to debug
94
94
  system("rm -rf #{path}") unless @noop
95
95
  end
96
96
 
@@ -2,10 +2,10 @@ class Jets::Builders
2
2
  module Util
3
3
  private
4
4
  def sh(command)
5
- puts "=> #{command}".colorize(:green)
5
+ puts "=> #{command}".color(:green)
6
6
  success = system(command)
7
7
  unless success
8
- puts "#{command} failed to run.".colorize(:red)
8
+ puts "#{command} failed to run.".color(:red)
9
9
  puts caller[0]
10
10
  exit 1
11
11
  end
@@ -13,7 +13,7 @@ class Jets::Builders
13
13
  end
14
14
 
15
15
  def headline(message)
16
- puts "=> #{message}".colorize(:cyan)
16
+ puts "=> #{message}".color(:cyan)
17
17
  end
18
18
 
19
19
  def build_area
@@ -23,7 +23,7 @@ class Jets::Cfn
23
23
  confirm = prompt_for_iam(capabilities)
24
24
  if confirm =~ /^y/
25
25
  @options.merge!(capabilities: [capabilities])
26
- puts "Re-running: #{command_with_iam(capabilities).colorize(:green)}"
26
+ puts "Re-running: #{command_with_iam(capabilities).color(:green)}"
27
27
  retry
28
28
  else
29
29
  puts "Exited"
@@ -12,14 +12,14 @@ class Jets::Cfn
12
12
  # used for the jets status command
13
13
  def run
14
14
  unless stack_exists?(@stack_name)
15
- puts "The stack #{@stack_name.colorize(:green)} does not exist."
15
+ puts "The stack #{@stack_name.color(:green)} does not exist."
16
16
  return
17
17
  end
18
18
 
19
19
  resp = cfn.describe_stacks(stack_name: @stack_name)
20
20
  stack = resp.stacks.first
21
21
 
22
- puts "The current status for the stack #{@stack_name.colorize(:green)} is #{stack.stack_status.colorize(:green)}"
22
+ puts "The current status for the stack #{@stack_name.color(:green)} is #{stack.stack_status.color(:green)}"
23
23
  if stack.stack_status =~ /_IN_PROGRESS$/
24
24
  puts "Stack events (tailing):"
25
25
  # tail all events until done
@@ -56,12 +56,12 @@ class Jets::Cfn
56
56
 
57
57
  success = false
58
58
  if last_event_status =~ /_FAILED/
59
- puts "Stack failed: #{last_event_status}".colorize(:red)
60
- puts "Stack reason #{@events[0]["resource_status_reason"]}".colorize(:red)
59
+ puts "Stack failed: #{last_event_status}".color(:red)
60
+ puts "Stack reason #{@events[0]["resource_status_reason"]}".color(:red)
61
61
  elsif last_event_status =~ /_ROLLBACK_/
62
- puts "Stack rolled back: #{last_event_status}".colorize(:red)
62
+ puts "Stack rolled back: #{last_event_status}".color(:red)
63
63
  else # success
64
- puts "Stack success status: #{last_event_status}".colorize(:green)
64
+ puts "Stack success status: #{last_event_status}".color(:green)
65
65
  success = true
66
66
  end
67
67
 
@@ -69,7 +69,7 @@ class Jets::Cfn
69
69
  # once the stack is deleted. Gets here for stack create and update though.
70
70
  return if @hide_time_took # set in run
71
71
  took = Time.now - start_time
72
- puts "Time took for stack deployment: #{pretty_time(took).green}."
72
+ puts "Time took for stack deployment: #{pretty_time(took).color(:green)}."
73
73
 
74
74
  success
75
75
  end
@@ -116,7 +116,7 @@ class Jets::Cfn
116
116
  e["logical_resource_id"],
117
117
  e["resource_status_reason"]
118
118
  ].join(" ")
119
- message = message.colorize(:red) if e["resource_status"] =~ /_FAILED/
119
+ message = message.color(:red) if e["resource_status"] =~ /_FAILED/
120
120
  puts message
121
121
  end
122
122
 
@@ -45,15 +45,15 @@ class Jets::Cfn
45
45
  s3_key = "jets/code/#{File.basename(path)}"
46
46
  obj = s3_resource.bucket(bucket_name).object(s3_key)
47
47
  obj.upload_file(path)
48
- puts "Uploaded to s3://#{bucket_name}/#{s3_key}".colorize(:green)
49
- puts "Time to upload code to s3: #{pretty_time(Time.now-start_time).colorize(:green)}"
48
+ puts "Uploaded to s3://#{bucket_name}/#{s3_key}".color(:green)
49
+ puts "Time to upload code to s3: #{pretty_time(Time.now-start_time).color(:green)}"
50
50
  end
51
51
 
52
52
  def upload_assets
53
53
  puts "Checking for modified public assets and uploading to S3."
54
54
  start_time = Time.now
55
55
  upload_public_assets
56
- puts "Time for public assets to s3: #{pretty_time(Time.now-start_time).colorize(:green)}"
56
+ puts "Time for public assets to s3: #{pretty_time(Time.now-start_time).color(:green)}"
57
57
  end
58
58
 
59
59
  def upload_public_assets
@@ -67,12 +67,12 @@ class Jets::Commands::Call
67
67
  begin
68
68
  resp = lambda.invoke(options)
69
69
  rescue Aws::Lambda::Errors::ResourceNotFoundException
70
- puts "The function #{function_name} was not found. Maybe check the spelling or the AWS_PROFILE?".colorize(:red)
70
+ puts "The function #{function_name} was not found. Maybe check the spelling or the AWS_PROFILE?".color(:red)
71
71
  return
72
72
  end
73
73
 
74
74
  if @options[:show_log]
75
- puts "Last 4KB of log in the x-amz-log-result header:".colorize(:green)
75
+ puts "Last 4KB of log in the x-amz-log-result header:".color(:green)
76
76
  puts Base64.decode64(resp.log_result)
77
77
  end
78
78
 
@@ -104,7 +104,7 @@ class Jets::Commands::Call
104
104
 
105
105
  check_valid_json!(text)
106
106
 
107
- puts "Function name: #{function_name.colorize(:green)}" unless @options[:mute]
107
+ puts "Function name: #{function_name.color(:green)}" unless @options[:mute]
108
108
  return text unless function_name.include?("_controller-")
109
109
  return text if @options[:lambda_proxy] == false
110
110
 
@@ -117,7 +117,7 @@ class Jets::Commands::Call
117
117
  path = text.gsub('file://','')
118
118
  path = "#{Jets.root}#{path}" unless path[0..0] == '/'
119
119
  unless File.exist?(path)
120
- puts "File #{path} does not exist. Are you sure the file exists?".colorize(:red)
120
+ puts "File #{path} does not exist. Are you sure the file exists?".color(:red)
121
121
  exit
122
122
  end
123
123
  text = IO.read(path)
@@ -20,13 +20,13 @@ class Jets::Commands::Delete
20
20
  stack_in_progress?(parent_stack_name)
21
21
 
22
22
  cfn.delete_stack(stack_name: parent_stack_name)
23
- puts "Deleting #{Jets.config.project_namespace.colorize(:green)}..."
23
+ puts "Deleting #{Jets.config.project_namespace.color(:green)}..."
24
24
 
25
25
  wait_for_stack if @options[:wait]
26
26
 
27
27
  delete_logs
28
28
 
29
- puts "Project #{Jets.config.project_namespace.colorize(:green)} deleted!"
29
+ puts "Project #{Jets.config.project_namespace.color(:green)} deleted!"
30
30
  end
31
31
 
32
32
  def wait_for_stack
@@ -34,7 +34,7 @@ class Jets::Commands::Delete
34
34
  start_time = Time.now
35
35
  status.wait
36
36
  took = Time.now - start_time
37
- puts "Time took for deletion: #{status.pretty_time(took).green}."
37
+ puts "Time took for deletion: #{status.pretty_time(took).color(:green)}."
38
38
  end
39
39
 
40
40
  def delete_logs
@@ -49,7 +49,7 @@ class Jets::Commands::Delete
49
49
  rescue Aws::CloudFormation::Errors::ValidationError
50
50
  # Aws::CloudFormation::Errors::ValidationError is thrown when the stack
51
51
  # does not exist
52
- puts "The parent stack #{Jets.config.project_namespace.colorize(:green)} for the project #{Jets.config.project_name.colorize(:green)} does not exist. So it cannot be deleted."
52
+ puts "The parent stack #{Jets.config.project_namespace.color(:green)} for the project #{Jets.config.project_name.color(:green)} does not exist. So it cannot be deleted."
53
53
  exit 0
54
54
  end
55
55
  end
@@ -104,12 +104,12 @@ class Jets::Commands::Delete
104
104
  if @options[:sure]
105
105
  sure = 'y'
106
106
  else
107
- puts "Are you sure you want to want to delete the #{Jets.config.project_namespace.colorize(:green)} project? (y/N)"
107
+ puts "Are you sure you want to want to delete the #{Jets.config.project_namespace.color(:green)} project? (y/N)"
108
108
  sure = $stdin.gets
109
109
  end
110
110
 
111
111
  unless sure =~ /^y/
112
- puts "Phew! Jets #{Jets.config.project_namespace.colorize(:green)} project was not deleted."
112
+ puts "Phew! Jets #{Jets.config.project_namespace.color(:green)} project was not deleted."
113
113
  exit 0
114
114
  end
115
115
  end
@@ -128,7 +128,7 @@ class Jets::Commands::Delete
128
128
 
129
129
  if status =~ /_IN_PROGRESS$/
130
130
  puts "The '#{@parent_stack_name}' stack status is #{status}. " \
131
- "It is not in an updateable status. Please wait until the stack is ready and try again.".colorize(:red)
131
+ "It is not in an updateable status. Please wait until the stack is ready and try again.".color(:red)
132
132
  exit 0
133
133
  elsif resp.stacks[0].outputs.empty?
134
134
  # This Happens when the miminal stack fails at the very beginning.
@@ -7,7 +7,7 @@ module Jets::Commands
7
7
  end
8
8
 
9
9
  def run
10
- deployment_env = Jets.config.project_namespace.colorize(:green)
10
+ deployment_env = Jets.config.project_namespace.color(:green)
11
11
  puts "Deploying to Lambda #{deployment_env} environment..."
12
12
  return if @options[:noop]
13
13
 
@@ -40,7 +40,7 @@ module Jets::Commands
40
40
 
41
41
  def check_dev_mode
42
42
  if File.exist?("#{Jets.root}dev.mode")
43
- puts "The dev.mode file exists. Please removed it and run bundle update before you deploy.".colorize(:red)
43
+ puts "The dev.mode file exists. Please removed it and run bundle update before you deploy.".color(:red)
44
44
  exit 1
45
45
  end
46
46
  end
@@ -57,7 +57,7 @@ module Jets::Commands
57
57
  def check_route_connected_functions
58
58
  return if Jets::Router.all_routes_valid
59
59
 
60
- puts "Deploy fail: The jets application contain invalid routes.".colorize(:red)
60
+ puts "Deploy fail: The jets application contain invalid routes.".color(:red)
61
61
  puts "Please double check the routes below map to valid controllers:"
62
62
  Jets::Router.invalid_routes.each do |route|
63
63
  puts " /#{route.path} => #{route.controller_name}##{route.action_name}"
@@ -121,8 +121,8 @@ module Jets::Commands
121
121
  status =~ /_IN_PROGRESS$/
122
122
  region = `aws configure get region`.strip rescue "us-east-1"
123
123
  url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks"
124
- puts "The parent stack of the #{Jets.config.project_name.colorize(:green)} project is not in an updateable state."
125
- puts "Stack name #{stack_name.colorize(:yellow)} status #{stack["stack_status"].colorize(:yellow)}"
124
+ puts "The parent stack of the #{Jets.config.project_name.color(:green)} project is not in an updateable state."
125
+ puts "Stack name #{stack_name.color(:yellow)} status #{stack["stack_status"].color(:yellow)}"
126
126
  puts "Here's the CloudFormation url to check for more details #{url}"
127
127
  exit 1
128
128
  end
@@ -1,5 +1,4 @@
1
1
  require 'bundler'
2
- require 'colorize'
3
2
  require 'fileutils'
4
3
  require 'thor'
5
4
 
@@ -42,7 +41,7 @@ class Jets::Commands::Import
42
41
  begin
43
42
  directory ".", rack_folder, exclude_pattern: %r{.git}
44
43
  rescue Thor::Error => e
45
- puts e.message.colorize(:red)
44
+ puts e.message.color(:red)
46
45
  exit 1
47
46
  end
48
47
  end
@@ -42,7 +42,7 @@ module Jets::Commands
42
42
  o = options
43
43
  server_command = o[:reload] ? "shotgun" : "rackup"
44
44
  command = "bundle exec #{server_command} --port #{o[:port]} --host #{o[:host]}"
45
- puts "=> #{command}".colorize(:green)
45
+ puts "=> #{command}".color(:green)
46
46
  puts Jets::Booter.message
47
47
  Jets::Booter.check_config_ru!
48
48
  Jets::RackServer.start(options) unless ENV['JETS_RACK'] == '0' # rack server runs in background by default
@@ -41,7 +41,7 @@ module Jets::Commands
41
41
  @database = false
42
42
  @webpacker = false
43
43
  else
44
- puts "Invalid mode provided: #{@options[:mode].colorize(:red)}. Please pass in an valid mode: #{VALID_MODES.join(',').colorize(:green)}."
44
+ puts "Invalid mode provided: #{@options[:mode].color(:red)}. Please pass in an valid mode: #{VALID_MODES.join(',').color(:green)}."
45
45
  exit 1
46
46
  end
47
47
  end
@@ -68,7 +68,7 @@ module Jets::Commands
68
68
  def webpacker_install
69
69
  return unless @webpacker
70
70
  unless yarn_installed?
71
- puts "Yarn is not installed or has not been detected. Please double check that yarn has been installed.".colorize(:red)
71
+ puts "Yarn is not installed or has not been detected. Please double check that yarn has been installed.".color(:red)
72
72
  puts <<~EOL
73
73
  To check:
74
74
 
@@ -8,7 +8,7 @@ class Jets::Commands::Runner
8
8
  if File.exist?(full_path)
9
9
  code = IO.read(full_path)
10
10
  else
11
- puts "ERROR: file not found at #{full_path}".colorize(:red)
11
+ puts "ERROR: file not found at #{full_path}".color(:red)
12
12
  exit 1
13
13
  end
14
14
  end
@@ -1,5 +1,4 @@
1
1
  require 'fileutils'
2
- require 'colorize'
3
2
  require 'thor'
4
3
  require 'bundler'
5
4
 
@@ -27,7 +26,7 @@ private
27
26
  def confirm_jets_project
28
27
  jets_project = File.exist?("#{project_folder}/config/application.rb")
29
28
  unless jets_project
30
- puts "It does not look like the repo #{options[:repo]} is a jets project. Maybe double check that it is? Exited.".colorize(:red)
29
+ puts "It does not look like the repo #{options[:repo]} is a jets project. Maybe double check that it is? Exited.".color(:red)
31
30
  exit 1
32
31
  end
33
32
  end
@@ -1,16 +1,15 @@
1
1
  # Example:
2
2
  # describe PostsController, type: :controller do
3
3
  # it "index returns a success response" do
4
- # event = payload("posts-index")
5
- # controller = PostsController.new(event)
6
- # response = controller.index
7
- # # pp response
4
+ # get '/posts'
5
+ # expect(response.status).to eq 200
6
+ # pp response.body
8
7
  # end
9
-
8
+ #
10
9
  # it "show returns a success response" do
11
- # event = payload("posts-show")
12
- # controller = PostsController.new(event)
13
- # response = controller.show
14
- # # pp response
10
+ # Post.create(id: 1) unless Post.find_by(id: 1) # TODO: set up factory_bot
11
+ # get '/posts/:id', id: 1
12
+ # expect(response.status).to eq 200
13
+ # pp response.body
15
14
  # end
16
15
  # end
@@ -10,6 +10,8 @@ require "jets"
10
10
  abort("The Jets environment is running in production mode!") if Jets.env == "production"
11
11
  Jets.boot
12
12
 
13
+ require "jets/spec_helpers"
14
+
13
15
  <% if @webpacker -%>
14
16
  require 'capybara/rspec'
15
17
  Capybara.app = Jets.application
@@ -9,7 +9,7 @@ module Jets::Commands
9
9
  def display
10
10
  stack_name = Jets::Naming.parent_stack_name
11
11
  unless stack_exists?(stack_name)
12
- puts "Stack for #{Jets.config.project_name.colorize(:green)} project for environment #{Jets.env.colorize(:green)}. Couldn't find #{stack_name.colorize(:green)} stack."
12
+ puts "Stack for #{Jets.config.project_name.color(:green)} project for environment #{Jets.env.color(:green)}. Couldn't find #{stack_name.color(:green)} stack."
13
13
  exit
14
14
  end
15
15
 
@@ -21,7 +21,7 @@ module Jets::Commands
21
21
  STDOUT.puts "API Gateway Endpoint: #{api_gateway_endpoint}"
22
22
  show_custom_domain
23
23
  else
24
- puts "API Gateway not found. This jets app does have an API Gateway associated with it. Please double check your config/routes.rb if you were expecting to see a url for the app. Also check that #{stack_name.colorize(:green)} is a jets app."
24
+ puts "API Gateway not found. This jets app does have an API Gateway associated with it. Please double check your config/routes.rb if you were expecting to see a url for the app. Also check that #{stack_name.color(:green)} is a jets app."
25
25
  end
26
26
  end
27
27
 
@@ -97,7 +97,8 @@ module Jets::Core
97
97
  path =~ %r{/templates/} ||
98
98
  path =~ %r{/turbo/project/} ||
99
99
  path =~ %r{/version} ||
100
- path =~ %r{/webpacker}
100
+ path =~ %r{/webpacker} ||
101
+ path =~ %r{/jets/spec}
101
102
  end
102
103
 
103
104
  def class_mappings(class_name)
@@ -159,7 +160,7 @@ module Jets::Core
159
160
  end
160
161
 
161
162
  def report_exception(exception)
162
- puts "DEPRECATED: report_exception. Use on_exception instead.".colorize(:yellow)
163
+ puts "DEPRECATED: report_exception. Use on_exception instead.".color(:yellow)
163
164
  on_exception(exception)
164
165
  end
165
166
 
@@ -24,7 +24,7 @@ class Jets::Erb
24
24
  error_info ||= e.backtrace.grep(/\(erb\)/)[0]
25
25
  raise unless error_info # unable to find the (erb):xxx: error line
26
26
  line = error_info.split(':')[1].to_i
27
- puts "Error evaluating ERB template on line #{line.to_s.colorize(:red)} of: #{path.sub(/^\.\//, '').colorize(:green)}"
27
+ puts "Error evaluating ERB template on line #{line.to_s.color(:red)} of: #{path.sub(/^\.\//, '').color(:green)}"
28
28
 
29
29
  template_lines = template.split("\n")
30
30
  context = 5 # lines of context
@@ -33,7 +33,7 @@ class Jets::Erb
33
33
  template_lines[top..bottom].each_with_index do |line_content, index|
34
34
  line_number = top+index+1
35
35
  if line_number == line
36
- printf("%#{spacing}d %s\n".colorize(:red), line_number, line_content)
36
+ printf("%#{spacing}d %s\n".color(:red), line_number, line_content)
37
37
  else
38
38
  printf("%#{spacing}d %s\n", line_number, line_content)
39
39
  end
@@ -48,13 +48,27 @@ module Jets::Mega
48
48
 
49
49
  puts_rack_output
50
50
 
51
+ status = response.code.to_i
52
+ headers = response.each_header.to_h
53
+ encoding = get_encoding(headers['content-type'])
54
+ body = response.body.force_encoding(encoding)
51
55
  {
52
- status: response.code.to_i,
53
- headers: response.each_header.to_h,
54
- body: response.body,
56
+ status: status,
57
+ headers: headers,
58
+ body: body,
55
59
  }
56
60
  end
57
61
 
62
+ def get_encoding(content_type)
63
+ default = Jets.config.encoding.default
64
+ return default unless content_type
65
+
66
+ md = content_type.match(/charset=(.+)/)
67
+ return default unless md
68
+
69
+ md[1]
70
+ end
71
+
58
72
  # Grab the rack output from the /tmp/jets-output.log and puts it back in the
59
73
  # main process' stdout
60
74
  def puts_rack_output
@@ -87,7 +87,7 @@ class Jets::PolyFun
87
87
  interpreter = @task.lang
88
88
  command = %Q|#{interpreter} #{lambda_executor_script} '#{JSON.dump(event)}' '#{JSON.dump(context)}'|
89
89
  stdout, stderr, status = Open3.capture3(command)
90
- # puts "=> #{command}".colorize(:green)
90
+ # puts "=> #{command}".color(:green)
91
91
  # puts "stdout #{stdout}"
92
92
  # puts "stderr #{stderr}"
93
93
  # puts "status #{status}"
@@ -39,7 +39,7 @@ module Jets
39
39
  args << " --host #{@options[:host]}" if @options[:host] # only forward the host option
40
40
  # port is always 9292 for simplicity
41
41
  command = "cd #{rack_project} && bin/rackup#{args}" # leads to the same wrapper rack scripts
42
- puts "=> #{command}".colorize(:green)
42
+ puts "=> #{command}".color(:green)
43
43
  system(command)
44
44
  end
45
45
  end
@@ -27,7 +27,7 @@ class Jets::Resource::Lambda::Function
27
27
  found_reserved_vars = variables.keys & reserved_variables
28
28
  return if found_reserved_vars.empty?
29
29
 
30
- puts "You have configured some environment variables that are reserved by AWS Lambda.".colorize(:red)
30
+ puts "You have configured some environment variables that are reserved by AWS Lambda.".color(:red)
31
31
  puts found_reserved_vars
32
32
  puts "The deployment to AWS Lambda will failed when using reserved variables."
33
33
  puts "Please remove these reserved variables. "
@@ -71,7 +71,7 @@ module Jets
71
71
 
72
72
  def api_mode?
73
73
  if Jets.config.key?(:api_mode) || Jets.config.key?(:api_generator)
74
- puts <<~EOL.colorize(:yellow)
74
+ puts <<~EOL.color(:yellow)
75
75
  DEPRECATED: Jets.config.api_generator
76
76
  Instead, please update your config/application.rb to use:
77
77
  Jets.config.mode = 'api'
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'base64'
4
+
5
+ module Jets
6
+ module SpecHelpers
7
+ autoload :Params, 'jets/spec_helpers/params'
8
+ autoload :Request, 'jets/spec_helpers/request'
9
+ autoload :Response, 'jets/spec_helpers/response'
10
+
11
+ attr_reader :request, :response
12
+ def initialize(*)
13
+ super
14
+ @request = Request.new(:get, '/', {}, Params.new)
15
+ @response = nil # will be set after http_call
16
+ end
17
+
18
+ rest_methods = %w[get post put patch delete]
19
+ rest_methods.each do |meth|
20
+ define_method(meth) do |path, **params|
21
+ http_call(method: meth, path: path, **params)
22
+ end
23
+ # Example:
24
+ # def get(path, **params)
25
+ # http_call(method: :get, path: path, **params)
26
+ # end
27
+ end
28
+
29
+ def http_call(method:, path:, **params)
30
+ request.method = method.to_sym
31
+ request.path = path
32
+ request.headers.deep_merge!(params.delete(:headers) || {})
33
+
34
+ request.params.body_params = params.delete(:params) || params || {}
35
+ request.params.path_params = params
36
+
37
+ @response = request.dispatch!
38
+ end
39
+
40
+ def fixture_path(filename)
41
+ "#{Jets.root}/spec/fixtures/#{filename}"
42
+ end
43
+
44
+ def fixture_file(filename)
45
+ File.new(fixture_path(filename))
46
+ end
47
+ end
48
+ end
49
+
50
+ RSpec.configure do |c|
51
+ c.include Jets::SpecHelpers
52
+ end
@@ -0,0 +1,10 @@
1
+ module Jets
2
+ module SpecHelpers
3
+ class Params
4
+ attr_accessor :path_params, :body_params
5
+ def initialize(path_params={}, body_params={})
6
+ @path_params, @body_params = path_params, body_params
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,98 @@
1
+ module Jets
2
+ module SpecHelpers
3
+ class Request
4
+ attr_accessor :method, :path, :headers, :params
5
+ def initialize(method, path, headers={}, params={})
6
+ @method, @path, @headers, @params = method, path, headers, params
7
+ end
8
+
9
+ def event
10
+ json = {}
11
+ id_params = path.scan(%r{:([^/]+)}).flatten
12
+ expanded_path = path.dup
13
+ path_parameters = {}
14
+
15
+ id_params.each do |id_param|
16
+ raise "missing param: :#{id_param}" unless params.path_params.include? id_param.to_sym
17
+
18
+ path_param_value = params.path_params[id_param.to_sym]
19
+ raise "Path param :#{id_param} value cannot be blank" if path_param_value.blank?
20
+
21
+ expanded_path.gsub!(":#{id_param}", path_param_value.to_s)
22
+ path_parameters.deep_merge!(id_param => path_param_value.to_s)
23
+ end
24
+
25
+ json['resource'] = path
26
+ json['path'] = expanded_path
27
+ json['httpMethod'] = method.to_s.upcase
28
+ json['pathParameters'] = path_parameters
29
+ json['headers'] = (headers || {}).stringify_keys
30
+
31
+ if method != :get
32
+ json['headers']['Content-Type'] = "multipart/form-data; boundary=#{multipart_boundary}"
33
+ body = +''
34
+ params.body_params.to_a.each do |e|
35
+ key, value = e
36
+ body << multipart_item(name: key, value: value)
37
+ end
38
+ body << multipart_end
39
+
40
+ json['body'] = Base64.encode64 body
41
+ json['isBase64Encoded'] = true
42
+ end
43
+
44
+ json
45
+ end
46
+
47
+ def multipart_boundary
48
+ @boundary ||= '-' * 16 + SecureRandom.hex(32)
49
+ end
50
+
51
+ def multipart_item(name:, value:)
52
+ if value.is_a? File
53
+ multipart_file(name: name, filename: File.basename(value.path),
54
+ data: ::IO.read(value.path))
55
+ else
56
+ multipart_text(name: name, text: value)
57
+ end
58
+ end
59
+
60
+ def multipart_text(name:, text:)
61
+ "--#{multipart_boundary}\r\nContent-Disposition: form-data; name=\"#{name}\"\r\n"\
62
+ "Content-Type: text/plain\r\n\r\n#{text}\r\n"
63
+ end
64
+
65
+ def multipart_file(name:, filename:, data:)
66
+ "--#{multipart_boundary}\r\nContent-Disposition: form-data; name=\"#{name}\"; "\
67
+ "filename=\"#{filename}\"\r\n\r\n#{data}\r\n"
68
+ end
69
+
70
+ def multipart_end
71
+ "--#{multipart_boundary}--"
72
+ end
73
+
74
+ def find_route!
75
+ path = self.path
76
+ path = path[0..-2] if path.end_with? '/'
77
+ path = path[1..-1] if path.start_with? '/'
78
+
79
+ route = Jets::Router.routes.find { |r| r.path == path && r.method == method.to_s.upcase }
80
+ raise "Route not found: #{method.to_s.upcase} #{path}" if route.blank?
81
+
82
+ route
83
+ end
84
+
85
+ def dispatch!
86
+ route = find_route!
87
+ controller = Object.const_get(route.controller_name).new(event, {}, route.action_name)
88
+ response = controller.dispatch!
89
+
90
+ if !response.is_a?(Array) || response.size != 3
91
+ raise "Expected response to be an array of size 3. Are you rendering correctly?"
92
+ end
93
+
94
+ Response.new(response[0].to_i, response[2].read)
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,5 @@
1
+ module Jets
2
+ module SpecHelpers
3
+ Response = Struct.new(:status, :body)
4
+ end
5
+ end
@@ -19,7 +19,7 @@ class Jets::Stack
19
19
  ext = File.extname(source_file).sub(/^\./,'').to_sym
20
20
  lang_map[ext]
21
21
  else
22
- puts "WARN: Unable to find a source file for function. Looked at: #{search_expression}".colorize(:yellow)
22
+ puts "WARN: Unable to find a source file for function. Looked at: #{search_expression}".color(:yellow)
23
23
  end
24
24
  end
25
25
 
@@ -20,9 +20,9 @@ class Jets::Turbo
20
20
  def afterburners_message
21
21
  command = ARGV.first
22
22
  if command == "deploy"
23
- puts "=> Rails app detected: Enabling Jets Afterburner to deploy to AWS Lambda.".colorize(:green)
23
+ puts "=> Rails app detected: Enabling Jets Afterburner to deploy to AWS Lambda.".color(:green)
24
24
  else
25
- puts "=> Rails app detected: Enabling Jets Afterburner.".colorize(:green)
25
+ puts "=> Rails app detected: Enabling Jets Afterburner.".color(:green)
26
26
  end
27
27
  end
28
28
 
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
@@ -158,7 +158,7 @@ EOL
158
158
  # Thanks: https://gist.github.com/aelesbao/1414b169a79162b1d795 and
159
159
  # https://stackoverflow.com/questions/5165950/how-do-i-get-a-list-of-gems-that-are-installed-that-have-native-extensions
160
160
  def specs_with_extensions
161
- # puts "Jets::Gems::Check#specs_with_extensions".colorize(:red)
161
+ # puts "Jets::Gems::Check#specs_with_extensions".color:red)
162
162
  # puts "BUNDLE_GEMFILE #{ENV['BUNDLE_GEMFILE'].inspect}"
163
163
  # puts "Jets.root #{Jets.root}"
164
164
  # puts "Dir.pwd #{Dir.pwd}"
@@ -24,7 +24,7 @@ module Jets::Gems::Extract
24
24
  end
25
25
 
26
26
  def sh(command)
27
- say "=> #{command}".colorize(:green)
27
+ say "=> #{command}".color(:green)
28
28
  success = system(command)
29
29
  abort("Command Failed") unless success
30
30
  success
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.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: 2019-01-19 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: colorize
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :runtime
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: dotenv
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -304,6 +290,20 @@ dependencies:
304
290
  - - "~>"
305
291
  - !ruby/object:Gem::Version
306
292
  version: 5.2.1
293
+ - !ruby/object:Gem::Dependency
294
+ name: rainbow
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ">="
298
+ - !ruby/object:Gem::Version
299
+ version: '0'
300
+ type: :runtime
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
307
307
  - !ruby/object:Gem::Dependency
308
308
  name: recursive-open-struct
309
309
  requirement: !ruby/object:Gem::Requirement
@@ -749,6 +749,10 @@ files:
749
749
  - lib/jets/rule.rb
750
750
  - lib/jets/rule/base.rb
751
751
  - lib/jets/rule/dsl.rb
752
+ - lib/jets/spec_helpers.rb
753
+ - lib/jets/spec_helpers/params.rb
754
+ - lib/jets/spec_helpers/request.rb
755
+ - lib/jets/spec_helpers/response.rb
752
756
  - lib/jets/stack.rb
753
757
  - lib/jets/stack/builder.rb
754
758
  - lib/jets/stack/definition.rb