htty 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,4 +5,3 @@
5
5
  Gemfile.lock
6
6
  doc/
7
7
  pkg/*
8
- spec/system/scenarios/**/actual_*
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - ree
5
+ - jruby
6
+ - rbx
7
+ script: "bundle exec rake test"
8
+ notifications:
9
+ irc: "irc.freenode.org#htty"
data/Gemfile CHANGED
@@ -2,7 +2,17 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'jruby-openssl', :platforms => :jruby
6
+
5
7
  group :development do
6
- gem 'ruby-debug', '~> 0.2', :platforms => 'ruby_18'
7
- gem 'ruby-debug19', '~> 0.11', :platforms => 'ruby_19'
8
+ gem 'ruby-debug', :platforms => :mri_18
9
+
10
+ # This is a dependency of ruby-debug. We're specifying it here because its
11
+ # v0.45 is incompatible with Ruby v1.8.7.
12
+ gem 'linecache', '<= 0.43', :platforms => :mri_18
13
+
14
+ gem 'ruby-debug19', :platforms => :mri_19
15
+
16
+ gem 'yard', :platforms => [:ruby, :mswin, :mingw]
17
+ gem 'rdiscount', :platforms => [:ruby, :mswin, :mingw]
8
18
  end
data/History.markdown CHANGED
@@ -1,6 +1,12 @@
1
1
  Version history for the _htty_ project
2
2
  ======================================
3
3
 
4
+ <a name="v1.3.4"></a>v1.3.4, Mon 10/17/2011
5
+ -------------------------------------------
6
+
7
+ * 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
+ * Added `--version` and `--help` command-line arguments
9
+
4
10
  <a name="v1.3.3"></a>v1.3.3, Sat 3/05/2011
5
11
  -------------------------------------------
6
12
 
@@ -34,12 +40,12 @@ Version history for the _htty_ project
34
40
  -------------------------------------------
35
41
 
36
42
  * Added support for Tab-key completion of user input [[carsonmcdonald](http://github.com/carsonmcdonald "carsonmcdonald at GitHub")]
37
- * Enhanced the `query-unset` command to accept an optional _value_ argument [[mattsa](http://github.com/mattsa "mattsa at GitHub")]
43
+ * Enhanced the `query-unset` command to accept an optional _value_ argument [[nextmat](http://github.com/nextmat "nextmat at GitHub")]
38
44
 
39
45
  <a name="v1.1.6"></a>v1.1.6, Mon 11/22/2010
40
46
  -------------------------------------------
41
47
 
42
- * Added the `query-add` and `query-remove` commands [[mattsa](http://github.com/mattsa "mattsa at GitHub")]:
48
+ * Added the `query-add` and `query-remove` commands [[nextmat](http://github.com/nextmat "nextmat at GitHub")]:
43
49
  * Added context-sensitive help in connection with server certificate verification
44
50
  * Upgraded various dependencies
45
51
 
@@ -47,13 +53,13 @@ Version history for the _htty_ project
47
53
  -------------------------------------------
48
54
 
49
55
  * Added the `ssl-verification*` commands for controlling the verification of server certificates [[dtjm](http://github.com/dtjm "dtjm at GitHub")]
50
- * Fixed a bug in the `query-set` command [[mattsa](http://github.com/mattsa "mattsa at GitHub")]
56
+ * Fixed a bug in the `query-set` command [[nextmat](http://github.com/nextmat "nextmat at GitHub")]
51
57
  * Fixed a Ruby < v1.9 compatibility problem
52
58
 
53
59
  <a name="v1.1.4"></a>v1.1.4, Sat 10/16/2010
54
60
  -------------------------------------------
55
61
 
56
- * Enhanced the `query-set` command [[mattsa](http://github.com/mattsa "mattsa at GitHub")] to:
62
+ * Enhanced the `query-set` command [[nextmat](http://github.com/nextmat "nextmat at GitHub")] to:
57
63
  - Accept an arbitrary number of arguments
58
64
  - Support valueless keys
59
65
  - Support duplicate keys
data/README.markdown CHANGED
@@ -27,9 +27,9 @@
27
27
  |____| |____| / ______|
28
28
  \/
29
29
 
30
- [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://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
- See what’s changed lately by reading the [project history](http://htty.github.com/file.History.html). [![Flattr this](http://api.flattr.com/button/button-compact-static-100x17.png)](http://flattr.com/thing/68277/htty-the-HTTP-TTY "Flattr this")
32
+ See what’s changed lately by reading the [project history](http://htty.github.com/file.History.html).
33
33
 
34
34
  <a name="installation"></a>Installation
35
35
  =======================================
@@ -101,7 +101,7 @@ Exit your session at any time by typing `quit`.
101
101
  <a name="cookies-example"></a>Working with cookies
102
102
  --------------------------------------------------
103
103
 
104
- The next example demonstrates _htty_’s HTTP Secure support and cookies features, as well as how to review and revisit past requests.
104
+ The next example demonstrates <i>htty</i>’s HTTP Secure support and cookies features, as well as how to review and revisit past requests.
105
105
 
106
106
  ![Google example #1](http://htty.github.com/images/google1.png)
107
107
 
@@ -124,7 +124,7 @@ The `reuse` command makes a copy of the headers and body of an earlier request f
124
124
  <a name="history-example"></a>Understanding complex HTTP conversations at a glance using history
125
125
  ------------------------------------------------------------------------------------------------
126
126
 
127
- Now we’ll look at _htty_’s HTTP Basic Authentication support and learn how to display unabbreviated transcripts of _htty_ sessions.
127
+ Now we’ll look at <i>htty</i>’s HTTP Basic Authentication support and learn how to display unabbreviated transcripts of _htty_ sessions.
128
128
 
129
129
  Assume that we have the following Sinatra application listening on Sinatra’s default port, 4567.
130
130
 
@@ -217,7 +217,7 @@ Stay in touch with the _htty_ project by following [@get_htty](http://twitter.co
217
217
 
218
218
  You can also get help in the [#htty channel on Freenode](http://webchat.freenode.net/?channels=htty).
219
219
 
220
- <a name="credits"></a>Credits [![Flattr this](http://api.flattr.com/button/button-compact-static-100x17.png)](http://flattr.com/thing/68277/htty-the-HTTP-TTY "Flattr this")
220
+ <a name="credits"></a>Credits
221
221
  =============================
222
222
 
223
223
  The author, [Nils Jonsson](mailto:htty@nilsjonsson.com), owes a debt of inspiration to the [_http-console_](http://github.com/cloudhead/http-console) project.
@@ -228,9 +228,9 @@ Thanks to [contributors](http://github.com/htty/htty/contributors "htty contribu
228
228
  * Bo Frederiksen ([bofrede](http://github.com/bofrede "bofrede at GitHub"))
229
229
  * Johannes Gorset ([jgorset](http://github.com/jgorset "jgorset at GitHub"))
230
230
  * Carson McDonald ([carsonmcdonald](http://github.com/carsonmcdonald "carsonmcdonald at GitHub"))
231
- * Sam Nguyen ([dtjm](http://github.com/dtjm "dtjm at GitHub"))
231
+ * Sam X ([dtjm](http://github.com/dtjm "dtjm at GitHub"))
232
232
  * Robert Pitts ([rbxbx](http://github.com/rbxbx "rbxbx at GitHub"))
233
- * Matt Sanders ([mattsa](http://github.com/mattsa "mattsa at GitHub"))
233
+ * Matt Sanders ([nextmat](http://github.com/nextmat "nextmat at GitHub"))
234
234
 
235
235
  <a name="license"></a>License
236
236
  =============================
data/Rakefile CHANGED
@@ -1,19 +1,13 @@
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
1
6
  begin
2
- require 'bundler'
7
+ require 'yard'
3
8
  rescue LoadError
4
9
  else
5
- Bundler::GemHelper.install_tasks
6
- end
7
-
8
- namespace :build do
9
- begin
10
- require 'yard'
11
- rescue LoadError
12
- desc "(Not available -- try 'gem install yard')"
13
- task :doc do
14
- STDERR.puts "*** 'gem install yard' in order to build documentation"
15
- end
16
- else
10
+ namespace :build do
17
11
  YARD::Rake::YardocTask.new :doc
18
12
  end
19
13
  end
@@ -40,43 +34,38 @@ namespace :lib do
40
34
  end
41
35
  end
42
36
 
43
- begin
44
- require 'rspec/core/rake_task'
45
- rescue LoadError
46
- desc "(Not available -- try 'gem install rspec')"
47
- task :spec do
48
- STDERR.puts "*** 'gem install rspec' in order to run specs"
49
- end
50
- else
51
- def define_spec_task(name, options={})
52
- RSpec::Core::RakeTask.new name do |t|
53
- t.rspec_opts = ['--color']
54
- t.skip_bundler = options[:skip_bundler]
55
- unless options[:debug] == false
37
+ def define_spec_task(name, options={})
38
+ RSpec::Core::RakeTask.new name do |t|
39
+ t.rspec_opts = ['--color']
40
+ unless options[:debug] == false
41
+ begin
42
+ require 'ruby-debug'
43
+ rescue LoadError
44
+ else
56
45
  # TODO: Change '-d' to '--debug' when that `rspec` bug is fixed
57
46
  t.rspec_opts << '-d'
58
47
  end
59
-
60
- directory = options[:as_subdirectory] ? "spec/#{name}" : 'spec'
61
- t.pattern = "#{directory}/**/*_spec.rb"
62
48
  end
49
+
50
+ directory = options[:as_subdirectory] ? "spec/#{name}" : 'spec'
51
+ t.pattern = "#{directory}/**/*_spec.rb"
63
52
  end
53
+ end
64
54
 
65
- namespace :spec do |n|
66
- %w(unit integration system).each do |type_of_spec|
67
- desc "Run #{type_of_spec} specs"
68
- define_spec_task type_of_spec, :as_subdirectory => true
69
- end
55
+ namespace :spec do |n|
56
+ %w(unit integration).each do |type_of_spec|
57
+ desc "Run #{type_of_spec} specs"
58
+ define_spec_task type_of_spec, :as_subdirectory => true
70
59
  end
60
+ end
71
61
 
72
- desc 'Run all specs'
73
- define_spec_task :spec
62
+ desc 'Run all specs'
63
+ define_spec_task :spec
74
64
 
75
- desc 'Run all specs'
76
- task '' => :spec
77
- task :default => :spec
65
+ desc 'Run all specs'
66
+ task '' => :spec
67
+ task :default => :spec
78
68
 
79
- # Support the 'gem test' command.
80
- desc ''
81
- define_spec_task :test, :debug => false, :skip_bundler => true
82
- end
69
+ # Support the 'gem test' command.
70
+ desc ''
71
+ define_spec_task :test, :debug => false
data/htty.gemspec CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.required_ruby_version = '>= 1.8.7'
19
19
 
20
- s.add_dependency 'mime-types', '~> 1.0'
20
+ s.add_dependency 'mime-types'
21
21
 
22
- s.add_development_dependency 'rake', '~> 0.8'
23
- s.add_development_dependency 'rspec', '~> 2.0'
22
+ s.add_development_dependency 'rake'
23
+ s.add_development_dependency 'rspec', '~> 2.7'
24
24
 
25
25
  s.rubyforge_project = 'htty'
26
26
  s.has_rdoc = true
@@ -31,7 +31,7 @@ class HTTY::CLI::Commands::BodySet < HTTY::CLI::Command
31
31
  'Sets the body content used for the request. Does not communicate with ' +
32
32
  "the host.\n" +
33
33
  "\n" +
34
- 'Hit Return three times in a row to signify the end of the body.'
34
+ 'Enter two blank lines, or hit Ctrl-D, to signify the end of the body.'
35
35
  end
36
36
 
37
37
  # Returns related command classes for the _body-set_ command.
@@ -42,7 +42,8 @@ class HTTY::CLI::Commands::BodySet < HTTY::CLI::Command
42
42
  # Performs the _body-set_ command.
43
43
  def perform
44
44
  add_request_if_new do |request|
45
- puts notice('Hit Return three times to signify the end of the body')
45
+ puts notice('Enter two blank lines, or hit Ctrl-D, to signify the end ' +
46
+ 'of the body')
46
47
  lines = []
47
48
  empty_line_count = 0
48
49
  while empty_line_count < 2 do
data/lib/htty/cli.rb CHANGED
@@ -4,6 +4,7 @@ require File.expand_path("#{File.dirname __FILE__}/cli/commands/help")
4
4
  require File.expand_path("#{File.dirname __FILE__}/cli/commands/quit")
5
5
  require File.expand_path("#{File.dirname __FILE__}/cli/display")
6
6
  require File.expand_path("#{File.dirname __FILE__}/session")
7
+ require File.expand_path("#{File.dirname __FILE__}/version")
7
8
 
8
9
  module HTTY; end
9
10
 
@@ -17,12 +18,23 @@ class HTTY::CLI
17
18
 
18
19
  # Instantiates a new HTTY::CLI with the specified _command_line_arguments_.
19
20
  def initialize(command_line_arguments)
21
+ if command_line_arguments.include?('--version')
22
+ puts "v#{HTTY::VERSION}"
23
+ exit
24
+ end
25
+
26
+ if command_line_arguments.include?('--help')
27
+ HTTY::CLI::Commands::Help.new.perform
28
+ exit
29
+ end
30
+
20
31
  exit unless @session = rescuing_from(ArgumentError) do
21
32
  everything_but_options = command_line_arguments.reject do |a|
22
33
  a[0..0] == '-'
23
34
  end
24
35
  HTTY::Session.new(everything_but_options.first)
25
36
  end
37
+
26
38
  register_completion_proc
27
39
  end
28
40
 
@@ -30,6 +42,7 @@ class HTTY::CLI
30
42
  # interaction.
31
43
  def run!
32
44
  say_hello
45
+
33
46
  catch :quit do
34
47
  loop do
35
48
  begin
@@ -39,10 +52,12 @@ class HTTY::CLI
39
52
  strong(HTTY::CLI::Commands::Help.command_line))
40
53
  next
41
54
  end
55
+
42
56
  if command == :unclosed_quote
43
57
  $stderr.puts notice('Unclosed quoted expression -- try again')
44
58
  next
45
59
  end
60
+
46
61
  if ARGV.include?('--debug')
47
62
  command.perform
48
63
  else
@@ -52,13 +67,11 @@ class HTTY::CLI
52
67
  end
53
68
  rescue Interrupt
54
69
  puts
55
- puts notice('Type ' +
56
- strong(HTTY::CLI::Commands::Quit.command_line) +
57
- ' to quit')
58
- next
70
+ throw :quit
59
71
  end
60
72
  end
61
73
  end
74
+
62
75
  say_goodbye
63
76
  end
64
77
 
data/lib/htty/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module HTTY
2
2
 
3
3
  # The version of this release of _htty_.
4
- VERSION = '1.3.3' unless const_defined?(:VERSION)
4
+ VERSION = '1.3.4' unless const_defined?(:VERSION)
5
5
 
6
6
  end
@@ -37,7 +37,7 @@ describe HTTY::CLI::Commands::BodySet do
37
37
  expected = <<-end_help_extended
38
38
  Sets the body content used for the request. Does not communicate with the host.
39
39
 
40
- Hit Return three times in a row to signify the end of the body.
40
+ Enter two blank lines, or hit Ctrl-D, to signify the end of the body.
41
41
  end_help_extended
42
42
  klass.help_extended.should == expected.chomp
43
43
  end
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: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 3
10
- version: 1.3.3
9
+ - 4
10
+ version: 1.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nils Jonsson
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-05 00:00:00 -06:00
19
- default_executable:
18
+ date: 2011-10-17 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: mime-types
@@ -24,13 +23,12 @@ dependencies:
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
- - - ~>
26
+ - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 15
28
+ hash: 3
30
29
  segments:
31
- - 1
32
30
  - 0
33
- version: "1.0"
31
+ version: "0"
34
32
  type: :runtime
35
33
  version_requirements: *id001
36
34
  - !ruby/object:Gem::Dependency
@@ -39,13 +37,12 @@ dependencies:
39
37
  requirement: &id002 !ruby/object:Gem::Requirement
40
38
  none: false
41
39
  requirements:
42
- - - ~>
40
+ - - ">="
43
41
  - !ruby/object:Gem::Version
44
- hash: 27
42
+ hash: 3
45
43
  segments:
46
44
  - 0
47
- - 8
48
- version: "0.8"
45
+ version: "0"
49
46
  type: :development
50
47
  version_requirements: *id002
51
48
  - !ruby/object:Gem::Dependency
@@ -56,11 +53,11 @@ dependencies:
56
53
  requirements:
57
54
  - - ~>
58
55
  - !ruby/object:Gem::Version
59
- hash: 3
56
+ hash: 13
60
57
  segments:
61
58
  - 2
62
- - 0
63
- version: "2.0"
59
+ - 7
60
+ version: "2.7"
64
61
  type: :development
65
62
  version_requirements: *id003
66
63
  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.
@@ -75,6 +72,7 @@ extra_rdoc_files: []
75
72
  files:
76
73
  - .gemtest
77
74
  - .gitignore
75
+ - .travis.yml
78
76
  - .yardopts
79
77
  - Gemfile
80
78
  - History.markdown
@@ -179,11 +177,6 @@ files:
179
177
  - spec/integration/htty/cli/commands/query_remove_spec.rb
180
178
  - spec/integration/htty/cli/commands/query_set_spec.rb
181
179
  - spec/integration/htty/cli/commands/query_unset_spec.rb
182
- - spec/system/scenarios/exit/expected_stdout
183
- - spec/system/scenarios/exit/stdin
184
- - spec/system/scenarios/quit/expected_stdout
185
- - spec/system/scenarios/quit/stdin
186
- - spec/system/scenarios_spec.rb
187
180
  - spec/unit/htty/cli/commands/address_spec.rb
188
181
  - spec/unit/htty/cli/commands/body_clear_spec.rb
189
182
  - spec/unit/htty/cli/commands/body_request_spec.rb
@@ -258,7 +251,6 @@ files:
258
251
  - spec/unit/htty/response_spec.rb
259
252
  - spec/unit/htty/session_spec.rb
260
253
  - spec/unit/htty/version_spec.rb
261
- has_rdoc: true
262
254
  homepage: http://htty.github.com
263
255
  licenses:
264
256
  - MIT
@@ -290,7 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
282
  requirements: []
291
283
 
292
284
  rubyforge_project: htty
293
- rubygems_version: 1.6.1
285
+ rubygems_version: 1.8.5
294
286
  signing_key:
295
287
  specification_version: 3
296
288
  summary: The HTTP TTY
@@ -299,11 +291,6 @@ test_files:
299
291
  - spec/integration/htty/cli/commands/query_remove_spec.rb
300
292
  - spec/integration/htty/cli/commands/query_set_spec.rb
301
293
  - spec/integration/htty/cli/commands/query_unset_spec.rb
302
- - spec/system/scenarios/exit/expected_stdout
303
- - spec/system/scenarios/exit/stdin
304
- - spec/system/scenarios/quit/expected_stdout
305
- - spec/system/scenarios/quit/stdin
306
- - spec/system/scenarios_spec.rb
307
294
  - spec/unit/htty/cli/commands/address_spec.rb
308
295
  - spec/unit/htty/cli/commands/body_clear_spec.rb
309
296
  - spec/unit/htty/cli/commands/body_request_spec.rb
@@ -378,3 +365,4 @@ test_files:
378
365
  - spec/unit/htty/response_spec.rb
379
366
  - spec/unit/htty/session_spec.rb
380
367
  - spec/unit/htty/version_spec.rb
368
+ has_rdoc: true
@@ -1,2 +0,0 @@
1
- *** Welcome to  htty , the HTTP TTY. Heck To The Yeah!
2
- *** Happy Trails To You!
@@ -1 +0,0 @@
1
- exit
@@ -1,2 +0,0 @@
1
- *** Welcome to  htty , the HTTP TTY. Heck To The Yeah!
2
- *** Happy Trails To You!
@@ -1 +0,0 @@
1
- quit
@@ -1,47 +0,0 @@
1
- require 'rspec'
2
- require 'pathname'
3
-
4
- all_dir = Pathname.new("#{File.dirname __FILE__}/scenarios")
5
- Dir.glob "#{all_dir}/**/*/" do |this_dir|
6
- relative_path = Pathname.new(this_dir).relative_path_from(all_dir).to_s
7
- context_name = relative_path.split('/').join(' ').gsub('_', ' ')
8
- describe context_name do
9
- define_method :content do |filename|
10
- path = "#{this_dir}/#{filename}"
11
- return nil unless File.file?(path)
12
- content = File.read(path)
13
- return nil if content.empty?
14
- content
15
- end
16
-
17
- define_method :run_and_capture do |*args|
18
- options = args.first || {}
19
- stdin_filename = "#{this_dir}/stdin"
20
- htty_filename = "#{File.dirname __FILE__}/../../bin/htty"
21
- stderr_target = options[:combine_stdout_and_stderr] ?
22
- '&1' :
23
- "#{this_dir}/actual_stderr"
24
- arguments = "#{content 'arguments'} 2>#{stderr_target}"
25
- stdout_filename = "#{this_dir}/actual_stdout"
26
- system "cat #{stdin_filename} | " +
27
- "#{htty_filename} #{arguments} > " +
28
- "#{this_dir}/actual_stdout"
29
- end
30
-
31
- it 'should produce the expected stdout' do
32
- run_and_capture
33
- content('actual_stdout').should == content('expected_stdout')
34
- end
35
-
36
- it 'should produce the expected stderr' do
37
- run_and_capture
38
- content('actual_stderr').should == content('expected_stderr')
39
- end
40
-
41
- it 'should produce the expected combined stdout and stderr' do
42
- run_and_capture :combine_stdout_and_stderr => true
43
- content('actual_stdout_and_stderr').should ==
44
- content('expected_stdout_and_stderr')
45
- end
46
- end
47
- end