rest-builder 0.9.1 → 0.9.2

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
  SHA1:
3
- metadata.gz: b5a80d7a9fd8f641f920acfeace75de0ab11e7e9
4
- data.tar.gz: 34decd03355b243e14286515bcfa91613d407081
3
+ metadata.gz: da0d685dc9b0f4d31788b61f599ef824e980f71f
4
+ data.tar.gz: 4408874a7b33bedb2192d39985b9a03ce0193edc
5
5
  SHA512:
6
- metadata.gz: 3afab745cc747df73b61bba504f5e95ac1e61bbb32175164b70d430308c3bcb85ec783906c24183cdffa45ce96c9f15c2f646fc4f1e8c6c4966d9b5b1e1c384a
7
- data.tar.gz: ae7afa259339c3d5376df6f2226f10f773161c33c692316de06130becc0f2c6e5496babac08ef4696a8821cdf343aa933a19164a22b8e5bf23ae1665154fc598
6
+ metadata.gz: 79b87403cf20b25ac437b57b7a2e96d1130dded6db3420451c41adc6ede32aa3b9ac0c84dad8004fb5e15a8945129c5f2d5c619b9cec96ae0152ac063c38688c
7
+ data.tar.gz: d85d3fbcd9b34b2d9357e9f4d029f4de104a8a1030d281dfa08900600d77c50841aeb1a5cac56d9b345630542cc573ab2e5a86e00c2b2e2279ae21a84502f12a
@@ -1,10 +1,5 @@
1
1
  sudo: false
2
2
  language: ruby
3
- rvm:
4
- - 2.2
5
- - 2.3.0
6
- - rbx
7
- - jruby-9
8
3
 
9
4
  before_install:
10
5
  - rvm get head
@@ -12,3 +7,15 @@ before_install:
12
7
  - rvm use --install $TRAVIS_RUBY_VERSION --binary --latest
13
8
  install: 'gem install bundler; bundle install --retry=3'
14
9
  script: 'ruby -vr bundler/setup -S rake test'
10
+
11
+ matrix:
12
+ include:
13
+ - rvm: 2.2.5
14
+ - rvm: 2.3.2
15
+ - rvm: 2.4.1
16
+ - rvm: jruby-9
17
+ env: JRUBY_OPTS=--debug
18
+ - rvm: rbx
19
+
20
+ allow_failures:
21
+ - rvm: rbx
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGES
2
2
 
3
+ ## rest-builder 0.9.2 -- 2017-08-05
4
+
5
+ * Attach payload for DELETE request as well. See:
6
+ [A payload within a DELETE request is ignored resulting "Invalid request data" from web services](https://github.com/godfat/rest-core/issues/25)
7
+
3
8
  ## rest-builder 0.9.1 -- 2016-03-04
4
9
 
5
10
  * `Promise.set_backtrace` for errors from `event_source`.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # rest-builder [![Build Status](https://secure.travis-ci.org/godfat/rest-builder.png?branch=master)](http://travis-ci.org/godfat/rest-builder) [![Coverage Status](https://coveralls.io/repos/godfat/rest-builder/badge.png)](https://coveralls.io/r/godfat/rest-builder) [![Join the chat at https://gitter.im/godfat/rest-builder](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/godfat/rest-builder)
1
+ # rest-builder [![Build Status](https://secure.travis-ci.org/godfat/rest-builder.png?branch=master)](http://travis-ci.org/godfat/rest-builder) [![Coverage Status](https://coveralls.io/repos/github/godfat/rest-builder/badge.png)](https://coveralls.io/github/godfat/rest-builder) [![Join the chat at https://gitter.im/godfat/rest-builder](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/godfat/rest-builder)
2
2
 
3
3
  by Lin Jen-Shin ([godfat](http://godfat.org))
4
4
 
@@ -7,6 +7,7 @@ by Lin Jen-Shin ([godfat](http://godfat.org))
7
7
  * [github](https://github.com/godfat/rest-builder)
8
8
  * [rubygems](https://rubygems.org/gems/rest-builder)
9
9
  * [rdoc](http://rdoc.info/projects/godfat/rest-builder)
10
+ * [issues](https://github.com/godfat/rest-builder/issues) (feel free to ask for support)
10
11
 
11
12
  ## DESCRIPTION:
12
13
 
@@ -560,9 +561,9 @@ the priority here is:
560
561
 
561
562
  ## LICENSE:
562
563
 
563
- Apache License 2.0
564
+ Apache License 2.0 (Apache-2.0)
564
565
 
565
- Copyright (c) 2016, Lin Jen-Shin (godfat)
566
+ Copyright (c) 2016-2017, Lin Jen-Shin (godfat)
566
567
 
567
568
  Licensed under the Apache License, Version 2.0 (the "License");
568
569
  you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -1,21 +1,16 @@
1
1
 
2
2
  begin
3
- require "#{dir = File.dirname(__FILE__)}/task/gemgem"
3
+ require "#{__dir__}/task/gemgem"
4
4
  rescue LoadError
5
5
  sh 'git submodule update --init --recursive'
6
6
  exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
7
7
  end
8
8
 
9
- $LOAD_PATH.unshift(File.expand_path("#{dir}/promise_pool/lib"))
10
-
11
- Gemgem.init(dir) do |s|
9
+ Gemgem.init(__dir__, :submodules => %w[promise_pool]) do |s|
12
10
  require 'rest-builder/version'
13
11
  s.name = 'rest-builder'
14
12
  s.version = RestBuilder::VERSION
15
- %w[promise_pool httpclient mime-types].each do |g|
16
- s.add_runtime_dependency(g)
17
- end
18
13
 
19
- # exclude promise_pool
20
- s.files.reject!{ |f| f.start_with?('promise_pool/') }
14
+ %w[promise_pool httpclient mime-types].
15
+ each(&s.method(:add_runtime_dependency))
21
16
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  module RestBuilder
3
3
  module Middleware
4
- METHODS_WITH_PAYLOAD = [:post, :put, :patch]
4
+ METHODS_WITH_PAYLOAD = [:post, :put, :patch, :delete]
5
5
 
6
6
  def self.included mod
7
7
  mod.send(:attr_reader, :app)
@@ -5,10 +5,11 @@ require 'pork/auto'
5
5
  require 'muack'
6
6
  require 'webmock'
7
7
 
8
+ WebMock.enable!
8
9
  WebMock.disable_net_connect!(:allow_localhost => true)
9
- Pork::Executor.include(Muack::API, WebMock::API)
10
+ Pork::Suite.include(Muack::API, WebMock::API)
10
11
 
11
- class Pork::Executor
12
+ class Pork::Suite
12
13
  def with_img
13
14
  f = Tempfile.new(['img', '.jpg'])
14
15
  n = File.basename(f.path)
@@ -1,4 +1,4 @@
1
1
 
2
2
  module RestBuilder
3
- VERSION = '0.9.1'
3
+ VERSION = '0.9.2'
4
4
  end
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: rest-builder 0.9.1 ruby lib
2
+ # stub: rest-builder 0.9.2 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "rest-builder".freeze
6
- s.version = "0.9.1"
6
+ s.version = "0.9.2"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Lin Jen-Shin (godfat)".freeze]
11
- s.date = "2016-03-04"
11
+ s.date = "2017-08-05"
12
12
  s.description = "Modular Ruby clients interface for REST APIs.\n\nBuild your own API clients for less dependencies, less codes, less memory,\nless conflicts, and run faster. Checkout [rest-core][] for pre-built\nmiddleware and [rest-more][] for pre-built clients.\n\n[rest-core]: https://github.com/godfat/rest-core\n[rest-more]: https://github.com/godfat/rest-more".freeze
13
13
  s.email = ["godfat (XD) godfat.org".freeze]
14
14
  s.files = [
@@ -42,8 +42,8 @@ Gem::Specification.new do |s|
42
42
  "test/test_httpclient.rb".freeze,
43
43
  "test/test_payload.rb".freeze]
44
44
  s.homepage = "https://github.com/godfat/rest-builder".freeze
45
- s.licenses = ["Apache License 2.0".freeze]
46
- s.rubygems_version = "2.6.1".freeze
45
+ s.licenses = ["Apache-2.0".freeze]
46
+ s.rubygems_version = "2.6.12".freeze
47
47
  s.summary = "Modular Ruby clients interface for REST APIs.".freeze
48
48
  s.test_files = [
49
49
  "test/test_builder.rb".freeze,
@@ -4,16 +4,16 @@
4
4
 
5
5
  Provided tasks:
6
6
 
7
- rake clean # Remove ignored files
7
+ rake clean # Trash ignored files
8
8
  rake gem:build # Build gem
9
9
  rake gem:install # Install gem
10
10
  rake gem:release # Release gem
11
11
  rake gem:spec # Generate gemspec
12
- rake test # Run tests in memory
12
+ rake test # Run tests
13
13
 
14
14
  ## REQUIREMENTS:
15
15
 
16
- * Tested with MRI (official CRuby) 1.9.3, 2.0.0, Rubinius and JRuby.
16
+ * Tested with MRI (official CRuby), Rubinius and JRuby.
17
17
 
18
18
  ## INSTALLATION:
19
19
 
@@ -23,13 +23,13 @@ And in Rakefile:
23
23
 
24
24
  ``` ruby
25
25
  begin
26
- require "#{dir = File.dirname(__FILE__)}/task/gemgem"
26
+ require "#{__dir__}/task/gemgem"
27
27
  rescue LoadError
28
- sh 'git submodule update --init'
28
+ sh 'git submodule update --init --recursive'
29
29
  exec Gem.ruby, '-S', $PROGRAM_NAME, *ARGV
30
30
  end
31
31
 
32
- Gemgem.init(dir) do |s|
32
+ Gemgem.init(__dir__, :submodules => %w[your-dep]) do |s|
33
33
  s.name = 'your-gem'
34
34
  s.version = '0.1.0'
35
35
  end
@@ -37,9 +37,9 @@ end
37
37
 
38
38
  ## LICENSE:
39
39
 
40
- Apache License 2.0
40
+ Apache License 2.0 (Apache-2.0)
41
41
 
42
- Copyright (c) 2011-2013, Lin Jen-Shin (godfat)
42
+ Copyright (c) 2011-2017, Lin Jen-Shin (godfat)
43
43
 
44
44
  Licensed under the Apache License, Version 2.0 (the "License");
45
45
  you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Gemgem
3
3
  class << self
4
- attr_accessor :dir, :spec, :spec_create
4
+ attr_accessor :dir, :spec, :submodules, :spec_create
5
5
  end
6
6
 
7
7
  module_function
@@ -11,12 +11,14 @@ module Gemgem
11
11
  def pkg_dir ; "#{dir}/pkg" ; end
12
12
  def escaped_dir; @escaped_dir ||= Regexp.escape(dir); end
13
13
 
14
- def init dir, &block
14
+ def init dir, options={}, &block
15
15
  self.dir = dir
16
- $LOAD_PATH.unshift("#{dir}/lib")
17
16
  ENV['RUBYLIB'] = "#{dir}/lib:#{ENV['RUBYLIB']}"
18
17
  ENV['PATH'] = "#{dir}/bin:#{ENV['PATH']}"
18
+ self.submodules = options[:submodules] || []
19
19
  self.spec_create = block
20
+
21
+ $LOAD_PATH.unshift("#{dir}/lib", *submodules_libs)
20
22
  end
21
23
 
22
24
  def create
@@ -26,7 +28,7 @@ module Gemgem
26
28
 
27
29
  s.description = description.join
28
30
  s.summary = description.first
29
- s.license = readme['LICENSE'].sub(/.+\n\n/, '').lines.first.strip
31
+ s.license = license
30
32
 
31
33
  s.date = Time.now.strftime('%Y-%m-%d')
32
34
  s.files = gem_files
@@ -115,6 +117,7 @@ module Gemgem
115
117
  SimpleCov.start do
116
118
  add_filter('test/')
117
119
  add_filter('test.rb')
120
+ submodules_libs.each(&method(:add_filter))
118
121
  end
119
122
  end
120
123
 
@@ -159,11 +162,15 @@ module Gemgem
159
162
  end
160
163
 
161
164
  def strip_home_path path
162
- path.sub(ENV['HOME'], '~')
165
+ path.sub(/\A#{Regexp.escape(ENV['HOME'])}\//, '~/')
163
166
  end
164
167
 
165
168
  def strip_cwd_path path
166
- path.sub(Dir.pwd, '.')
169
+ path.sub(/\A#{Regexp.escape(Dir.pwd)}\//, '')
170
+ end
171
+
172
+ def submodules_libs
173
+ submodules.map{ |path| "#{dir}/#{path}/lib" }
167
174
  end
168
175
 
169
176
  def git *args
@@ -201,6 +208,11 @@ module Gemgem
201
208
  @description ||= (readme['DESCRIPTION']||'').sub(/.+\n\n/, '').lines.to_a
202
209
  end
203
210
 
211
+ def license
212
+ readme['LICENSE'].sub(/.+\n\n/, '').lines.first.
213
+ split(/[()]/).map(&:strip).reject(&:empty?).last
214
+ end
215
+
204
216
  def all_files
205
217
  @all_files ||= fold_files(glob).sort
206
218
  end
@@ -221,7 +233,8 @@ module Gemgem
221
233
 
222
234
  def gem_files
223
235
  @gem_files ||= all_files.reject{ |f|
224
- f =~ ignored_pattern && !git_files.include?(f)
236
+ f =~ submodules_pattern ||
237
+ (f =~ ignored_pattern && !git_files.include?(f))
225
238
  }
226
239
  end
227
240
 
@@ -253,6 +266,15 @@ module Gemgem
253
266
  end
254
267
  end
255
268
 
269
+ def submodules_pattern
270
+ @submodules_pattern ||= if submodules.empty?
271
+ /^$/
272
+ else
273
+ Regexp.new(submodules.map{ |path|
274
+ "^#{Regexp.escape(path)}/" }.join('|'))
275
+ end
276
+ end
277
+
256
278
  def expand_patterns pathes
257
279
  # http://git-scm.com/docs/gitignore
258
280
  pathes.flat_map{ |path|
@@ -179,34 +179,32 @@ describe RestBuilder::Client do
179
179
  error.should.kind_of?(Errno::ECONNREFUSED)
180
180
  end
181
181
 
182
- path = 'http://example.com/'
183
-
184
182
  would 'give RESPONSE_BODY' do
185
- stub_request(:get, path).to_return(:body => 'OK')
186
- simple.new.get(path).should.eq 'OK'
183
+ stub_request(:get, url).to_return(:body => 'OK')
184
+ simple.new.get(url).should.eq 'OK'
187
185
  end
188
186
 
189
187
  would 'give RESPONSE_HEADERS' do
190
- stub_request(:head, path).to_return(:headers => {'A' => 'B'})
191
- simple.new.head(path).should.eq 'A' => 'B'
188
+ stub_request(:head, url).to_return(:headers => {'A' => 'B'})
189
+ simple.new.head(url).should.eq 'A' => 'B'
192
190
  end
193
191
 
194
192
  would 'give RESPONSE_HEADERS' do
195
- stub_request(:get, path).to_return(:status => 199)
196
- simple.new.get(path, {},
193
+ stub_request(:get, url).to_return(:status => 199)
194
+ simple.new.get(url, {},
197
195
  RestBuilder::RESPONSE_KEY => RestBuilder::RESPONSE_STATUS).should.eq 199
198
196
  end
199
197
 
200
198
  would 'give RESPONSE_SOCKET' do
201
- stub_request(:get, path).to_return(:body => 'OK')
202
- simple.new.get(path, {}, RestBuilder::HIJACK => true).read.should.eq 'OK'
199
+ stub_request(:get, url).to_return(:body => 'OK')
200
+ simple.new.get(url, {}, RestBuilder::HIJACK => true).read.should.eq 'OK'
203
201
  end
204
202
 
205
203
  would 'give REQUEST_URI' do
206
- stub_request(:get, "#{path}?a=b").to_return(:body => 'OK')
207
- simple.new.get(path, {:a => 'b'},
204
+ stub_request(:get, "#{url}?a=b").to_return(:body => 'OK')
205
+ simple.new.get(url, {:a => 'b'},
208
206
  RestBuilder::RESPONSE_KEY => RestBuilder::REQUEST_URI).
209
- should.eq "#{path}?a=b"
207
+ should.eq "#{url}?a=b"
210
208
  simple.wait
211
209
  end
212
210
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2017-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: promise_pool
@@ -98,7 +98,7 @@ files:
98
98
  - test/test_payload.rb
99
99
  homepage: https://github.com/godfat/rest-builder
100
100
  licenses:
101
- - Apache License 2.0
101
+ - Apache-2.0
102
102
  metadata: {}
103
103
  post_install_message:
104
104
  rdoc_options: []
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.6.1
119
+ rubygems_version: 2.6.12
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Modular Ruby clients interface for REST APIs.