fpm-fry 0.4.7 → 0.5.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: 4d3c9e551a387a09f3453921a0fb68a0a63a23b629b7ff0777addbce54682f77
4
- data.tar.gz: 69b571f675f174f2bcf45cd1a4e0c6fd38e7b72eff4b10ae4c913db6451ca366
3
+ metadata.gz: 4911dfb40c91dd585e0ccbbad499a4d71eebadd4c00846b982ed100b186c963f
4
+ data.tar.gz: 7122bfa7728cb976d3b12010e63be177ccc23d00c360c4830317369f1d1012f1
5
5
  SHA512:
6
- metadata.gz: 18e060177ce006f584080adfba77393d04143595430821ee32db7c1bc035521553476af561aad169239c8cc30cfb0b55fe2b99ad12ab3ac3ebdc4a857458c1f7
7
- data.tar.gz: 141fe4547cdf93d153ae5a7d135d32fa1bf4c343302629d1839b56c854eaad5981938a2c1c3bd4415c1d41ec20e23d1696399cdee856cb83710c3d1dfa1b1700
6
+ metadata.gz: 9e1ef45f2c7b25b759e3f170b0a3a41d745e686a8a008da43494f6c53166f9695b241f3f2e45dab5fafacfd18a88ae5320e3e7831c4114d5a5e0cbbea08cf10c
7
+ data.tar.gz: fbe991bb53e481eab8293c0631079af94795f60dc6381635448fac81aaea0b879fe97e50860688654795a820d2813fab581bc06881223514c289bdd70b9dd42f
@@ -197,7 +197,7 @@ module FPM; module Fry
197
197
  )
198
198
 
199
199
  client.post(
200
- path: client.url('containers',container,'attach?stderr=1&stdout=1&stream=1'),
200
+ path: client.url('containers',container,'attach?stderr=1&stdout=1&stream=1&logs=1'),
201
201
  body: '',
202
202
  expects: [200],
203
203
  middlewares: [
@@ -10,11 +10,9 @@ module FPM::Fry::Plugin ; module Service
10
10
 
11
11
  def render(file)
12
12
  _erbout = ""
13
- erb = ERB.new(
14
- IO.read(File.join(File.dirname(__FILE__),'..','templates',file)),
15
- 0, "-"
16
- )
17
- eval(erb.src,nil,File.join(File.dirname(__FILE__),'..','templates',file))
13
+ path = File.join(File.dirname(__FILE__),'..','templates',file)
14
+ erb = ERB.new(IO.read(path), trim_mode: "-")
15
+ eval erb.src, nil, path
18
16
  return _erbout
19
17
  end
20
18
 
@@ -44,7 +44,7 @@ module FPM; module Fry ; module Source
44
44
  base = File.expand_path(inner.prefix, base)
45
45
  end
46
46
  package.patches.each do |patch|
47
- cmd = ['patch','-N','-p1','-i',patch[:file]]
47
+ cmd = ['patch','-t','-p1','-i',patch[:file]]
48
48
  chdir = base
49
49
  if patch.key? :chdir
50
50
  given_chdir = File.expand_path(patch[:chdir],workdir)
@@ -16,38 +16,56 @@ module FPM; module Fry
16
16
  if datum[:response]
17
17
  # probably mocked
18
18
  if datum[:response][:body]
19
- @parser.parse(StringIO.new(datum[:response][:body]))
19
+ headers = datum[:response][:headers]
20
+ fake_socket = StringIO.new(datum[:response][:body])
21
+ parse_response_data(fake_socket, headers)
20
22
  end
21
- return @stack.response_call(datum)
22
23
  else
23
- socket = datum[:connection].send(:socket)
24
- begin
25
- line = socket.readline
26
- match = /^HTTP\/\d+\.\d+\s(\d{3})\s/.match(line)
27
- end while !match
28
- status = match[1].to_i
29
-
30
- datum[:response] = {
31
- :body => '',
32
- :headers => Excon::Headers.new,
33
- :status => status,
34
- :remote_ip => socket.respond_to?(:remote_ip) && socket.remote_ip,
35
- }
36
- Excon::Response.parse_headers(socket, datum)
24
+ socket, headers = extract_socket_and_headers(datum)
25
+ parse_response_data(socket, headers)
26
+ end
27
+ @stack.response_call(datum)
28
+ end
29
+
30
+ private
31
+
32
+ def extract_socket_and_headers(datum)
33
+ socket = datum[:connection].send(:socket)
34
+ begin
35
+ line = socket.readline
36
+ match = /^HTTP\/\d+\.\d+\s(\d{3})\s/.match(line)
37
+ end while !match
38
+ status = match[1].to_i
39
+
40
+ headers = Excon::Headers.new
41
+ datum[:response] = {
42
+ :body => '',
43
+ :headers => headers,
44
+ :status => status,
45
+ :remote_ip => socket.respond_to?(:remote_ip) && socket.remote_ip,
46
+ }
47
+ Excon::Response.parse_headers(socket, datum)
48
+
49
+ [socket, headers]
50
+ end
37
51
 
52
+ def parse_response_data(socket, headers)
53
+ if headers["Transfer-Encoding"] == "chunked"
54
+ @parser.parse_chunked(socket)
55
+ else
38
56
  @parser.parse(socket)
39
- return @stack.response_call(datum)
40
57
  end
41
58
  end
42
59
 
43
60
  end
44
61
 
45
- attr :out, :err
62
+ attr :out, :err, :streams
46
63
 
47
64
  def initialize(out, err)
48
65
  @out, @err = out, err
49
66
  @state = :null
50
67
  @left = 0
68
+ @streams = { 1 => out, 2 => err }
51
69
  end
52
70
 
53
71
  def new(stack)
@@ -55,8 +73,6 @@ module FPM; module Fry
55
73
  end
56
74
 
57
75
  def parse(socket)
58
- left = 0
59
- streams = {1 => out, 2 => err}
60
76
  loop do
61
77
  type = read_exactly(socket,4){|part|
62
78
  if part.bytesize == 0
@@ -94,5 +110,16 @@ module FPM; module Fry
94
110
  return buf
95
111
  end
96
112
 
113
+ def parse_chunked(socket)
114
+ loop do
115
+ line = socket.readline
116
+ chunk_size = line.chomp.to_i(16)
117
+ break if chunk_size.zero?
118
+ chunk = socket.read(chunk_size)
119
+ parse(StringIO.new(chunk))
120
+ line = socket.readline
121
+ end
122
+ end
123
+
97
124
  end
98
125
  end ; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fpm-fry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Lagresle
@@ -9,10 +9,11 @@ authors:
9
9
  - Sebastian Brandt
10
10
  - Hannes Georg
11
11
  - Julian Tabel
12
- autorequire:
12
+ - Dennis Konert
13
+ autorequire:
13
14
  bindir: bin
14
15
  cert_chain: []
15
- date: 2021-03-02 00:00:00.000000000 Z
16
+ date: 2022-07-29 00:00:00.000000000 Z
16
17
  dependencies:
17
18
  - !ruby/object:Gem::Dependency
18
19
  name: excon
@@ -34,14 +35,14 @@ dependencies:
34
35
  requirements:
35
36
  - - "~>"
36
37
  - !ruby/object:Gem::Version
37
- version: '1.0'
38
+ version: '1.13'
38
39
  type: :runtime
39
40
  prerelease: false
40
41
  version_requirements: !ruby/object:Gem::Requirement
41
42
  requirements:
42
43
  - - "~>"
43
44
  - !ruby/object:Gem::Version
44
- version: '1.0'
45
+ version: '1.13'
45
46
  - !ruby/object:Gem::Dependency
46
47
  name: rake
47
48
  requirement: !ruby/object:Gem::Requirement
@@ -60,22 +61,22 @@ dependencies:
60
61
  name: rspec
61
62
  requirement: !ruby/object:Gem::Requirement
62
63
  requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: 3.0.0
66
64
  - - "~>"
67
65
  - !ruby/object:Gem::Version
68
66
  version: '3.0'
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 3.0.0
69
70
  type: :development
70
71
  prerelease: false
71
72
  version_requirements: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 3.0.0
76
74
  - - "~>"
77
75
  - !ruby/object:Gem::Version
78
76
  version: '3.0'
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 3.0.0
79
80
  - !ruby/object:Gem::Dependency
80
81
  name: webmock
81
82
  requirement: !ruby/object:Gem::Requirement
@@ -94,32 +95,32 @@ dependencies:
94
95
  name: coveralls
95
96
  requirement: !ruby/object:Gem::Requirement
96
97
  requirements:
97
- - - "~>"
98
+ - - ">="
98
99
  - !ruby/object:Gem::Version
99
- version: '0'
100
+ version: 0.8.23
100
101
  type: :development
101
102
  prerelease: false
102
103
  version_requirements: !ruby/object:Gem::Requirement
103
104
  requirements:
104
- - - "~>"
105
+ - - ">="
105
106
  - !ruby/object:Gem::Version
106
- version: '0'
107
+ version: 0.8.23
107
108
  - !ruby/object:Gem::Dependency
108
109
  name: simplecov
109
110
  requirement: !ruby/object:Gem::Requirement
110
111
  requirements:
111
- - - "~>"
112
+ - - ">="
112
113
  - !ruby/object:Gem::Version
113
114
  version: '0'
114
115
  type: :development
115
116
  prerelease: false
116
117
  version_requirements: !ruby/object:Gem::Requirement
117
118
  requirements:
118
- - - "~>"
119
+ - - ">="
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  description: deep-fried package builder
122
- email: maxime.lagresle@xing.com
123
+ email: dennis.konert@new-work.se
123
124
  executables:
124
125
  - fpm-fry
125
126
  extensions: []
@@ -181,7 +182,7 @@ homepage: https://github.com/xing/fpm-fry
181
182
  licenses:
182
183
  - MIT
183
184
  metadata: {}
184
- post_install_message:
185
+ post_install_message:
185
186
  rdoc_options: []
186
187
  require_paths:
187
188
  - lib
@@ -196,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  - !ruby/object:Gem::Version
197
198
  version: '0'
198
199
  requirements: []
199
- rubygems_version: 3.0.3
200
- signing_key:
200
+ rubygems_version: 3.3.15
201
+ signing_key:
201
202
  specification_version: 4
202
203
  summary: FPM Fry
203
204
  test_files: []