htty 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +2 -1
- data/Gemfile +14 -10
- data/Guardfile +17 -0
- data/History.markdown +7 -1
- data/MIT-LICENSE.markdown +1 -1
- data/README.markdown +3 -3
- data/Rakefile +3 -6
- data/htty.gemspec +8 -6
- data/lib/htty/cli/commands/http_delete.rb +2 -0
- data/lib/htty/cli/commands/http_get.rb +2 -0
- data/lib/htty/cli/commands/http_patch.rb +34 -0
- data/lib/htty/cli/commands/http_post.rb +2 -0
- data/lib/htty/cli/commands/http_put.rb +2 -0
- data/lib/htty/cli/commands/patch.rb +18 -0
- data/lib/htty/http_patch.rb +35 -0
- data/lib/htty/requests_util.rb +10 -0
- data/lib/htty/version.rb +1 -1
- data/spec/unit/htty/cli/commands/cd_spec.rb +2 -2
- data/spec/unit/htty/cli/commands/http_delete_spec.rb +2 -0
- data/spec/unit/htty/cli/commands/http_get_spec.rb +2 -0
- data/spec/unit/htty/cli/commands/http_patch_spec.rb +73 -0
- data/spec/unit/htty/cli/commands/http_post_spec.rb +2 -0
- data/spec/unit/htty/cli/commands/http_put_spec.rb +2 -0
- data/spec/unit/htty/cli/commands/patch_spec.rb +64 -0
- data/spec/unit/htty/cli/commands/path_set_spec.rb +2 -2
- data/spec/unit/htty/cli/commands/query_unset_all_spec.rb +1 -0
- metadata +24 -15
- data/autotest/discover.rb +0 -3
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,17 +2,21 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem
|
5
|
+
gem 'jruby-openssl', '~> 0', :platforms => :jruby
|
6
6
|
|
7
|
-
group :
|
8
|
-
gem
|
9
|
-
|
10
|
-
|
11
|
-
# v0.45 is incompatible with Ruby v1.8.7.
|
12
|
-
gem 'linecache', '<= 0.43', :platforms => :mri_18
|
7
|
+
group :debug do
|
8
|
+
gem 'ruby-debug', '~> 0', :platforms => :mri_18
|
9
|
+
gem 'ruby-debug19', '~> 0', :platforms => :mri_19, :require => 'ruby-debug'
|
10
|
+
end
|
13
11
|
|
14
|
-
|
12
|
+
group :doc do
|
13
|
+
gem 'yard', '~> 0', :platforms => [:ruby, :mswin, :mingw]
|
14
|
+
gem 'rdiscount', '~> 1', :platforms => [:ruby, :mswin, :mingw]
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
gem
|
17
|
+
group :tooling do
|
18
|
+
gem 'guard-rspec', '~> 0'
|
19
|
+
if RUBY_PLATFORM =~ /darwin/i
|
20
|
+
gem 'rb-fsevent', '~> 0', :require => false
|
21
|
+
end
|
18
22
|
end
|
data/Guardfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
guard 'rspec', :cli => '--color', :version => 2 do
|
2
|
+
# Run the corresponding spec (or all specs) when code changes.
|
3
|
+
watch( %r{^lib/(.+)\.rb$} ) do |match|
|
4
|
+
corresponding_specs = %W(spec/integration/#{match[1]}_spec.rb
|
5
|
+
spec/unit/#{match[1]}_spec.rb)
|
6
|
+
existing = corresponding_specs.select do |s|
|
7
|
+
File.file? File.expand_path( "../#{s}", __FILE__ )
|
8
|
+
end
|
9
|
+
existing.empty? ? 'spec' : existing
|
10
|
+
end
|
11
|
+
|
12
|
+
# Run a spec when it changes.
|
13
|
+
watch %r{^spec/.+_spec\.rb$}
|
14
|
+
|
15
|
+
# Run all specs when the bundle changes.
|
16
|
+
watch( 'Gemfile.lock' ) { 'spec' }
|
17
|
+
end
|
data/History.markdown
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
Version history for the _htty_ project
|
2
2
|
======================================
|
3
3
|
|
4
|
+
<a name="v1.4.0"></a>v1.4.0, Sat 3/10/2011
|
5
|
+
-------------------------------------------
|
6
|
+
|
7
|
+
* Added `http-patch` and `patch` commands to support HTTP PATCH
|
8
|
+
* Refined dependencies
|
9
|
+
|
4
10
|
<a name="v1.3.4"></a>v1.3.4, Mon 10/17/2011
|
5
11
|
-------------------------------------------
|
6
12
|
|
7
|
-
* Added support for Ctrl-D to exit and to terminate `body-set` command input \[with help from [
|
13
|
+
* Added support for Ctrl-D to exit and to terminate `body-set` command input \[with help from [bofrede](http://github.com/bofrede "bofrede at GitHub")\]
|
8
14
|
* Added `--version` and `--help` command-line arguments
|
9
15
|
|
10
16
|
<a name="v1.3.3"></a>v1.3.3, Sat 3/05/2011
|
data/MIT-LICENSE.markdown
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
The MIT License
|
2
2
|
===============
|
3
3
|
|
4
|
-
Source code for _htty_ is Copyright © 2010–
|
4
|
+
Source code for _htty_ is Copyright © 2010–2012 [Nils Jonsson](mailto:htty@nilsjonsson.com) and [contributors](http://github.com/htty/htty/contributors "htty contributors at GitHub").
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
7
|
|
data/README.markdown
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
|____| |____| / ______|
|
28
28
|
\/
|
29
29
|
|
30
|
-
[<img align="right" src="https://secure.travis-ci.org/htty/htty.png?branch=master" title="Travis CI build status" />](http://travis-ci.org/htty/htty) [htty](http://htty.github.com) 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.
|
30
|
+
[<img align="right" src="https://gemnasium.com/htty/htty.png" title="Gemnasium build status" />](http://gemnasium.com/htty/htty) [<img align="right" src="https://secure.travis-ci.org/htty/htty.png?branch=master" title="Travis CI build status" />](http://travis-ci.org/htty/htty) [htty](http://htty.github.com) 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.
|
31
31
|
|
32
32
|
See what’s changed lately by reading the [project history](http://htty.github.com/file.History.html).
|
33
33
|
|
@@ -96,7 +96,7 @@ There was some cruft in the web service’s response (a horizontal line, a passa
|
|
96
96
|
|
97
97
|
We do a Julia Child maneuver and use the `address` command to change the entire URL, rather than add individual query-string parameters one by one.
|
98
98
|
|
99
|
-
Exit your session at any time by typing `quit
|
99
|
+
Exit your session at any time by typing `quit` or hitting Ctrl-D.
|
100
100
|
|
101
101
|
<a name="cookies-example"></a>Working with cookies
|
102
102
|
--------------------------------------------------
|
@@ -154,7 +154,7 @@ When you change the userinfo portion of the address, or the entire address, the
|
|
154
154
|
|
155
155
|
When userinfo is supplied in a request, a bold mercantile symbol (_@_) appears next to the resulting _Authorization_ header when you display request headers (see below).
|
156
156
|
|
157
|
-
Type `body-set` to enter body data, and terminate it by
|
157
|
+
Type `body-set` to enter body data, and terminate it by entering two consecutive blank lines, or by hitting Ctrl-D. The body will only be sent for _POST_ and _PUT_ requests. The appropriate _Content-Length_ header is created for you automatically (see below).
|
158
158
|
|
159
159
|
Different response codes are rendered with colors that suggest their meaning:
|
160
160
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'bundler'
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
|
4
|
-
Bundler::GemHelper.install_tasks
|
5
|
-
|
6
4
|
begin
|
7
5
|
require 'yard'
|
8
6
|
rescue LoadError
|
@@ -42,13 +40,12 @@ def define_spec_task(name, options={})
|
|
42
40
|
require 'ruby-debug'
|
43
41
|
rescue LoadError
|
44
42
|
else
|
45
|
-
|
46
|
-
t.rspec_opts << '-d'
|
43
|
+
t.rspec_opts << '--debug'
|
47
44
|
end
|
48
45
|
end
|
49
46
|
|
50
47
|
directory = options[:as_subdirectory] ? "spec/#{name}" : 'spec'
|
51
|
-
t.pattern =
|
48
|
+
t.pattern = %W(#{directory}/*_spec.rb #{directory}/**/*_spec.rb)
|
52
49
|
end
|
53
50
|
end
|
54
51
|
|
data/htty.gemspec
CHANGED
@@ -10,17 +10,19 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ['htty@nilsjonsson.com']
|
11
11
|
s.homepage = 'http://htty.github.com'
|
12
12
|
s.summary = 'The HTTP TTY'
|
13
|
-
s.description =
|
14
|
-
|
15
|
-
'
|
13
|
+
s.description = <<-end_description.gsub(/^\s+/, '').chomp
|
14
|
+
htty is a console application for interacting with web servers.
|
15
|
+
It's a fun way to explore web APIs and to learn the ins and
|
16
|
+
outs of HTTP.
|
17
|
+
end_description
|
16
18
|
s.license = 'MIT'
|
17
19
|
|
18
20
|
s.required_ruby_version = '>= 1.8.7'
|
19
21
|
|
20
|
-
s.add_dependency
|
22
|
+
s.add_dependency 'mime-types', '~> 1'
|
21
23
|
|
22
|
-
s.add_development_dependency 'rake'
|
23
|
-
s.add_development_dependency 'rspec',
|
24
|
+
s.add_development_dependency 'rake', '~> 0'
|
25
|
+
s.add_development_dependency 'rspec', '~> 2'
|
24
26
|
|
25
27
|
s.rubyforge_project = 'htty'
|
26
28
|
s.has_rdoc = true
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../http_method_command")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/http_get")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/http_patch")
|
4
5
|
require File.expand_path("#{File.dirname __FILE__}/http_post")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/http_put")
|
6
7
|
|
@@ -31,6 +32,7 @@ class HTTY::CLI::Commands::HttpDelete < HTTY::CLI::Command
|
|
31
32
|
# Returns related command classes for the _http-delete_ command.
|
32
33
|
def self.see_also_commands
|
33
34
|
[HTTY::CLI::Commands::HttpGet,
|
35
|
+
HTTY::CLI::Commands::HttpPatch,
|
34
36
|
HTTY::CLI::Commands::HttpPost,
|
35
37
|
HTTY::CLI::Commands::HttpPut]
|
36
38
|
end
|
@@ -2,6 +2,7 @@ require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../http_method_command")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/follow")
|
4
4
|
require File.expand_path("#{File.dirname __FILE__}/http_delete")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/http_patch")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/http_post")
|
6
7
|
require File.expand_path("#{File.dirname __FILE__}/http_put")
|
7
8
|
|
@@ -32,6 +33,7 @@ class HTTY::CLI::Commands::HttpGet < HTTY::CLI::Command
|
|
32
33
|
# Returns related command classes for the _http-get_ command.
|
33
34
|
def self.see_also_commands
|
34
35
|
[HTTY::CLI::Commands::Follow,
|
36
|
+
HTTY::CLI::Commands::HttpPatch,
|
35
37
|
HTTY::CLI::Commands::HttpPost,
|
36
38
|
HTTY::CLI::Commands::HttpPut,
|
37
39
|
HTTY::CLI::Commands::HttpDelete]
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path("#{File.dirname __FILE__}/../command")
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../http_method_command")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/follow")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/http_delete")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/http_get")
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/http_post")
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/http_put")
|
8
|
+
|
9
|
+
module HTTY; end
|
10
|
+
|
11
|
+
class HTTY::CLI; end
|
12
|
+
|
13
|
+
module HTTY::CLI::Commands; end
|
14
|
+
|
15
|
+
# Encapsulates the _http-patch_ command.
|
16
|
+
class HTTY::CLI::Commands::HttpPatch < HTTY::CLI::Command
|
17
|
+
|
18
|
+
include HTTY::CLI::HTTPMethodCommand
|
19
|
+
|
20
|
+
# Returns the help text for the _http-patch_ command.
|
21
|
+
def self.help
|
22
|
+
'Issues an HTTP PATCH using the current request'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns related command classes for the _http-patch_ command.
|
26
|
+
def self.see_also_commands
|
27
|
+
[HTTY::CLI::Commands::HttpGet,
|
28
|
+
HTTY::CLI::Commands::Follow,
|
29
|
+
HTTY::CLI::Commands::HttpPost,
|
30
|
+
HTTY::CLI::Commands::HttpPut,
|
31
|
+
HTTY::CLI::Commands::HttpDelete]
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -3,6 +3,7 @@ require File.expand_path("#{File.dirname __FILE__}/../http_method_command")
|
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/follow")
|
4
4
|
require File.expand_path("#{File.dirname __FILE__}/http_delete")
|
5
5
|
require File.expand_path("#{File.dirname __FILE__}/http_get")
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/http_patch")
|
6
7
|
require File.expand_path("#{File.dirname __FILE__}/http_put")
|
7
8
|
|
8
9
|
module HTTY; end
|
@@ -25,6 +26,7 @@ class HTTY::CLI::Commands::HttpPost < HTTY::CLI::Command
|
|
25
26
|
def self.see_also_commands
|
26
27
|
[HTTY::CLI::Commands::HttpGet,
|
27
28
|
HTTY::CLI::Commands::Follow,
|
29
|
+
HTTY::CLI::Commands::HttpPatch,
|
28
30
|
HTTY::CLI::Commands::HttpPut,
|
29
31
|
HTTY::CLI::Commands::HttpDelete]
|
30
32
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../http_method_command")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/http_get")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/http_patch")
|
4
5
|
require File.expand_path("#{File.dirname __FILE__}/http_post")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/http_delete")
|
6
7
|
|
@@ -23,6 +24,7 @@ class HTTY::CLI::Commands::HttpPut < HTTY::CLI::Command
|
|
23
24
|
# Returns related command classes for the _http-put_ command.
|
24
25
|
def self.see_also_commands
|
25
26
|
[HTTY::CLI::Commands::HttpGet,
|
27
|
+
HTTY::CLI::Commands::HttpPatch,
|
26
28
|
HTTY::CLI::Commands::HttpPost,
|
27
29
|
HTTY::CLI::Commands::HttpDelete]
|
28
30
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path("#{File.dirname __FILE__}/../command")
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/http_patch")
|
3
|
+
|
4
|
+
module HTTY; end
|
5
|
+
|
6
|
+
class HTTY::CLI; end
|
7
|
+
|
8
|
+
module HTTY::CLI::Commands; end
|
9
|
+
|
10
|
+
# Encapsulates the _patch_ command.
|
11
|
+
class HTTY::CLI::Commands::Patch < HTTY::CLI::Command
|
12
|
+
|
13
|
+
# Returns the command that the _patch_ command is an alias for.
|
14
|
+
def self.alias_for
|
15
|
+
HTTY::CLI::Commands::HttpPatch
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
unless Net::HTTP.const_defined?(:Patch) &&
|
4
|
+
Net::HTTP.instance_methods.collect(&:to_sym).include?(:patch)
|
5
|
+
module Net
|
6
|
+
|
7
|
+
class HTTP < Protocol
|
8
|
+
|
9
|
+
# Represents a HTTP PATCH request. This class exists because Net::HTTP did
|
10
|
+
# not have this behavior in Ruby v1.9.2 and earlier.
|
11
|
+
class Patch < HTTPRequest
|
12
|
+
|
13
|
+
METHOD = 'PATCH'
|
14
|
+
REQUEST_HAS_BODY = true
|
15
|
+
RESPONSE_HAS_BODY = true
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def patch(path, data, initheader, &block)
|
20
|
+
res = nil
|
21
|
+
request(Patch.new(path, initheader), data) do |r|
|
22
|
+
r.read_body(nil, &block)
|
23
|
+
res = r
|
24
|
+
end
|
25
|
+
unless @newimpl
|
26
|
+
res.value
|
27
|
+
return res, res.body
|
28
|
+
end
|
29
|
+
res
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/lib/htty/requests_util.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'net/https'
|
3
3
|
require 'uri'
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/http_patch")
|
4
5
|
require File.expand_path("#{File.dirname __FILE__}/preferences")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/response")
|
6
7
|
|
@@ -37,6 +38,15 @@ module HTTY::RequestsUtil
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
41
|
+
# Makes an HTTP PATCH request with the specified _request_.
|
42
|
+
def self.patch(request)
|
43
|
+
request(request) do |host|
|
44
|
+
host.patch request.send(:path_query_and_fragment),
|
45
|
+
request.body,
|
46
|
+
request.headers
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
40
50
|
# Makes an HTTP POST request with the specified _request_.
|
41
51
|
def self.post(request)
|
42
52
|
request(request) do |host|
|
data/lib/htty/version.rb
CHANGED
@@ -29,11 +29,11 @@ describe HTTY::CLI::Commands::Cd do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should have the expected help' do
|
32
|
-
klass.help.should == "Alias for \e[
|
32
|
+
klass.help.should == "Alias for \e[1mpath[-set]\e[0m"
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'should have the expected help_extended' do
|
36
|
-
klass.help_extended.should == "Alias for \e[
|
36
|
+
klass.help_extended.should == "Alias for \e[1mpath[-set]\e[0m."
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should have the expected see_also_commands' do
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_patch")
|
4
5
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
|
6
7
|
|
@@ -45,6 +46,7 @@ Any request body you may set is ignored (i.e., it is not sent as part of the req
|
|
45
46
|
|
46
47
|
it 'should have the expected see_also_commands' do
|
47
48
|
klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet,
|
49
|
+
HTTY::CLI::Commands::HttpPatch,
|
48
50
|
HTTY::CLI::Commands::HttpPost,
|
49
51
|
HTTY::CLI::Commands::HttpPut]
|
50
52
|
end
|
@@ -2,6 +2,7 @@ require 'rspec'
|
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/follow")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
|
4
4
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_patch")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
|
6
7
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
|
7
8
|
|
@@ -46,6 +47,7 @@ Any request body you may set is ignored (i.e., it is not sent as part of the req
|
|
46
47
|
|
47
48
|
it 'should have the expected see_also_commands' do
|
48
49
|
klass.see_also_commands.should == [HTTY::CLI::Commands::Follow,
|
50
|
+
HTTY::CLI::Commands::HttpPatch,
|
49
51
|
HTTY::CLI::Commands::HttpPost,
|
50
52
|
HTTY::CLI::Commands::HttpPut,
|
51
53
|
HTTY::CLI::Commands::HttpDelete]
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/follow")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_patch")
|
6
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
|
7
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
|
8
|
+
|
9
|
+
describe HTTY::CLI::Commands::HttpPatch do
|
10
|
+
describe 'class' do
|
11
|
+
let :klass do
|
12
|
+
subject.class
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should be an alias_for the expected command' do
|
16
|
+
klass.alias_for.should == nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should have the expected aliases' do
|
20
|
+
klass.aliases.should == [HTTY::CLI::Commands::Patch]
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should belong to the expected category' do
|
24
|
+
klass.category.should == 'Issuing Requests'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should have the expected command_line' do
|
28
|
+
klass.command_line.should == 'http-pa[tch]'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should have the expected command_line_arguments' do
|
32
|
+
klass.command_line_arguments.should == nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help' do
|
36
|
+
klass.help.should == 'Issues an HTTP PATCH using the current request'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected help_extended' do
|
40
|
+
klass.help_extended.should == 'Issues an HTTP PATCH using the current ' +
|
41
|
+
'request.'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have the expected see_also_commands' do
|
45
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet,
|
46
|
+
HTTY::CLI::Commands::Follow,
|
47
|
+
HTTY::CLI::Commands::HttpPost,
|
48
|
+
HTTY::CLI::Commands::HttpPut,
|
49
|
+
HTTY::CLI::Commands::HttpDelete]
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'build_for' do
|
53
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
54
|
+
built = klass.build_for('http-patch', :session => :the_session)
|
55
|
+
built.should be_instance_of(klass)
|
56
|
+
built.arguments.should == []
|
57
|
+
built.session.should == :the_session
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
61
|
+
built = klass.build_for('http-pa', :session => :a_session)
|
62
|
+
built.should be_instance_of(klass)
|
63
|
+
built.arguments.should == []
|
64
|
+
built.session.should == :a_session
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should correctly handle a command line with a bad command' do
|
68
|
+
built = klass.build_for('x', :session => :another_session)
|
69
|
+
built.should == nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -2,6 +2,7 @@ require 'rspec'
|
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/follow")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
|
4
4
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
|
5
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_patch")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
|
6
7
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
|
7
8
|
|
@@ -43,6 +44,7 @@ describe HTTY::CLI::Commands::HttpPost do
|
|
43
44
|
it 'should have the expected see_also_commands' do
|
44
45
|
klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet,
|
45
46
|
HTTY::CLI::Commands::Follow,
|
47
|
+
HTTY::CLI::Commands::HttpPatch,
|
46
48
|
HTTY::CLI::Commands::HttpPut,
|
47
49
|
HTTY::CLI::Commands::HttpDelete]
|
48
50
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_delete")
|
3
3
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_get")
|
4
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_patch")
|
4
5
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_post")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_put")
|
6
7
|
|
@@ -41,6 +42,7 @@ describe HTTY::CLI::Commands::HttpPut do
|
|
41
42
|
|
42
43
|
it 'should have the expected see_also_commands' do
|
43
44
|
klass.see_also_commands.should == [HTTY::CLI::Commands::HttpGet,
|
45
|
+
HTTY::CLI::Commands::HttpPatch,
|
44
46
|
HTTY::CLI::Commands::HttpPost,
|
45
47
|
HTTY::CLI::Commands::HttpDelete]
|
46
48
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/patch")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/http_patch")
|
4
|
+
|
5
|
+
describe HTTY::CLI::Commands::Patch do
|
6
|
+
describe 'class' do
|
7
|
+
let :klass do
|
8
|
+
subject.class
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be an alias_for the expected command' do
|
12
|
+
klass.alias_for.should == HTTY::CLI::Commands::HttpPatch
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have the expected aliases' do
|
16
|
+
klass.aliases.should == []
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should belong to the expected category' do
|
20
|
+
klass.category.should == 'Issuing Requests'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should have the expected command_line' do
|
24
|
+
klass.command_line.should == 'patc[h]'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should have the expected command_line_arguments' do
|
28
|
+
klass.command_line_arguments.should == nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should have the expected help' do
|
32
|
+
klass.help.should == "Alias for \e[1mhttp-pa[tch]\e[0m"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have the expected help_extended' do
|
36
|
+
klass.help_extended.should == "Alias for \e[1mhttp-pa[tch]\e[0m."
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have the expected see_also_commands' do
|
40
|
+
klass.see_also_commands.should == [HTTY::CLI::Commands::HttpPatch]
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'build_for' do
|
44
|
+
it 'should correctly handle a valid, unabbreviated command line' do
|
45
|
+
built = klass.build_for('patch', :session => :the_session)
|
46
|
+
built.should be_instance_of(klass)
|
47
|
+
built.arguments.should == []
|
48
|
+
built.session.should == :the_session
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should correctly handle a valid, abbreviated command line' do
|
52
|
+
built = klass.build_for('patc', :session => :a_session)
|
53
|
+
built.should be_instance_of(klass)
|
54
|
+
built.arguments.should == []
|
55
|
+
built.session.should == :a_session
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should correctly handle a command line with a bad command' do
|
59
|
+
built = klass.build_for('x', :session => :another_session)
|
60
|
+
built.should == nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -22,7 +22,7 @@ describe HTTY::CLI::Commands::PathSet do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should have the expected command_line' do
|
25
|
-
klass.command_line.should == '
|
25
|
+
klass.command_line.should == 'path[-set]'
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should have the expected command_line_arguments' do
|
@@ -57,7 +57,7 @@ The console prompt shows the address for the current request.
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should correctly handle a valid, abbreviated command line' do
|
60
|
-
built = klass.build_for('
|
60
|
+
built = klass.build_for('path bar', :session => :a_session)
|
61
61
|
built.should be_instance_of(klass)
|
62
62
|
built.arguments.should == ['bar']
|
63
63
|
built.session.should == :a_session
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/address")
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_clear")
|
3
4
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_set")
|
4
5
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset")
|
5
6
|
require File.expand_path("#{File.dirname __FILE__}/../../../../../lib/htty/cli/commands/query_unset_all")
|
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:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 3
|
9
8
|
- 4
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 1.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nils Jonsson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-03-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: mime-types
|
@@ -23,12 +23,12 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 1
|
29
29
|
segments:
|
30
|
-
-
|
31
|
-
version: "
|
30
|
+
- 1
|
31
|
+
version: "1"
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -37,7 +37,7 @@ dependencies:
|
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
hash: 3
|
43
43
|
segments:
|
@@ -53,14 +53,16 @@ dependencies:
|
|
53
53
|
requirements:
|
54
54
|
- - ~>
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
hash:
|
56
|
+
hash: 7
|
57
57
|
segments:
|
58
58
|
- 2
|
59
|
-
|
60
|
-
version: "2.7"
|
59
|
+
version: "2"
|
61
60
|
type: :development
|
62
61
|
version_requirements: *id003
|
63
|
-
description:
|
62
|
+
description: |-
|
63
|
+
htty is a console application for interacting with web servers.
|
64
|
+
It's a fun way to explore web APIs and to learn the ins and
|
65
|
+
outs of HTTP.
|
64
66
|
email:
|
65
67
|
- htty@nilsjonsson.com
|
66
68
|
executables:
|
@@ -75,11 +77,11 @@ files:
|
|
75
77
|
- .travis.yml
|
76
78
|
- .yardopts
|
77
79
|
- Gemfile
|
80
|
+
- Guardfile
|
78
81
|
- History.markdown
|
79
82
|
- MIT-LICENSE.markdown
|
80
83
|
- README.markdown
|
81
84
|
- Rakefile
|
82
|
-
- autotest/discover.rb
|
83
85
|
- bin/htty
|
84
86
|
- htty.gemspec
|
85
87
|
- lib/htty.rb
|
@@ -132,9 +134,11 @@ files:
|
|
132
134
|
- lib/htty/cli/commands/http_get.rb
|
133
135
|
- lib/htty/cli/commands/http_head.rb
|
134
136
|
- lib/htty/cli/commands/http_options.rb
|
137
|
+
- lib/htty/cli/commands/http_patch.rb
|
135
138
|
- lib/htty/cli/commands/http_post.rb
|
136
139
|
- lib/htty/cli/commands/http_put.rb
|
137
140
|
- lib/htty/cli/commands/http_trace.rb
|
141
|
+
- lib/htty/cli/commands/patch.rb
|
138
142
|
- lib/htty/cli/commands/path_set.rb
|
139
143
|
- lib/htty/cli/commands/port_set.rb
|
140
144
|
- lib/htty/cli/commands/post.rb
|
@@ -160,6 +164,7 @@ files:
|
|
160
164
|
- lib/htty/cli/http_method_command.rb
|
161
165
|
- lib/htty/cli/url_escaping.rb
|
162
166
|
- lib/htty/cookies_util.rb
|
167
|
+
- lib/htty/http_patch.rb
|
163
168
|
- lib/htty/no_location_header_error.rb
|
164
169
|
- lib/htty/no_response_error.rb
|
165
170
|
- lib/htty/no_set_cookie_header_error.rb
|
@@ -220,9 +225,11 @@ files:
|
|
220
225
|
- spec/unit/htty/cli/commands/http_get_spec.rb
|
221
226
|
- spec/unit/htty/cli/commands/http_head_spec.rb
|
222
227
|
- spec/unit/htty/cli/commands/http_options_spec.rb
|
228
|
+
- spec/unit/htty/cli/commands/http_patch_spec.rb
|
223
229
|
- spec/unit/htty/cli/commands/http_post_spec.rb
|
224
230
|
- spec/unit/htty/cli/commands/http_put_spec.rb
|
225
231
|
- spec/unit/htty/cli/commands/http_trace_spec.rb
|
232
|
+
- spec/unit/htty/cli/commands/patch_spec.rb
|
226
233
|
- spec/unit/htty/cli/commands/path_set_spec.rb
|
227
234
|
- spec/unit/htty/cli/commands/port_set_spec.rb
|
228
235
|
- spec/unit/htty/cli/commands/post_spec.rb
|
@@ -282,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
289
|
requirements: []
|
283
290
|
|
284
291
|
rubyforge_project: htty
|
285
|
-
rubygems_version: 1.8.
|
292
|
+
rubygems_version: 1.8.11
|
286
293
|
signing_key:
|
287
294
|
specification_version: 3
|
288
295
|
summary: The HTTP TTY
|
@@ -334,9 +341,11 @@ test_files:
|
|
334
341
|
- spec/unit/htty/cli/commands/http_get_spec.rb
|
335
342
|
- spec/unit/htty/cli/commands/http_head_spec.rb
|
336
343
|
- spec/unit/htty/cli/commands/http_options_spec.rb
|
344
|
+
- spec/unit/htty/cli/commands/http_patch_spec.rb
|
337
345
|
- spec/unit/htty/cli/commands/http_post_spec.rb
|
338
346
|
- spec/unit/htty/cli/commands/http_put_spec.rb
|
339
347
|
- spec/unit/htty/cli/commands/http_trace_spec.rb
|
348
|
+
- spec/unit/htty/cli/commands/patch_spec.rb
|
340
349
|
- spec/unit/htty/cli/commands/path_set_spec.rb
|
341
350
|
- spec/unit/htty/cli/commands/port_set_spec.rb
|
342
351
|
- spec/unit/htty/cli/commands/post_spec.rb
|
data/autotest/discover.rb
DELETED