playback 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +40 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/bin/playback +18 -0
- data/lib/playback/parser.rb +54 -0
- data/lib/playback/request.rb +82 -0
- data/lib/playback/version.rb +3 -0
- data/lib/playback.rb +6 -0
- data/playback.gemspec +24 -0
- data/spec/playback/request_spec.rb +110 -0
- data/spec/spec_helper.rb +78 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf2e91b3876efbd30efd8318e80d831d5fa14b9a
|
4
|
+
data.tar.gz: c21c5b68e7ea37e1cc0d5145523dd3fa78bbc8a9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bce6c7845b5a9d7c8da1f72154aaad6cd24c134a34e5bf2e741f6cd7bc4cf42f684e12bd16027d1ef7b7f48c783d653335acb76dd0f0665b491db526390615e1
|
7
|
+
data.tar.gz: bb7e8427bd00e2903c9c7992571013277a38854a9b98b50a0528973c4b8b76540fcf9955f0bdb9ba49b23488d2e9b4e330b2c97ce96f58ae6dcba82fb52775a4
|
data/.gitignore
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
*.bundle
|
11
|
+
*.so
|
12
|
+
*.o
|
13
|
+
*.a
|
14
|
+
mkmf.log
|
15
|
+
gibo 1.0.2 by Simon Whitaker <simon@goosoftware.co.uk>
|
16
|
+
https://github.com/simonwhitaker/gibo
|
17
|
+
### https://raw.github.com/github/gitignore/master/Global/OSX.gitignore
|
18
|
+
|
19
|
+
.DS_Store
|
20
|
+
.AppleDouble
|
21
|
+
.LSOverride
|
22
|
+
|
23
|
+
# Icon must end with two \r
|
24
|
+
Icon
|
25
|
+
|
26
|
+
# Thumbnails
|
27
|
+
._*
|
28
|
+
|
29
|
+
# Files that might appear on external disk
|
30
|
+
.Spotlight-V100
|
31
|
+
.Trashes
|
32
|
+
|
33
|
+
# Directories potentially created on remote AFP share
|
34
|
+
.AppleDB
|
35
|
+
.AppleDesktop
|
36
|
+
Network Trash Folder
|
37
|
+
Temporary Items
|
38
|
+
.apdisk
|
39
|
+
|
40
|
+
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Yuichi Takada
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Playback
|
2
|
+
[![Build Status](https://travis-ci.org/takady/playback.svg?branch=master)](https://travis-ci.org/takady/playback) [![Code Climate](https://codeclimate.com/github/takady/playback/badges/gpa.svg)](https://codeclimate.com/github/takady/playback)
|
3
|
+
execute http request from access log
|
4
|
+
supported log format: apache(common, combined and customized base on combined)
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
$ gem install playback
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
### as a command line tool
|
13
|
+
```sh
|
14
|
+
playback 'http://httpbin.org' /path/to/access.log
|
15
|
+
#=> { "method": "GET", "path": "/get", "status": 200 }
|
16
|
+
#=> { "method": "POST", "path": "/post?hoge=1", "status": 404 }
|
17
|
+
#=> { "method": "PUT", "path": "/put?foo=bar", "status": 200 }
|
18
|
+
#=> :
|
19
|
+
#=> :
|
20
|
+
```
|
21
|
+
|
22
|
+
### as a part of code
|
23
|
+
```ruby
|
24
|
+
require 'playback'
|
25
|
+
|
26
|
+
p = Playback::Request.new('http://httpbin.org')
|
27
|
+
File.open '/path/to/access.log' do |file|
|
28
|
+
file.each_line do |line|
|
29
|
+
puts p.run(line) #=> { "method": "GET", "path": "/get", "status": 200 }
|
30
|
+
puts p.run(line, 'net-http') #=> #<Net::HTTPOK:0xb8309eb4>
|
31
|
+
end
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
1. Fork it ( https://github.com/takady/playback/fork )
|
38
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
39
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
40
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
41
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/playback
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'playback/request'
|
3
|
+
|
4
|
+
@base_uri = ARGV[0]
|
5
|
+
@log_file = ARGV[1]
|
6
|
+
p = Playback::Request.new(@base_uri)
|
7
|
+
|
8
|
+
begin
|
9
|
+
File.open @log_file do |file|
|
10
|
+
file.each_line do |line|
|
11
|
+
puts p.run(line)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
rescue Interrupt
|
15
|
+
puts "\nexiting..."
|
16
|
+
rescue Exception => e
|
17
|
+
puts e
|
18
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Playback
|
2
|
+
module Parser
|
3
|
+
|
4
|
+
def self.parse(line, format)
|
5
|
+
common_fields = %w(request)
|
6
|
+
combined_fields = common_fields + %w(referer user_agent)
|
7
|
+
|
8
|
+
common_pattern = '\S+\s+\S+\s+\S+\s+\[.*\]\s+"(\S+\s\S+\s\S+)"\s+\S+\s+\S+'
|
9
|
+
combined_pattern = common_pattern + '\s+"([^"]*)"\s+"([^"]*)".*'
|
10
|
+
|
11
|
+
case format
|
12
|
+
when 'common'
|
13
|
+
fields = common_fields
|
14
|
+
pattern = /^#{common_pattern}$/
|
15
|
+
when 'combined'
|
16
|
+
fields = combined_fields
|
17
|
+
pattern = /^#{combined_pattern}$/
|
18
|
+
else
|
19
|
+
raise "no such format: <#{format}>"
|
20
|
+
end
|
21
|
+
|
22
|
+
matched = pattern.match(line)
|
23
|
+
raise "parse error at line: <#{line}>" if matched.nil?
|
24
|
+
|
25
|
+
generate_hash(fields, matched.to_a)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.generate_hash(keys, values)
|
29
|
+
hash = {}
|
30
|
+
|
31
|
+
keys.each.with_index do |key, idx|
|
32
|
+
key = key.to_sym
|
33
|
+
if (key == :request)
|
34
|
+
hash[key] = parse_request(values[idx+1])
|
35
|
+
else
|
36
|
+
hash[key] = values[idx+1]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
hash
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.parse_request(str)
|
44
|
+
method, path, protocol = str.split
|
45
|
+
{
|
46
|
+
method: method,
|
47
|
+
path: path,
|
48
|
+
protocol: protocol,
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
private_class_method :generate_hash, :parse_request
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "playback/parser"
|
2
|
+
require 'net/http'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Playback
|
6
|
+
class Request
|
7
|
+
DEFAULT_CONTENT_TYPE = 'application/text'
|
8
|
+
DEFAULT_USER_AGENT = 'From Playback rubygems'
|
9
|
+
|
10
|
+
def initialize(base_uri)
|
11
|
+
@base_uri = base_uri
|
12
|
+
@parser = Playback::Parser
|
13
|
+
end
|
14
|
+
|
15
|
+
def run(line, return_type='')
|
16
|
+
parsed_line = parse(line)
|
17
|
+
method = parsed_line[:request][:method]
|
18
|
+
path = parsed_line[:request][:path]
|
19
|
+
referer = parsed_line[:referer] ||= ''
|
20
|
+
user_agent = parsed_line[:user_agent] ||= DEFAULT_USER_AGENT
|
21
|
+
|
22
|
+
res = request(method, path, referer, user_agent)
|
23
|
+
|
24
|
+
unless (return_type == 'net-http')
|
25
|
+
result = {
|
26
|
+
method: method,
|
27
|
+
path: path,
|
28
|
+
status: res.code.to_i,
|
29
|
+
}
|
30
|
+
res = JSON.generate result
|
31
|
+
end
|
32
|
+
|
33
|
+
res
|
34
|
+
|
35
|
+
rescue => e
|
36
|
+
e.message
|
37
|
+
end
|
38
|
+
|
39
|
+
def parse(line)
|
40
|
+
begin
|
41
|
+
@parser.parse(line.chomp, 'combined')
|
42
|
+
rescue
|
43
|
+
begin
|
44
|
+
@parser.parse(line.chomp, 'common')
|
45
|
+
rescue => e
|
46
|
+
raise e
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def request(method, path, referer, user_agent)
|
52
|
+
begin
|
53
|
+
uri = URI.parse(@base_uri + path)
|
54
|
+
rescue
|
55
|
+
raise "it can not be recognized as a uri: <#{@base_uri + path}>"
|
56
|
+
end
|
57
|
+
|
58
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
59
|
+
query = uri.query ||= ''
|
60
|
+
data = {'Content-Type' => DEFAULT_CONTENT_TYPE, 'Referer' => referer, 'User-Agent' => user_agent}
|
61
|
+
|
62
|
+
case method
|
63
|
+
when 'GET'
|
64
|
+
http.get(path, data)
|
65
|
+
when 'POST'
|
66
|
+
http.post(uri.path, query, data)
|
67
|
+
when 'PUT'
|
68
|
+
http.put(uri.path, query, data)
|
69
|
+
when 'DELETE'
|
70
|
+
http.delete(path, data)
|
71
|
+
when 'PATCH'
|
72
|
+
http.patch(uri.path, query, data)
|
73
|
+
when 'HEAD'
|
74
|
+
http.head(path, data)
|
75
|
+
else
|
76
|
+
raise "it is not supported http method: <#{method}>"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private :parse, :request
|
81
|
+
end
|
82
|
+
end
|
data/lib/playback.rb
ADDED
data/playback.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'playback/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "playback"
|
8
|
+
spec.version = Playback::VERSION
|
9
|
+
spec.authors = ["Yuichi Takada"]
|
10
|
+
spec.email = ["takadyy@gmail.com"]
|
11
|
+
spec.summary = "generate and execute http request from access log"
|
12
|
+
spec.description = "generate and execute http request from access log"
|
13
|
+
spec.homepage = "https://github.com/takady/playback"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'playback/request'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
describe Playback::Request do
|
6
|
+
let(:apache_log_playback) { Playback::Request.new('http://httpbin.org') }
|
7
|
+
let :apache_common_logs do
|
8
|
+
{
|
9
|
+
GET: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "GET /get HTTP/1.1" 200 73',
|
10
|
+
POST: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "POST /post?c=Jewelry+Networking HTTP/1.1" 200 118',
|
11
|
+
PUT: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "PUT /put?c=Books HTTP/1.1" 200 53',
|
12
|
+
DELETE: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "DELETE /delete HTTP/1.1" 200 53',
|
13
|
+
PATCH: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "PATCH /patch?from=0 HTTP/1.1" 200 53',
|
14
|
+
}
|
15
|
+
end
|
16
|
+
let :apache_combined_logs do
|
17
|
+
{
|
18
|
+
GET: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "GET /get HTTP/1.1" 200 73 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"',
|
19
|
+
POST: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "POST /post?c=Jewelry+Networking HTTP/1.1" 200 118 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"',
|
20
|
+
PUT: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "PUT /put?c=Books HTTP/1.1" 200 53 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"',
|
21
|
+
DELETE: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "DELETE /delete HTTP/1.1" 200 53 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"',
|
22
|
+
PATCH: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "PATCH /patch?from=0 HTTP/1.1" 200 53 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"',
|
23
|
+
}
|
24
|
+
end
|
25
|
+
let :apache_custom_logs do
|
26
|
+
{
|
27
|
+
GET: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "GET /get HTTP/1.1" 200 73 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" "example.com" "192.168.0.1201102091208001" "901"',
|
28
|
+
POST: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "POST /post?c=Jewelry+Networking HTTP/1.1" 200 118 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" "example.com" "192.168.0.1201102091208001" "901"',
|
29
|
+
PUT: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "PUT /put?c=Books HTTP/1.1" 200 53 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" "example.com" "192.168.0.1201102091208001" "901"',
|
30
|
+
DELETE: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "DELETE /delete HTTP/1.1" 200 53 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" virtualhost.example.jp "192.0.2.16794832933550" "09011112222333_xx.ezweb.ne.jp" 533593',
|
31
|
+
PATCH: '127.0.0.1 - - [07/Jun/2014:14:58:55 +0900] "PATCH /patch?from=0 HTTP/1.1" 200 53 "http://google.co.jp" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0.1) Gecko/20100101 Firefox/9.0.1" virtualhost.example.jp "192.0.2.16794832933550" "09011112222333_xx.ezweb.ne.jp" 533593',
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'can get request from apache common format log' do
|
36
|
+
res = apache_log_playback.run(apache_common_logs[:GET])
|
37
|
+
expect(res).to eq('{"method":"GET","path":"/get","status":200}')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'can get request from apache combined format log' do
|
41
|
+
res = apache_log_playback.run(apache_combined_logs[:GET])
|
42
|
+
expect(res).to eq('{"method":"GET","path":"/get","status":200}')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'can get request from apache customized format log' do
|
46
|
+
res = apache_log_playback.run(apache_custom_logs[:GET])
|
47
|
+
expect(res).to eq('{"method":"GET","path":"/get","status":200}')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'can post request from apache common format log' do
|
51
|
+
res = apache_log_playback.run(apache_common_logs[:POST])
|
52
|
+
expect(res).to eq('{"method":"POST","path":"/post?c=Jewelry+Networking","status":200}')
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'can post request from apache combined format log' do
|
56
|
+
res = apache_log_playback.run(apache_combined_logs[:POST])
|
57
|
+
expect(res).to eq('{"method":"POST","path":"/post?c=Jewelry+Networking","status":200}')
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'can post request from apache customized format log' do
|
61
|
+
res = apache_log_playback.run(apache_custom_logs[:POST])
|
62
|
+
expect(res).to eq('{"method":"POST","path":"/post?c=Jewelry+Networking","status":200}')
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'can put request from apache common format log' do
|
66
|
+
res = apache_log_playback.run(apache_common_logs[:PUT])
|
67
|
+
expect(res).to eq('{"method":"PUT","path":"/put?c=Books","status":200}')
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'can put request from apache combined format log' do
|
71
|
+
res = apache_log_playback.run(apache_combined_logs[:PUT])
|
72
|
+
expect(res).to eq('{"method":"PUT","path":"/put?c=Books","status":200}')
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'can put request from apache customized format log' do
|
76
|
+
res = apache_log_playback.run(apache_custom_logs[:PUT])
|
77
|
+
expect(res).to eq('{"method":"PUT","path":"/put?c=Books","status":200}')
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'can delete request from apache common format log' do
|
81
|
+
res = apache_log_playback.run(apache_common_logs[:DELETE])
|
82
|
+
expect(res).to eq('{"method":"DELETE","path":"/delete","status":200}')
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can delete request from apache combined format log' do
|
86
|
+
res = apache_log_playback.run(apache_combined_logs[:DELETE])
|
87
|
+
expect(res).to eq('{"method":"DELETE","path":"/delete","status":200}')
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'can delete request from apache customized format log' do
|
91
|
+
res = apache_log_playback.run(apache_custom_logs[:DELETE])
|
92
|
+
expect(res).to eq('{"method":"DELETE","path":"/delete","status":200}')
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'can patch request from apache common format log' do
|
96
|
+
res = apache_log_playback.run(apache_common_logs[:PATCH])
|
97
|
+
expect(res).to eq('{"method":"PATCH","path":"/patch?from=0","status":200}')
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'can patch request from apache combined format log' do
|
101
|
+
res = apache_log_playback.run(apache_combined_logs[:PATCH])
|
102
|
+
expect(res).to eq('{"method":"PATCH","path":"/patch?from=0","status":200}')
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'can patch request from apache customized format log' do
|
106
|
+
res = apache_log_playback.run(apache_custom_logs[:PATCH])
|
107
|
+
expect(res).to eq('{"method":"PATCH","path":"/patch?from=0","status":200}')
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, make a
|
10
|
+
# separate helper file that requires this one and then use it only in the specs
|
11
|
+
# that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# The settings below are suggested to provide a good initial experience
|
19
|
+
# with RSpec, but feel free to customize to your heart's content.
|
20
|
+
=begin
|
21
|
+
# These two settings work together to allow you to limit a spec run
|
22
|
+
# to individual examples or groups you care about by tagging them with
|
23
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
24
|
+
# get run.
|
25
|
+
config.filter_run :focus
|
26
|
+
config.run_all_when_everything_filtered = true
|
27
|
+
|
28
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
29
|
+
# file, and it's useful to allow more verbose output when running an
|
30
|
+
# individual spec file.
|
31
|
+
if config.files_to_run.one?
|
32
|
+
# Use the documentation formatter for detailed output,
|
33
|
+
# unless a formatter has already been configured
|
34
|
+
# (e.g. via a command-line flag).
|
35
|
+
config.default_formatter = 'doc'
|
36
|
+
end
|
37
|
+
|
38
|
+
# Print the 10 slowest examples and example groups at the
|
39
|
+
# end of the spec run, to help surface which specs are running
|
40
|
+
# particularly slow.
|
41
|
+
config.profile_examples = 10
|
42
|
+
|
43
|
+
# Run specs in random order to surface order dependencies. If you find an
|
44
|
+
# order dependency and want to debug it, you can fix the order by providing
|
45
|
+
# the seed, which is printed after each run.
|
46
|
+
# --seed 1234
|
47
|
+
config.order = :random
|
48
|
+
|
49
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
50
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
51
|
+
# test failures related to randomization by passing the same `--seed` value
|
52
|
+
# as the one that triggered the failure.
|
53
|
+
Kernel.srand config.seed
|
54
|
+
|
55
|
+
# rspec-expectations config goes here. You can use an alternate
|
56
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
57
|
+
# assertions if you prefer.
|
58
|
+
config.expect_with :rspec do |expectations|
|
59
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
60
|
+
# For more details, see:
|
61
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
62
|
+
expectations.syntax = :expect
|
63
|
+
end
|
64
|
+
|
65
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
66
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
67
|
+
config.mock_with :rspec do |mocks|
|
68
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
69
|
+
# For more details, see:
|
70
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
71
|
+
mocks.syntax = :expect
|
72
|
+
|
73
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
74
|
+
# a real object. This is generally recommended.
|
75
|
+
mocks.verify_partial_doubles = true
|
76
|
+
end
|
77
|
+
=end
|
78
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: playback
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuichi Takada
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
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
|
+
description: generate and execute http request from access log
|
56
|
+
email:
|
57
|
+
- takadyy@gmail.com
|
58
|
+
executables:
|
59
|
+
- playback
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/playback
|
71
|
+
- lib/playback.rb
|
72
|
+
- lib/playback/parser.rb
|
73
|
+
- lib/playback/request.rb
|
74
|
+
- lib/playback/version.rb
|
75
|
+
- playback.gemspec
|
76
|
+
- spec/playback/request_spec.rb
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
homepage: https://github.com/takady/playback
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.2.2
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: generate and execute http request from access log
|
102
|
+
test_files:
|
103
|
+
- spec/playback/request_spec.rb
|
104
|
+
- spec/spec_helper.rb
|