uri-amqp 1.0.1 → 1.0.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
- SHA1:
3
- metadata.gz: f7de338a32e3ba26d0f93225ed1d37999a1dc693
4
- data.tar.gz: 3d0f71029080bfb8e24d086bcfcacab932e9f602
2
+ SHA256:
3
+ metadata.gz: b0908c708c9be720494c5eed8d83fb1d790bce2f25de4fb3b3d95442f4270b69
4
+ data.tar.gz: 9c1d2a089ab7d5a139f5ef292eca89c40cb96cbb56e7d09d05437ec28ddbb05e
5
5
  SHA512:
6
- metadata.gz: c870fba77bfdd9d8db92648080d07f5002bd704ae6826b5cbfc21ab10e5ea8f229ba297c3dc230b9a820a182c13a01c6ff0808a05de449c24b7d73e144abcc12
7
- data.tar.gz: 44bcacbb30d973c4fc4d1f4e6210a911ae134b6d91196f4919a0c40cc2774fd67d2a315e96239372807ad617f708827c8170e36594f1ef97d93362af0b2e0ca4
6
+ metadata.gz: 79426c0f1faa0f4cd0b5ef3f7dc625fecda95a0a03c03528e04238a07c07cd63121d14e1d43592fe730bbc2d8c59938b8e515b5a3da38e764c612a90090ac8f6
7
+ data.tar.gz: 9d04391e7d84f29a62ddaaaed181387d0b0ce5f159c2b04eb54d0132db4fd94224862d5175f9f60a4cd5d3df15749659bf23ffbee05bff894cb7f8fe405de704
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+
4
+ Style/StringLiterals:
5
+ Enabled: false
6
+
7
+ Style/Documentation:
8
+ Enabled: false
9
+
10
+ Naming/AccessorMethodName:
11
+ Enabled: false
12
+
13
+ Metrics/ClassLength:
14
+ Max: 200
15
+
16
+ Metrics/BlockLength:
17
+ Enabled: false
18
+
19
+ Metrics/LineLength:
20
+ Enabled: false
@@ -1,10 +1,13 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.5
4
5
  - 2.4
5
6
  - 2.3
6
- - 2.2
7
7
  before_install: gem install bundler -v 1.16.0
8
+ script:
9
+ - bundle exec rake
10
+ - bundle exec rubocop
8
11
 
9
12
  notifications:
10
13
  email: false
@@ -0,0 +1,13 @@
1
+ ## [Unreleased]
2
+
3
+ - Add frozen string literal pragma
4
+ - Add gem downloads badge
5
+ - Add travis build status badge
6
+
7
+ ## [1.0.1] - 2017-12-19
8
+
9
+ - Add gem version badge
10
+
11
+ ## [1.0.0] - 2017-12-19
12
+
13
+ - Init
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in uri-amqp.gemspec
6
8
  gemspec
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/uri-amqp.svg)](https://badge.fury.io/rb/uri-amqp)
2
+ [![Build Status](https://travis-ci.org/Tensho/uri-amqp.svg?branch=master)](https://travis-ci.org/Tensho/uri-amqp)
3
+ [![Gem Downloads](https://img.shields.io/gem/dt/uri-amqp.svg)](https://rubygems.org/gems/uri-amqp)
4
+
2
5
 
3
6
  # URI::AMQP
4
7
 
@@ -26,45 +29,45 @@ Or install it yourself as:
26
29
  As any other URI (HTTP, FTP, LDAP) you may call `URI.parse` with string argument and it will automatically detect scheme and return `URI::AMQP` or `URI::AMQPS` instance.
27
30
 
28
31
  ```ruby
29
- uri = URI.parse("amqps://user:pass@host/vhost?heartbeat=10&connection_timeout=100&channel_max=1000&certfile=/examples/tls/client_cert.pem&keyfile=/examples/tls/client_key.pem")
32
+ > uri = URI.parse("amqps://user:pass@host/vhost?heartbeat=10&connection_timeout=100&channel_max=1000&certfile=/examples/tls/client_cert.pem&keyfile=/examples/tls/client_key.pem")
30
33
  => #<URI::AMQPS amqps://user:pass@host/vhost?heartbeat=10&connection_timeout=100&channel_max=1000&certfile=/examples/tls/client_cert.pem&keyfile=/examples/tls/client_key.pem>
31
- uri.scheme
34
+ > uri.scheme
32
35
  => "amqp"
33
- uri.user
36
+ > uri.user
34
37
  => "user"
35
- uri.password
38
+ > uri.password
36
39
  => "pass"
37
- uri.host
40
+ > uri.host
38
41
  => "host"
39
- uri.vhost
42
+ > uri.vhost
40
43
  => "vhost"
41
- uri.vhost
44
+ > uri.vhost
42
45
  => "vhost"
43
- uri.heartbeat
46
+ > uri.heartbeat
44
47
  => 10
45
- uri.connection_timeout
48
+ > uri.connection_timeout
46
49
  => 100
47
- uri.channel_max
50
+ > uri.channel_max
48
51
  => 1000
49
- uri.verify
52
+ > uri.verify
50
53
  => false
51
- uri.fail_if_no_peer_cert
54
+ > uri.fail_if_no_peer_cert
52
55
  => false
53
- uri.cacertfile
56
+ > uri.cacertfile
54
57
  => nil
55
- uri.certfile
58
+ > uri.certfile
56
59
  => "/examples/tls/client_cert.pem"
57
- uri.keyfile
60
+ > uri.keyfile
58
61
  => "/examples/tls/client_key.pem"
59
62
  ```
60
63
 
61
64
  There are also implemented some checks:
62
65
 
63
- ```
64
- uri = URI.parse("amqp://host/vhost/hurricane")
66
+ ```ruby
67
+ > URI.parse("amqp://host/vhost/hurricane")
65
68
  => URI::InvalidComponentError: bad vhost (expected only leading "/"): /vhost/hurricane
66
69
 
67
- uri = URI.parse("amqp://host/vhost?certfile=/examples/tls/client_cert.pem&keyfile=/examples/tls/client_key.pem")
70
+ > URI.parse("amqp://host/vhost?certfile=/examples/tls/client_cert.pem&keyfile=/examples/tls/client_key.pem")
68
71
  => URI::InvalidComponentError: bad certfile (expected only in "amqps" schema): /examples/tls/client_cert.pem
69
72
  ```
70
73
 
@@ -76,10 +79,16 @@ uri = URI.parse("amqp://host/vhost?certfile=/examples/tls/client_cert.pem&keyfil
76
79
 
77
80
  ## Development
78
81
 
79
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
82
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
80
83
 
81
84
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
82
85
 
86
+ Run `bundle exec rubocop` before PR opening.
87
+
88
+ ## Testing
89
+
90
+ $ rake
91
+
83
92
  ## Contributing
84
93
 
85
94
  Bug reports and pull requests are welcome on GitHub at https://github.com/Tensho/uri-amqp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "uri/amqp"
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "cgi"
2
4
  require "uri/generic"
3
5
 
6
+ # https://www.rabbitmq.com/protocol.html
7
+ # https://www.rabbitmq.com/uri-spec.html
8
+ # https://www.rabbitmq.com/uri-query-parameters.html
4
9
  module URI
5
10
  class AMQP < Generic
6
- VERSION = "1.0.1"
7
-
8
11
  DEFAULT_PORT = 5672
9
12
 
10
13
  COMPONENT = %i[
@@ -73,44 +76,41 @@ module URI
73
76
  protected
74
77
 
75
78
  def set_userinfo(user, password = nil)
76
- user &&= CGI::unescape(user)
77
- password &&= CGI::unescape(password)
79
+ user &&= CGI.unescape(user)
80
+ password &&= CGI.unescape(password)
78
81
  super(user, password)
79
82
  end
80
83
 
81
84
  def set_user(value)
82
- super(value && CGI::unescape(value))
85
+ super(value && CGI.unescape(value))
83
86
  end
84
87
 
85
88
  def set_host(value)
86
- super(value && CGI::unescape(value))
89
+ super(value && CGI.unescape(value))
87
90
  end
88
91
 
89
92
  def set_vhost(value)
90
- @vhost = if value
91
- value.delete!('/')
92
- CGI::unescape(value)
93
- end
93
+ @vhost = value && CGI.unescape(value.delete('/'))
94
94
  end
95
95
 
96
96
  def set_heartbeat(value)
97
- @heartbeat = value && value.to_i
97
+ @heartbeat = value&.to_i
98
98
  end
99
99
 
100
100
  def set_connection_timeout(value)
101
- @connection_timeout = value && value.to_i
101
+ @connection_timeout = value&.to_i
102
102
  end
103
103
 
104
104
  def set_channel_max(value)
105
- @channel_max = value && value.to_i
105
+ @channel_max = value&.to_i
106
106
  end
107
107
 
108
108
  def set_verify(value)
109
- @verify = !!(value)
109
+ @verify = !value.nil?
110
110
  end
111
111
 
112
112
  def set_fail_if_no_peer_cert(value)
113
- @fail_if_no_peer_cert = !!(value)
113
+ @fail_if_no_peer_cert = !value.nil?
114
114
  end
115
115
 
116
116
  def set_cacertfile(value)
@@ -150,7 +150,7 @@ module URI
150
150
  end
151
151
 
152
152
  def check_vhost(value)
153
- raise InvalidComponentError, "bad vhost (expected only leading \"/\"): #{value}" if value && !(value =~ %r{^/[^/]*$})
153
+ raise InvalidComponentError, "bad vhost (expected only leading \"/\"): #{value}" if value && value !~ %r{^/[^/]*$}
154
154
  end
155
155
 
156
156
  %i[
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module URI
4
+ class AMQP < Generic
5
+ VERSION = '1.0.2'
6
+ end
7
+ end
@@ -1,23 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "uri/amqp"
2
4
 
5
+ # https://www.rabbitmq.com/protocol.html
6
+ # https://www.rabbitmq.com/uri-spec.html
7
+ # https://www.rabbitmq.com/uri-query-parameters.html
8
+ # https://www.rabbitmq.com/ssl.html
3
9
  module URI
4
10
  class AMQPS < AMQP
5
11
  DEFAULT_PORT = 5671
6
12
 
7
- def check_verify(_)
8
- end
13
+ # rubocop:disable Naming/UncommunicativeMethodParamName
14
+ def check_verify(_); end
9
15
 
10
- def check_fail_if_no_peer_cert(_)
11
- end
16
+ def check_fail_if_no_peer_cert(_); end
12
17
 
13
- def check_cacertfile(_)
14
- end
18
+ def check_cacertfile(_); end
15
19
 
16
- def check_certfile(_)
17
- end
20
+ def check_certfile(_); end
18
21
 
19
- def check_keyfile(_)
20
- end
22
+ def check_keyfile(_); end
23
+ # rubocop:enable Naming/UncommunicativeMethodParamName
21
24
  end
22
25
 
23
26
  @@schemes["AMQPS"] = AMQPS
@@ -1,6 +1,9 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
6
+ require "uri/amqp/version"
4
7
  require "uri/amqp"
5
8
  require "uri/amqps"
6
9
 
@@ -10,31 +13,32 @@ Gem::Specification.new do |spec|
10
13
  spec.authors = ["Andrew Babichev"]
11
14
  spec.email = ["andrew.babichev@gmail.com"]
12
15
 
13
- spec.summary = %q{URI::AMQP}
14
- spec.description = %q{URI stdlib module extension for AMQP}
16
+ spec.summary = "URI::AMQP"
17
+ spec.description = "URI stdlib module extension for AMQP"
15
18
  spec.homepage = "https://github.com/Tensho/uri-amqp"
16
19
  spec.license = "MIT"
17
20
 
18
21
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
22
  # to allow pushing to a single host or delete this section to allow pushing to any host.
20
- if spec.respond_to?(:metadata)
23
+ if spec.respond_to?(:metadata) # rubocop:disable Style/GuardClause
21
24
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
22
25
  else
23
26
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
24
27
  end
25
28
 
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
29
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
30
  f.match(%r{^(test|spec|features)/})
28
31
  end
29
32
  spec.bindir = "exe"
30
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
34
  spec.require_paths = ["lib"]
32
35
 
33
- spec.required_ruby_version = "> 2.2"
36
+ spec.required_ruby_version = ">= 2.3.0"
34
37
 
35
38
  spec.add_development_dependency "bundler", "~> 1.16"
39
+ spec.add_development_dependency "pry-byebug"
36
40
  spec.add_development_dependency "rake", "~> 10.0"
37
41
  spec.add_development_dependency "rspec", "~> 3.0"
38
42
  spec.add_development_dependency "rspec-its", "~> 1.2.0"
39
- spec.add_development_dependency "pry-byebug"
43
+ spec.add_development_dependency "rubocop"
40
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri-amqp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Babichev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry-byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: 1.2.0
69
83
  - !ruby/object:Gem::Dependency
70
- name: pry-byebug
84
+ name: rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -89,7 +103,9 @@ extra_rdoc_files: []
89
103
  files:
90
104
  - ".gitignore"
91
105
  - ".rspec"
106
+ - ".rubocop.yml"
92
107
  - ".travis.yml"
108
+ - CHANGELOG.md
93
109
  - CODE_OF_CONDUCT.md
94
110
  - Gemfile
95
111
  - LICENSE.txt
@@ -98,6 +114,7 @@ files:
98
114
  - bin/console
99
115
  - bin/setup
100
116
  - lib/uri/amqp.rb
117
+ - lib/uri/amqp/version.rb
101
118
  - lib/uri/amqps.rb
102
119
  - uri-amqp.gemspec
103
120
  homepage: https://github.com/Tensho/uri-amqp
@@ -111,9 +128,9 @@ require_paths:
111
128
  - lib
112
129
  required_ruby_version: !ruby/object:Gem::Requirement
113
130
  requirements:
114
- - - ">"
131
+ - - ">="
115
132
  - !ruby/object:Gem::Version
116
- version: '2.2'
133
+ version: 2.3.0
117
134
  required_rubygems_version: !ruby/object:Gem::Requirement
118
135
  requirements:
119
136
  - - ">="
@@ -121,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
138
  version: '0'
122
139
  requirements: []
123
140
  rubyforge_project:
124
- rubygems_version: 2.6.13
141
+ rubygems_version: 2.7.6
125
142
  signing_key:
126
143
  specification_version: 4
127
144
  summary: URI::AMQP