http-dump 0.0.1 → 0.1.0

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: f4792be8c38ab35c3649ca1976fa69c8e6fa9d8a
4
- data.tar.gz: 809025f18e2bb8b5cb6f8cfcebc6464e80d94379
3
+ metadata.gz: 6ecf85f044a7d37848743fcb3d1341b6f33deee7
4
+ data.tar.gz: 13175f5a2b3def41a2baa88edfbea44ae88d4c66
5
5
  SHA512:
6
- metadata.gz: f1120bb2718f23493c8198040c06f5c443005d68c5bd4c723aa4376f80ca9fea73ab9f83803501f1a5fbd02053195e38256744661d35d3dd5cc9d2201a4930d8
7
- data.tar.gz: 6e2867c32283d1a1b09a14a0afe151fff569b2898b1c4ec498fee28952f9f0afb21cdc3b867e6da8517a030676685c68e9a5166df91730a8c4c04533073bd2a8
6
+ metadata.gz: cff292f6957cd1587c0ffa0be1fb93e1e19ba9570f58346930e4cc1fc5ba42a3766ecb8bc72432575a92573b19eab1417db48bbd4ca5d7249a7fa13036fce7f3
7
+ data.tar.gz: 499d91b94ef3edaef03053cb501e465c23a5bc201d13e87d4df1391545727ff5e95f0b907041dfb827013e9ab7fd0ce462ad70616ff1a9d1cecb4022a902246d
@@ -4,3 +4,6 @@ rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
6
  - 2.1.0
7
+ before_install:
8
+ - gem update --system 2.1.11 # rubygems 2.2.0 have a bug for 1.8.7 ?
9
+ - gem --version
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # HTTPDump
2
2
 
3
+ [![Build Status](https://travis-ci.org/hotchpotch/http-dump.png?branch=master)](https://travis-ci.org/hotchpotch/http-dump)
4
+
3
5
  Dump http request use [WebMock](https://github.com/bblimke/webmock).
4
6
 
5
7
  Supported HTTP libraries = [WebMock supported liraries](https://github.com/bblimke/webmock#supported-http-libraries), Net::HTTP, HTTPParty, HTTPClient, Excon, more...
6
8
 
9
+ ```
10
+ $ gem install http-dump
11
+ ```
12
+
7
13
  ## Usage
8
14
 
9
15
  ### HTTPDump.dump(options={}, &block)
@@ -49,7 +55,7 @@ require 'open-uri'
49
55
  require 'http-dump'
50
56
 
51
57
  HTTPDump.enable!
52
- open(http://example.com).read
58
+ open('http://example.com').read
53
59
  HTTPDump.disable!
54
60
  ```
55
61
 
@@ -101,6 +107,14 @@ HTTPDump.output = STDERR
101
107
  HTTPDump.dump {
102
108
  Net::HTTP.get(URI('http://example.com')) # dump to STDERR
103
109
  }
110
+
111
+ require 'logger'
112
+ logger = Logger.new(STDOUT)
113
+ logger.instance_eval { class << self; alias_method :puts, :info; end }
114
+ HTTPDump.output = logger
115
+ HTTPDump.dump {
116
+ Net::HTTP.get(URI('http://example.com')) # dump to logger
117
+ }
104
118
  ```
105
119
 
106
120
  ### http-dump/enable
@@ -112,6 +126,20 @@ $ ruby -r'net/http' -r'uri' -r'http-dump/enable' -e 'Net::HTTP.get(URI("http://e
112
126
  ...
113
127
  ```
114
128
 
129
+ #### on Rails
130
+
131
+ ```
132
+ # in Gemfile
133
+
134
+ group :development do
135
+ gem 'http-dump', require: ENV['HTTP_DUMP_ENABLE'] ? 'http-dump/enable' : 'http-dump'
136
+ end
137
+ ```
138
+
139
+ ```
140
+ HTTP_DUMP_ENABLE=1 bundle exec rails s
141
+ ```
142
+
115
143
  ## Installation
116
144
 
117
145
  Add this line to your application's Gemfile:
@@ -1,11 +1,11 @@
1
1
 
2
2
  require "http-dump/version"
3
- require 'webmock'
4
3
 
5
4
  class HTTPDump
6
5
  class << self
7
6
  attr_accessor :output, :quiet_format
8
7
  def enable!(options = {})
8
+ require 'webmock'
9
9
  WebMock.enable!(options)
10
10
  WebMock.allow_net_connect!(options)
11
11
  WebMock.after_request do |request_signature, response|
@@ -16,7 +16,6 @@ class HTTPDump
16
16
 
17
17
  def disable!(options = {})
18
18
  WebMock.reset_callbacks
19
- WebMock.disable_net_connect!(options)
20
19
  WebMock.disable!(options)
21
20
  @enabled = false
22
21
  end
@@ -56,17 +55,3 @@ class HTTPDump
56
55
  end
57
56
  end
58
57
 
59
- __END__
60
-
61
- #HTTPDump.enable!
62
- require 'open-uri'
63
- HTTPDump.quiet_formatt = true
64
- HTTPDump.dump {
65
- open('http://example.com').read
66
- }
67
- open('http://example.com').read
68
-
69
- HTTPDump.dump {
70
- open('http://b.hatena.ne.jp/').read
71
- }
72
-
@@ -1,3 +1,3 @@
1
1
  class HTTPDump
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http-dump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuichi Tateno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-03 00:00:00.000000000 Z
11
+ date: 2014-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: webmock
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2.14'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Dump http request use WebMock.
@@ -73,9 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".gitignore"
77
- - ".rspec"
78
- - ".travis.yml"
76
+ - .gitignore
77
+ - .rspec
78
+ - .travis.yml
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
81
  - README.md
@@ -96,17 +96,17 @@ require_paths:
96
96
  - lib
97
97
  required_ruby_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - ">="
99
+ - - '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - ">="
104
+ - - '>='
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.2.0
109
+ rubygems_version: 2.0.3
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Dump http request use WebMock.