amqurl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bea5d94072cb06dd3ca2f9c6464a3e7d88237a39
4
+ data.tar.gz: 811933e999cb8c36c6ef75d1e250a4dd3f09820a
5
+ SHA512:
6
+ metadata.gz: 9930bc9e8f133e9809f6074e393d2083ef5a86a519010daf2d2e9df24db1eac9155fc095a112fcd6e7fe39f9af6eea5818aba2ecec7eb8d6ba3d679c90306e80
7
+ data.tar.gz: f8dd684c79a8fe5ba256f6f677118798cc98e91d283cffb59b9ba8dc814d8d30e6a7b2bb8af5d173e80497b082d168fb20619f71864dadad136b6a191183bddb
@@ -0,0 +1,3 @@
1
+ # 0.0.1
2
+
3
+ * Initial version
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # gem "rack-amqp-client", path: '../rack-amqp-client'
6
+ gem "rack-amqp-client"
7
+ gem "httparty"
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ amqurl (0.0.1)
5
+ rack-amqp-client
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ amq-protocol (1.9.2)
11
+ bunny (1.2.1)
12
+ amq-protocol (>= 1.9.2)
13
+ coderay (1.1.0)
14
+ diff-lcs (1.2.5)
15
+ docile (1.1.3)
16
+ emoji-rspec (1.0.1)
17
+ rspec-core (>= 2.10)
18
+ httparty (0.12.0)
19
+ json (~> 1.8)
20
+ multi_xml (>= 0.5.2)
21
+ json (1.8.1)
22
+ method_source (0.8.2)
23
+ multi_json (1.9.2)
24
+ multi_xml (0.5.5)
25
+ pry (0.9.12.6)
26
+ coderay (~> 1.0)
27
+ method_source (~> 0.8)
28
+ slop (~> 3.4)
29
+ rack-amqp-client (0.0.1)
30
+ bunny
31
+ rake (10.1.0)
32
+ rspec (2.14.1)
33
+ rspec-core (~> 2.14.0)
34
+ rspec-expectations (~> 2.14.0)
35
+ rspec-mocks (~> 2.14.0)
36
+ rspec-core (2.14.8)
37
+ rspec-expectations (2.14.5)
38
+ diff-lcs (>= 1.1.3, < 2.0)
39
+ rspec-mocks (2.14.6)
40
+ simplecov (0.8.2)
41
+ docile (~> 1.1.0)
42
+ multi_json
43
+ simplecov-html (~> 0.8.0)
44
+ simplecov-html (0.8.0)
45
+ slop (3.5.0)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ amqurl!
52
+ bundler (~> 1.3)
53
+ emoji-rspec
54
+ httparty
55
+ pry
56
+ rack-amqp-client
57
+ rake
58
+ rspec
59
+ simplecov
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Optoro, Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # Rack-AMQP-Curl
2
+
3
+ `amqurl` is a script that mimics curl against rack-amqp served apps
4
+
5
+ Run with:
6
+
7
+ `bundle exec bin/amqurl <amqp queue name>/<path and query>`
8
+
9
+ I also provide a client, `Rack::AMQP::Curl::Client`, docs to come.
10
+
11
+ This will spawn eventmachine!
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rack/amqp/curl/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "amqurl"
8
+ spec.version = Rack::AMQP::Curl::VERSION
9
+ spec.authors = ["Joshua Szmajda"]
10
+ spec.email = ["josh@optoro.com"]
11
+ spec.description = %q{AMQP-HTTP compliant curl clone}
12
+ spec.summary = spec.description
13
+ spec.homepage = "https://github.com/rack-amqp/amqurl"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rack-amqp-client"
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "emoji-rspec"
26
+ spec.add_development_dependency "simplecov"
27
+ spec.add_development_dependency "pry"
28
+ end
@@ -0,0 +1,23 @@
1
+ require 'benchmark'
2
+ require 'httparty'
3
+ require 'rack/amqp/curl'
4
+ require 'rack/amqp/client'
5
+
6
+
7
+ n = 5_000
8
+
9
+ Benchmark.bm do |bm|
10
+
11
+ bm.report("HTTP:") do
12
+ n.times do
13
+ HTTParty.get("http://localhost:9292/users.json")
14
+ end
15
+ end
16
+ bm.report("AMQP") do
17
+ Rack::AMQP::Client.with_client(host: 'localhost') do |client|
18
+ n.times do
19
+ client.request('test.simple/users.json', {http_method: 'GET'})
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+ require 'pp'
5
+ require 'rack/amqp/curl'
6
+
7
+ connection_options = {
8
+ host: 'localhost',
9
+ timeout: 5,
10
+ }
11
+ options = {
12
+ http_method: 'GET',
13
+ headers: {},
14
+ }
15
+
16
+ OptionParser.new do |opts|
17
+ opts.banner = "Usage: amqurl [options] [URL...]"
18
+
19
+ opts.on '-X [OPTIONAL]', '--request [OPTIONAL]', 'Specify the HTTP request method (GET, POST, etc)' do |v|
20
+ options[:http_method] = v.upcase
21
+ end
22
+
23
+ opts.on_tail '--version', 'Show Version' do
24
+ puts Rack::AMQP::Curl::VERSION
25
+ exit
26
+ end
27
+
28
+ # TODO support -T (upload file)
29
+ end.parse!
30
+
31
+ url = ARGV[0].gsub(/\Aamqps?:\/\//, '')
32
+
33
+ raise "Need to specify a URL before continuing" unless url
34
+
35
+ Rack::AMQP::Client.with_client(connection_options) do |client|
36
+ Timeout.timeout(connection_options[:timeout]) do
37
+ response = client.request(url, options)
38
+ puts response.payload
39
+ end
40
+ end
41
+
42
+ # vi:ft=ruby
@@ -0,0 +1,7 @@
1
+ require 'rack/amqp/client'
2
+ module Rack
3
+ module AMQP
4
+ module Curl
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ module Rack
2
+ module AMQP
3
+ module Curl
4
+
5
+ VERSION = "0.0.1"
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ require 'rspec'
2
+ require 'rack/amqp/curl'
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: amqurl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joshua Szmajda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack-amqp-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: emoji-rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: AMQP-HTTP compliant curl clone
112
+ email:
113
+ - josh@optoro.com
114
+ executables:
115
+ - amqurl
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - CHANGELOG.md
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE
123
+ - README.md
124
+ - Rakefile
125
+ - amqurl.gemspec
126
+ - benchy.rb
127
+ - bin/amqurl
128
+ - lib/rack/amqp/curl.rb
129
+ - lib/rack/amqp/curl/version.rb
130
+ - spec/spec_helper.rb
131
+ homepage: https://github.com/rack-amqp/amqurl
132
+ licenses:
133
+ - MIT
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.2.2
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: AMQP-HTTP compliant curl clone
155
+ test_files:
156
+ - spec/spec_helper.rb