htty 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/{spec/system/scenarios/exit/actual_stderr → .gemtest} +0 -0
  2. data/.gitignore +8 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +8 -0
  5. data/History.markdown +28 -20
  6. data/MIT-LICENSE.markdown +1 -1
  7. data/README.markdown +37 -37
  8. data/Rakefile +85 -0
  9. data/autotest/discover.rb +3 -0
  10. data/htty.gemspec +36 -0
  11. data/lib/htty.rb +1 -6
  12. data/lib/htty/cli/body_open_command.rb +93 -0
  13. data/lib/htty/cli/command.rb +5 -7
  14. data/lib/htty/cli/commands/address.rb +1 -1
  15. data/lib/htty/cli/commands/body_request.rb +3 -1
  16. data/lib/htty/cli/commands/body_request_open.rb +46 -0
  17. data/lib/htty/cli/commands/body_response.rb +5 -3
  18. data/lib/htty/cli/commands/body_response_open.rb +57 -0
  19. data/lib/htty/cli/commands/body_set.rb +1 -1
  20. data/lib/htty/cli/commands/body_unset.rb +1 -1
  21. data/lib/htty/cli/commands/cookies_add.rb +1 -1
  22. data/lib/htty/cli/commands/cookies_remove.rb +1 -1
  23. data/lib/htty/cli/commands/cookies_remove_all.rb +1 -1
  24. data/lib/htty/cli/commands/cookies_use.rb +1 -1
  25. data/lib/htty/cli/commands/follow.rb +1 -1
  26. data/lib/htty/cli/commands/fragment_set.rb +1 -1
  27. data/lib/htty/cli/commands/fragment_unset.rb +1 -1
  28. data/lib/htty/cli/commands/headers_set.rb +1 -1
  29. data/lib/htty/cli/commands/headers_unset.rb +1 -1
  30. data/lib/htty/cli/commands/headers_unset_all.rb +1 -1
  31. data/lib/htty/cli/commands/host_set.rb +1 -1
  32. data/lib/htty/cli/commands/path_set.rb +1 -1
  33. data/lib/htty/cli/commands/port_set.rb +1 -1
  34. data/lib/htty/cli/commands/query_add.rb +1 -1
  35. data/lib/htty/cli/commands/query_remove.rb +1 -1
  36. data/lib/htty/cli/commands/query_set.rb +1 -1
  37. data/lib/htty/cli/commands/query_unset.rb +1 -1
  38. data/lib/htty/cli/commands/query_unset_all.rb +1 -1
  39. data/lib/htty/cli/commands/reuse.rb +1 -1
  40. data/lib/htty/cli/commands/scheme_set.rb +1 -1
  41. data/lib/htty/cli/commands/userinfo_set.rb +1 -1
  42. data/lib/htty/cli/commands/userinfo_unset.rb +1 -1
  43. data/lib/htty/cli/http_method_command.rb +1 -1
  44. data/lib/htty/platform.rb +10 -0
  45. data/lib/htty/request.rb +5 -1
  46. data/lib/htty/tempfile_preserving_extname.rb +16 -0
  47. data/lib/htty/version.rb +6 -0
  48. data/spec/unit/htty/cli/commands/body_request_spec.rb +4 -9
  49. data/spec/unit/htty/cli/commands/body_response_spec.rb +3 -1
  50. data/spec/unit/htty/request_spec.rb +10 -1
  51. data/spec/unit/{htty_spec.rb → htty/version_spec.rb} +1 -1
  52. metadata +145 -35
  53. data/VERSION +0 -1
  54. data/spec/system/scenarios/exit/actual_stdout +0 -2
  55. data/spec/system/scenarios/quit/actual_stderr +0 -0
  56. data/spec/system/scenarios/quit/actual_stdout +0 -2
@@ -0,0 +1,16 @@
1
+ require 'tempfile'
2
+
3
+ module HTTY; end
4
+
5
+ # Adds file-extension-preservation behavior to Tempfile.
6
+ class HTTY::TempfilePreservingExtname < Tempfile
7
+
8
+ private
9
+
10
+ def make_tmpname(basename, n)
11
+ extname = File.extname(basename)
12
+ bare_basename = File.basename(basename, extname)
13
+ "#{bare_basename}#{Process.pid}-#{n}#{extname}"
14
+ end
15
+
16
+ end
@@ -0,0 +1,6 @@
1
+ module HTTY
2
+
3
+ # The version of this release of _htty_.
4
+ VERSION = '1.3.0' unless const_defined?(:VERSION)
5
+
6
+ end
@@ -1,5 +1,6 @@
1
1
  require 'rspec'
2
2
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_request")
3
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_request_open")
3
4
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_response")
4
5
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_set")
5
6
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_unset")
@@ -24,7 +25,7 @@ describe HTTY::CLI::Commands::BodyRequest do
24
25
  end
25
26
 
26
27
  it 'should have the expected command_line' do
27
- klass.command_line.should == 'body-req[uest]'
28
+ klass.command_line.should == 'body-request'
28
29
  end
29
30
 
30
31
  it 'should have the expected command_line_arguments' do
@@ -42,7 +43,8 @@ describe HTTY::CLI::Commands::BodyRequest do
42
43
  end
43
44
 
44
45
  it 'should have the expected see_also_commands' do
45
- klass.see_also_commands.should == [HTTY::CLI::Commands::BodySet,
46
+ klass.see_also_commands.should == [HTTY::CLI::Commands::BodyRequestOpen,
47
+ HTTY::CLI::Commands::BodySet,
46
48
  HTTY::CLI::Commands::BodyUnset,
47
49
  HTTY::CLI::Commands::HeadersRequest,
48
50
  HTTY::CLI::Commands::BodyResponse]
@@ -56,13 +58,6 @@ describe HTTY::CLI::Commands::BodyRequest do
56
58
  built.session.should == :the_session
57
59
  end
58
60
 
59
- it 'should correctly handle a valid, abbreviated command line' do
60
- built = klass.build_for('body-req', :session => :a_session)
61
- built.should be_instance_of(klass)
62
- built.arguments.should == []
63
- built.session.should == :a_session
64
- end
65
-
66
61
  it 'should correctly handle a command line with a bad command' do
67
62
  built = klass.build_for('x', :session => :another_session)
68
63
  built.should == nil
@@ -1,6 +1,7 @@
1
1
  require 'rspec'
2
2
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_request")
3
3
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_response")
4
+ require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/body_response_open")
4
5
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/headers_response")
5
6
  require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/status")
6
7
 
@@ -41,7 +42,8 @@ describe HTTY::CLI::Commands::BodyResponse do
41
42
  end
42
43
 
43
44
  it 'should have the expected see_also_commands' do
44
- klass.see_also_commands.should == [HTTY::CLI::Commands::HeadersResponse,
45
+ klass.see_also_commands.should == [HTTY::CLI::Commands::BodyResponseOpen,
46
+ HTTY::CLI::Commands::HeadersResponse,
45
47
  HTTY::CLI::Commands::Status,
46
48
  HTTY::CLI::Commands::BodyRequest]
47
49
  end
@@ -1,7 +1,7 @@
1
1
  require 'rspec'
2
- require File.expand_path("#{File.dirname __FILE__}/../../../lib/htty")
3
2
  require File.expand_path("#{File.dirname __FILE__}/../../../lib/htty/request")
4
3
  require File.expand_path("#{File.dirname __FILE__}/../../../lib/htty/response")
4
+ require File.expand_path("#{File.dirname __FILE__}/../../../lib/htty/version")
5
5
 
6
6
  shared_examples_for 'an empty request' do
7
7
  it 'should have only the default headers' do
@@ -75,6 +75,15 @@ describe HTTY::Request do
75
75
  expect { klass.new '-google.com' }.to raise_error(URI::InvalidURIError)
76
76
  end
77
77
  end
78
+
79
+ describe 'a valid FTP address' do
80
+ it 'should raise URI::InvalidURIError' do
81
+ expect do
82
+ klass.new 'ftp://myftpsite.info'
83
+ end.to raise_error(ArgumentError,
84
+ 'only http:// and https:// schemes are supported')
85
+ end
86
+ end
78
87
  end
79
88
 
80
89
  describe 'with a nil address' do
@@ -1,5 +1,5 @@
1
1
  require 'rspec'
2
- require File.expand_path("#{File.dirname __FILE__}/../../lib/htty")
2
+ require File.expand_path("#{File.dirname __FILE__}/../../../lib/htty/version")
3
3
 
4
4
  describe HTTY do
5
5
  it 'should have a version constant of the expected format' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htty
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 2
9
- - 1
10
- version: 1.2.1
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nils Jonsson
@@ -15,67 +15,87 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-01 00:00:00 -06:00
18
+ date: 2011-02-25 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: bluecloth
22
+ name: mime-types
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 3
29
+ hash: 15
30
30
  segments:
31
+ - 1
31
32
  - 0
32
- version: "0"
33
- type: :development
33
+ version: "1.0"
34
+ type: :runtime
34
35
  version_requirements: *id001
35
36
  - !ruby/object:Gem::Dependency
36
- name: rake
37
+ name: bluecloth
37
38
  prerelease: false
38
39
  requirement: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
- - - ">="
42
+ - - ~>
42
43
  - !ruby/object:Gem::Version
43
44
  hash: 3
44
45
  segments:
46
+ - 2
45
47
  - 0
46
- version: "0"
48
+ version: "2.0"
47
49
  type: :development
48
50
  version_requirements: *id002
49
51
  - !ruby/object:Gem::Dependency
50
- name: rspec
52
+ name: rake
51
53
  prerelease: false
52
54
  requirement: &id003 !ruby/object:Gem::Requirement
53
55
  none: false
54
56
  requirements:
55
- - - ">="
57
+ - - ~>
56
58
  - !ruby/object:Gem::Version
57
- hash: 3
59
+ hash: 27
58
60
  segments:
59
61
  - 0
60
- version: "0"
62
+ - 8
63
+ version: "0.8"
61
64
  type: :development
62
65
  version_requirements: *id003
63
66
  - !ruby/object:Gem::Dependency
64
- name: yard
67
+ name: rspec
65
68
  prerelease: false
66
69
  requirement: &id004 !ruby/object:Gem::Requirement
67
70
  none: false
68
71
  requirements:
69
- - - ">="
72
+ - - ~>
70
73
  - !ruby/object:Gem::Version
71
74
  hash: 3
72
75
  segments:
76
+ - 2
73
77
  - 0
74
- version: "0"
78
+ version: "2.0"
75
79
  type: :development
76
80
  version_requirements: *id004
77
- description: htty is a console application for interacting with HTTP servers. It is something of a cross between cURL and a browser.
78
- email: htty@nilsjonsson.com
81
+ - !ruby/object:Gem::Dependency
82
+ name: yard
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ hash: 15
90
+ segments:
91
+ - 0
92
+ - 2
93
+ version: "0.2"
94
+ type: :development
95
+ version_requirements: *id005
96
+ description: htty is a console application for interacting with web servers. It's a fun way to explore web APIs and to learn the ins and outs of HTTP.
97
+ email:
98
+ - htty@nilsjonsson.com
79
99
  executables:
80
100
  - htty
81
101
  extensions: []
@@ -83,15 +103,28 @@ extensions: []
83
103
  extra_rdoc_files: []
84
104
 
85
105
  files:
86
- - README.markdown
106
+ - .gemtest
107
+ - .gitignore
108
+ - .yardopts
109
+ - Gemfile
87
110
  - History.markdown
88
111
  - MIT-LICENSE.markdown
89
- - VERSION
112
+ - README.markdown
113
+ - Rakefile
114
+ - autotest/discover.rb
115
+ - bin/htty
116
+ - htty.gemspec
117
+ - lib/htty.rb
118
+ - lib/htty/cli.rb
119
+ - lib/htty/cli/body_open_command.rb
90
120
  - lib/htty/cli/command.rb
121
+ - lib/htty/cli/commands.rb
91
122
  - lib/htty/cli/commands/address.rb
92
123
  - lib/htty/cli/commands/body_clear.rb
93
124
  - lib/htty/cli/commands/body_request.rb
125
+ - lib/htty/cli/commands/body_request_open.rb
94
126
  - lib/htty/cli/commands/body_response.rb
127
+ - lib/htty/cli/commands/body_response_open.rb
95
128
  - lib/htty/cli/commands/body_set.rb
96
129
  - lib/htty/cli/commands/body_unset.rb
97
130
  - lib/htty/cli/commands/cd.rb
@@ -155,33 +188,29 @@ files:
155
188
  - lib/htty/cli/commands/userinfo_clear.rb
156
189
  - lib/htty/cli/commands/userinfo_set.rb
157
190
  - lib/htty/cli/commands/userinfo_unset.rb
158
- - lib/htty/cli/commands.rb
159
191
  - lib/htty/cli/display.rb
160
192
  - lib/htty/cli/http_method_command.rb
161
193
  - lib/htty/cli/url_escaping.rb
162
- - lib/htty/cli.rb
163
194
  - lib/htty/cookies_util.rb
164
195
  - lib/htty/no_location_header_error.rb
165
196
  - lib/htty/no_response_error.rb
166
197
  - lib/htty/no_set_cookie_header_error.rb
167
198
  - lib/htty/ordered_hash.rb
168
199
  - lib/htty/payload.rb
200
+ - lib/htty/platform.rb
169
201
  - lib/htty/preferences.rb
170
202
  - lib/htty/request.rb
171
203
  - lib/htty/requests_util.rb
172
204
  - lib/htty/response.rb
173
205
  - lib/htty/session.rb
174
- - lib/htty.rb
206
+ - lib/htty/tempfile_preserving_extname.rb
207
+ - lib/htty/version.rb
175
208
  - spec/integration/htty/cli/commands/query_add_spec.rb
176
209
  - spec/integration/htty/cli/commands/query_remove_spec.rb
177
210
  - spec/integration/htty/cli/commands/query_set_spec.rb
178
211
  - spec/integration/htty/cli/commands/query_unset_spec.rb
179
- - spec/system/scenarios/exit/actual_stderr
180
- - spec/system/scenarios/exit/actual_stdout
181
212
  - spec/system/scenarios/exit/expected_stdout
182
213
  - spec/system/scenarios/exit/stdin
183
- - spec/system/scenarios/quit/actual_stderr
184
- - spec/system/scenarios/quit/actual_stdout
185
214
  - spec/system/scenarios/quit/expected_stdout
186
215
  - spec/system/scenarios/quit/stdin
187
216
  - spec/system/scenarios_spec.rb
@@ -258,8 +287,7 @@ files:
258
287
  - spec/unit/htty/request_spec.rb
259
288
  - spec/unit/htty/response_spec.rb
260
289
  - spec/unit/htty/session_spec.rb
261
- - spec/unit/htty_spec.rb
262
- - bin/htty
290
+ - spec/unit/htty/version_spec.rb
263
291
  has_rdoc: true
264
292
  homepage: http://htty.github.com
265
293
  licenses:
@@ -296,5 +324,87 @@ rubygems_version: 1.3.7
296
324
  signing_key:
297
325
  specification_version: 3
298
326
  summary: The HTTP TTY
299
- test_files: []
300
-
327
+ test_files:
328
+ - spec/integration/htty/cli/commands/query_add_spec.rb
329
+ - spec/integration/htty/cli/commands/query_remove_spec.rb
330
+ - spec/integration/htty/cli/commands/query_set_spec.rb
331
+ - spec/integration/htty/cli/commands/query_unset_spec.rb
332
+ - spec/system/scenarios/exit/expected_stdout
333
+ - spec/system/scenarios/exit/stdin
334
+ - spec/system/scenarios/quit/expected_stdout
335
+ - spec/system/scenarios/quit/stdin
336
+ - spec/system/scenarios_spec.rb
337
+ - spec/unit/htty/cli/commands/address_spec.rb
338
+ - spec/unit/htty/cli/commands/body_clear_spec.rb
339
+ - spec/unit/htty/cli/commands/body_request_spec.rb
340
+ - spec/unit/htty/cli/commands/body_response_spec.rb
341
+ - spec/unit/htty/cli/commands/body_set_spec.rb
342
+ - spec/unit/htty/cli/commands/body_unset_spec.rb
343
+ - spec/unit/htty/cli/commands/cd_spec.rb
344
+ - spec/unit/htty/cli/commands/cookie_add_spec.rb
345
+ - spec/unit/htty/cli/commands/cookie_remove_spec.rb
346
+ - spec/unit/htty/cli/commands/cookies_add_spec.rb
347
+ - spec/unit/htty/cli/commands/cookies_clear_spec.rb
348
+ - spec/unit/htty/cli/commands/cookies_remove_all_spec.rb
349
+ - spec/unit/htty/cli/commands/cookies_remove_spec.rb
350
+ - spec/unit/htty/cli/commands/cookies_spec.rb
351
+ - spec/unit/htty/cli/commands/cookies_use_spec.rb
352
+ - spec/unit/htty/cli/commands/delete_spec.rb
353
+ - spec/unit/htty/cli/commands/exit_spec.rb
354
+ - spec/unit/htty/cli/commands/follow_spec.rb
355
+ - spec/unit/htty/cli/commands/form_add_spec.rb
356
+ - spec/unit/htty/cli/commands/form_clear_spec.rb
357
+ - spec/unit/htty/cli/commands/form_remove_all_spec.rb
358
+ - spec/unit/htty/cli/commands/form_remove_spec.rb
359
+ - spec/unit/htty/cli/commands/form_spec.rb
360
+ - spec/unit/htty/cli/commands/fragment_clear_spec.rb
361
+ - spec/unit/htty/cli/commands/fragment_set_spec.rb
362
+ - spec/unit/htty/cli/commands/fragment_unset_spec.rb
363
+ - spec/unit/htty/cli/commands/get_spec.rb
364
+ - spec/unit/htty/cli/commands/header_set_spec.rb
365
+ - spec/unit/htty/cli/commands/header_unset_spec.rb
366
+ - spec/unit/htty/cli/commands/headers_clear_spec.rb
367
+ - spec/unit/htty/cli/commands/headers_request_spec.rb
368
+ - spec/unit/htty/cli/commands/headers_response_spec.rb
369
+ - spec/unit/htty/cli/commands/headers_set_spec.rb
370
+ - spec/unit/htty/cli/commands/headers_unset_all_spec.rb
371
+ - spec/unit/htty/cli/commands/headers_unset_spec.rb
372
+ - spec/unit/htty/cli/commands/help_spec.rb
373
+ - spec/unit/htty/cli/commands/history_spec.rb
374
+ - spec/unit/htty/cli/commands/history_verbose_spec.rb
375
+ - spec/unit/htty/cli/commands/host_set_spec.rb
376
+ - spec/unit/htty/cli/commands/http_delete_spec.rb
377
+ - spec/unit/htty/cli/commands/http_get_spec.rb
378
+ - spec/unit/htty/cli/commands/http_head_spec.rb
379
+ - spec/unit/htty/cli/commands/http_options_spec.rb
380
+ - spec/unit/htty/cli/commands/http_post_spec.rb
381
+ - spec/unit/htty/cli/commands/http_put_spec.rb
382
+ - spec/unit/htty/cli/commands/http_trace_spec.rb
383
+ - spec/unit/htty/cli/commands/path_set_spec.rb
384
+ - spec/unit/htty/cli/commands/port_set_spec.rb
385
+ - spec/unit/htty/cli/commands/post_spec.rb
386
+ - spec/unit/htty/cli/commands/put_spec.rb
387
+ - spec/unit/htty/cli/commands/query_add_spec.rb
388
+ - spec/unit/htty/cli/commands/query_clear_spec.rb
389
+ - spec/unit/htty/cli/commands/query_remove_spec.rb
390
+ - spec/unit/htty/cli/commands/query_set_spec.rb
391
+ - spec/unit/htty/cli/commands/query_unset_all_spec.rb
392
+ - spec/unit/htty/cli/commands/query_unset_spec.rb
393
+ - spec/unit/htty/cli/commands/quit_spec.rb
394
+ - spec/unit/htty/cli/commands/reuse_spec.rb
395
+ - spec/unit/htty/cli/commands/scheme_set_spec.rb
396
+ - spec/unit/htty/cli/commands/ssl_verification_off_spec.rb
397
+ - spec/unit/htty/cli/commands/ssl_verification_on_spec.rb
398
+ - spec/unit/htty/cli/commands/ssl_verification_spec.rb
399
+ - spec/unit/htty/cli/commands/status_spec.rb
400
+ - spec/unit/htty/cli/commands/undo_spec.rb
401
+ - spec/unit/htty/cli/commands/userinfo_clear_spec.rb
402
+ - spec/unit/htty/cli/commands/userinfo_set_spec.rb
403
+ - spec/unit/htty/cli/commands/userinfo_unset_spec.rb
404
+ - spec/unit/htty/cli_spec.rb
405
+ - spec/unit/htty/ordered_hash_spec.rb
406
+ - spec/unit/htty/preferences_spec.rb
407
+ - spec/unit/htty/request_spec.rb
408
+ - spec/unit/htty/response_spec.rb
409
+ - spec/unit/htty/session_spec.rb
410
+ - spec/unit/htty/version_spec.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.2.1
@@ -1,2 +0,0 @@
1
- *** Welcome to  htty , the HTTP TTY. Heck To The Yeah!
2
- *** Happy Trails To You!
File without changes
@@ -1,2 +0,0 @@
1
- *** Welcome to  htty , the HTTP TTY. Heck To The Yeah!
2
- *** Happy Trails To You!