jets 1.9.30 → 1.9.31

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
  SHA256:
3
- metadata.gz: f4e4b8a6a2842c6772696ca1191d189588975fc2f2e2ef758de08290f1e16c7e
4
- data.tar.gz: effd407588558209807f29ab629773c85750618541c87c07df7e83e32372102a
3
+ metadata.gz: c63b7332e7379ad4ce0c15ec52689dbf55b555096f7b5a72a7e1130e3ede6396
4
+ data.tar.gz: 42700a327a878e1ece6a5431e5af99f23c6e971c15310067ad20390064599f23
5
5
  SHA512:
6
- metadata.gz: 2d2fdba19a9b9958a91391c73b8f24b104785314cc75ee7ab74bd65b9df9f9f8007cd641887737dcc6e7247e536fa105c1fb148aa21ba21b8bc60fc7514eab07
7
- data.tar.gz: 9a417c92f8deee8e871fecff627720f914b1a389218cb5540a4f8b145cffed95de0587a545644e7e0bb7ab0c44c4bf256a81dee5d194ded90e784228780d0eb8
6
+ metadata.gz: a47cc35fd06dccedca525ce2289b44e3853e321a825e2ed6904b02b941fa40965fd9a1ed3f23438df1f50b82b1ec4243aa25f39e80e18881374e01c3a2c100f4
7
+ data.tar.gz: 71882882151ce2d226323fb7ba5c374c3fa81bc1dfc34c8650ad4b1e082924129f743939df1260afa3bc485ea7a6289fb99c1287a1e6e603de4e52270ac76966
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
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/).
5
5
 
6
+ ## [1.9.31]
7
+ - #307 Update comment in Gemfile template
8
+ - #315 Improve spec_helpers: Use Rack::Multipart utils to properly build body params (especially with files and nested hashes)from galetahub/master
9
+ - #316 Copy .ruby-version file to build directory
10
+
6
11
  ## [1.9.30]
7
12
  - #305 allow url paths that contain dashes
8
13
 
@@ -27,6 +27,7 @@ module Jets::Builders
27
27
 
28
28
  def build
29
29
  check_ruby_version
30
+ copy_ruby_version_file
30
31
  @version_purger.purge
31
32
  cache_check_message
32
33
 
@@ -370,6 +371,12 @@ module Jets::Builders
370
371
  end
371
372
  end
372
373
 
374
+ def copy_ruby_version_file
375
+ return unless File.exists?(".ruby-version")
376
+
377
+ FileUtils.cp_r(Jets.root.join(".ruby-version"), build_area)
378
+ end
379
+
373
380
  def ruby_version_supported?
374
381
  pattern = /(\d+)\.(\d+)\.(\d+)/
375
382
  md = RUBY_VERSION.match(pattern)
@@ -7,10 +7,12 @@ gem "jets"
7
7
  gem "webpacker", git: "https://github.com/tongueroo/webpacker.git", branch: "jets"
8
8
  <% end -%>
9
9
  <% if @database == 'postgresql' %>
10
- # Include pg gem if you are using ActiveRecord, remove if you are not
10
+ # Include pg gem if you are using ActiveRecord, remove next line
11
+ # and config/database.yml file if you are not
11
12
  gem "pg", "~> 1.1.3"
12
13
  <% elsif @database == 'mysql' %>
13
- # Include mysql2 gem if you are using ActiveRecord, remove if you are not
14
+ # Include mysql2 gem if you are using ActiveRecord, remove next line
15
+ # and config/database.yml file if you are not
14
16
  gem "mysql2", "~> 0.5.2"
15
17
  <% end %>
16
18
  <% unless options[:mode] == 'job' -%>
@@ -29,20 +29,21 @@ module Jets
29
29
  json['headers'] = (headers || {}).stringify_keys
30
30
 
31
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)
32
+ json['headers']['Content-Type'] = 'application/x-www-form-urlencoded'
33
+ body = Rack::Multipart.build_multipart(params.body_params)
34
+
35
+ if body
36
+ json['headers']['Content-Length'] ||= body.length.to_s
37
+ json['headers']['Content-Type'] = "multipart/form-data; boundary=#{Rack::Multipart::MULTIPART_BOUNDARY}"
38
+ else
39
+ body = Rack::Utils.build_nested_query(params.body_params)
37
40
  end
38
- body << multipart_end
39
41
 
40
- json['body'] = Base64.encode64 body
42
+ json['body'] = Base64.encode64(body)
41
43
  json['isBase64Encoded'] = true
42
44
  end
43
45
 
44
- params.query_params.to_a.each do |e|
45
- key, value = e
46
+ params.query_params.each do |key, value|
46
47
  json['queryStringParameters'] ||= {}
47
48
  json['queryStringParameters'][key.to_s] = value.to_s
48
49
  end
@@ -50,33 +51,6 @@ module Jets
50
51
  json
51
52
  end
52
53
 
53
- def multipart_boundary
54
- @boundary ||= '-' * 16 + SecureRandom.hex(32)
55
- end
56
-
57
- def multipart_item(name:, value:)
58
- if value.is_a? File
59
- multipart_file(name: name, filename: File.basename(value.path),
60
- data: ::IO.read(value.path))
61
- else
62
- multipart_text(name: name, text: value)
63
- end
64
- end
65
-
66
- def multipart_text(name:, text:)
67
- "--#{multipart_boundary}\r\nContent-Disposition: form-data; name=\"#{name}\"\r\n"\
68
- "Content-Type: text/plain\r\n\r\n#{text}\r\n"
69
- end
70
-
71
- def multipart_file(name:, filename:, data:)
72
- "--#{multipart_boundary}\r\nContent-Disposition: form-data; name=\"#{name}\"; "\
73
- "filename=\"#{filename}\"\r\n\r\n#{data}\r\n"
74
- end
75
-
76
- def multipart_end
77
- "--#{multipart_boundary}--"
78
- end
79
-
80
54
  def find_route!
81
55
  path = self.path
82
56
  path = path[0..-2] if path.end_with? '/'
@@ -101,4 +75,4 @@ module Jets
101
75
  end
102
76
  end
103
77
  end
104
- end
78
+ end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.9.30"
2
+ VERSION = "1.9.31"
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.9.30
4
+ version: 1.9.31
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-07-16 00:00:00.000000000 Z
11
+ date: 2019-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer