jets 1.3.0 → 1.3.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: bb0598c2fec261f9cf41a160261d7641963e09a62158e1590194e96eff34fbcb
4
- data.tar.gz: f2e34c4c936ab77a6c75045d048a9c5ddebac2611b876f28a74ed11881e3d802
3
+ metadata.gz: abff40ad9616b0c4731fa910bab1fd95a04e6a18c231123ec25c7d5835a103f8
4
+ data.tar.gz: 9e3e1774accf6597b01a196ea8a7a2d02d8186fb2903a808295e6560c57a918c
5
5
  SHA512:
6
- metadata.gz: 603c3925ff7c16dac27e5c1695f948882b6880f91ee162346df13a74c8b3ee59a936555af15eca5b99c966b60da26adbd53c1a252a925aa64dceb3c82b62d9e1
7
- data.tar.gz: c1336fde24ccee02f4ac5e2de60856960b9b33bb84ae5678365ee98f67982c297e8dae3272a126f0f0c4694467d8d5311a4461630bc4c3fea8c4075d83aaaa54
6
+ metadata.gz: c23d454c61f943ebb990c5dedb8e03212b4cda021fc0e54332bf796bbe7158b14048b75895b1c24df6610bb1e16357c7b9a03d4a25d22eaeb22f6e4066bb14b7
7
+ data.tar.gz: 7ba23f24ad9bb445f5ed7fcd9a2eee6e9243a2aaec515b0c66316148079d1abb20e10323bee0ed3935b9d6ea483b5c6c356c846475af82b886c7e14f800784bb
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.3.1]
7
+ - Merge pull request #87 from tongueroo/on-exception
8
+ - fix helpers for binary support
9
+ - deprecate report_exception in favor of on_exception
10
+ - docs: binary upload support
11
+
6
12
  ## [1.3.0]
7
13
  - Official AWS Ruby Support
8
14
  - Ruby Version 2.5.3 upgrade
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (1.3.0)
14
+ jets (1.3.1)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
@@ -66,7 +66,7 @@ GEM
66
66
  tzinfo (~> 1.1)
67
67
  arel (9.0.0)
68
68
  aws-eventstream (1.0.1)
69
- aws-partitions (1.123.0)
69
+ aws-partitions (1.124.0)
70
70
  aws-sdk-apigateway (1.23.0)
71
71
  aws-sdk-core (~> 3, >= 3.39.0)
72
72
  aws-sigv4 (~> 1.0)
data/README.md CHANGED
@@ -30,7 +30,7 @@ Jets supports writing AWS Lambda functions with Ruby. You define them in the `ap
30
30
  app/functions/simple.rb:
31
31
 
32
32
  ```ruby
33
- def handle(event:, context:)
33
+ def handler_function(event:, context:)
34
34
  puts "hello world"
35
35
  {hello: "world"}
36
36
  end
@@ -2,9 +2,7 @@
2
2
  .bundle
3
3
  .byebug_history
4
4
  .DS_Store
5
- .env.*.remote
6
- .env.production
7
- .env.staging
5
+ .env.*
8
6
  /node_modules
9
7
  /public/packs
10
8
  /public/packs-test
data/lib/jets/core.rb CHANGED
@@ -158,6 +158,11 @@ module Jets::Core
158
158
  end
159
159
 
160
160
  def report_exception(exception)
161
+ puts "DEPRECATED: report_exception. Use on_exception instead.".colorize(:yellow)
162
+ on_exception(exception)
163
+ end
164
+
165
+ def on_exception(exception)
161
166
  Jets::Turbine.subclasses.each do |subclass|
162
167
  reporters = subclass.exception_reporters || []
163
168
  reporters.each do |label, block|
@@ -29,7 +29,11 @@ class <%= controller_class_name %>Controller < ApplicationController
29
29
  @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
30
30
 
31
31
  if @<%= orm_instance.save %>
32
- redirect_to "/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}"
32
+ if request.xhr?
33
+ render json: {success: true, location: url_for("/<%= plural_table_name %>/#@{<%= singular_table_name %>.id}")}
34
+ else
35
+ redirect_to "/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}"
36
+ end
33
37
  else
34
38
  render :new
35
39
  end
@@ -38,7 +42,11 @@ class <%= controller_class_name %>Controller < ApplicationController
38
42
  # PUT <%= route_url %>/1
39
43
  def update
40
44
  if @<%= orm_instance.update("#{singular_table_name}_params") %>
41
- render json: {success: true, location: url_for("/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}")}
45
+ if request.xhr?
46
+ render json: {success: true, location: url_for("/<%= plural_table_name %>/#@{<%= singular_table_name %>.id}")}
47
+ else
48
+ redirect_to "/<%= plural_table_name %>/#{@<%= singular_table_name %>.id}"
49
+ end
42
50
  else
43
51
  render :edit
44
52
  end
@@ -23,9 +23,11 @@ module Jets::AssetTagHelper
23
23
  #
24
24
  # image_tag("jets.png") => https://s3-us-west-2.amazonaws.com/demo-dev-s3bucket-1kih4n2te0n66/jets/public/images/jets.png
25
25
  def image_tag(source, options = {})
26
+ source = source.to_s # convert to String because passing a posts.photo object to results in failure to resolve the immage to a URL since we haven't defined polymorphic_url yet
27
+
26
28
  # mimic original behavior to get /images in source
27
- source = "/images/#{source}" unless source.starts_with?('/')
28
- if on_aws?
29
+ source = "/images/#{source}" unless source.starts_with?('/') || source.starts_with?('http')
30
+ if on_aws? && !source.starts_with?('http')
29
31
  source = "#{s3_public}#{source}"
30
32
  end
31
33
 
@@ -33,9 +35,11 @@ module Jets::AssetTagHelper
33
35
  end
34
36
 
35
37
  def asset_path(source, options = {})
36
- if on_aws? && asset_folder?(source)
37
- # mimic original behavior to get /images in source
38
- source = "/images/#{source}" unless source.starts_with?('/')
38
+ source = source.to_s # convert to String because passing a posts.photo object to results in failure to resolve the immage to a URL since we haven't defined polymorphic_url yet
39
+ # mimic original behavior to get /images in source
40
+ source = "/images/#{source}" unless source.starts_with?('/') || source.starts_with?('http')
41
+
42
+ if on_aws? && asset_folder?(source) && !source.starts_with?('http')
39
43
  source = "#{s3_public}#{source}"
40
44
  end
41
45
 
data/lib/jets/poly_fun.rb CHANGED
@@ -36,7 +36,7 @@ module Jets
36
36
  def run_ruby_code(event, context)
37
37
  @app_class.process(event, context, @app_meth)
38
38
  rescue Exception => e
39
- Jets.report_exception(e)
39
+ Jets.on_exception(e)
40
40
  raise(e)
41
41
  end
42
42
 
@@ -50,7 +50,7 @@ class Jets::Processors::MainProcessor
50
50
  # at ruby_server.rb but keeping around for posterity.
51
51
  end
52
52
 
53
- Jets.report_exception(e)
53
+ Jets.on_exception(e)
54
54
  raise(e) # raise error to ruby_server.rb to rescue and handle
55
55
  end
56
56
  end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
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.3.0
4
+ version: 1.3.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: 2018-12-12 00:00:00.000000000 Z
11
+ date: 2018-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack