matthewtodd-perquackey 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/CHANGELOG +5 -0
  2. data/TODO +2 -0
  3. data/bin/perquackey +9 -19
  4. data/lib/perquackey/console.rb +17 -3
  5. metadata +7 -14
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.3.3 -- 2009-04-18
2
+ * Removed mongrel dependency.
3
+ * Switched console to use readline instead of irb.
4
+ * Remove stdout usage. Console is the default.
5
+
1
6
  == 0.3.2 -- 2008-10-12
2
7
  * BUGFIX Needed to define Perquackey module.
3
8
 
data/TODO CHANGED
@@ -0,0 +1,2 @@
1
+ * remove dependency on RubyInline?
2
+ * tabtab_definitions --> except tabtab's not working well with -- options.
@@ -2,12 +2,11 @@
2
2
  require 'optparse'
3
3
  require 'ostruct'
4
4
 
5
- conf = OpenStruct.new(:mode => :stdout, :port => 3000)
5
+ conf = OpenStruct.new(:mode => :console, :port => 3000)
6
6
 
7
7
  opts = OptionParser.new do |opts|
8
- opts.banner = "Usage: #{File.basename($0)} [options] <word>"
8
+ opts.banner = "Usage: #{File.basename($0)} [options]"
9
9
  opts.separator ''
10
- opts.on('-c', '--console', 'Run as an interactve console') { conf.mode = :console }
11
10
  opts.on('-s', '--server', 'Run as a web server') { conf.mode = :server }
12
11
  opts.on('-p', '--port PORT', "Port for web server (defaults to #{conf.port})") { |port| conf.port = port }
13
12
  opts.on('-h', '--help', 'Show this message') { puts opts; exit }
@@ -20,24 +19,15 @@ LIB_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
20
19
  $:.unshift LIB_DIR
21
20
 
22
21
  case conf.mode
23
- when :stdout
24
- require 'perquackey'
25
- Perquackey::Game.new.words(ARGV.shift).each { |row| puts row.join(' ') }
26
22
  when :console
27
- exec "irb -I#{LIB_DIR} -r perquackey/console --simple-prompt"
23
+ require 'perquackey/console'
28
24
  when :server
25
+ require 'webrick'
29
26
  require 'rubygems'
30
- require 'mongrel/camping'
27
+ require 'camping/webrick'
31
28
  require 'perquackey/server'
32
-
33
- config = Mongrel::Configurator.new :host => '0.0.0.0' do
34
- listener :port => conf.port do
35
- uri '/', :handler => Mongrel::Camping::CampingHandler.new(Perquackey)
36
- trap('INT') { stop }
37
- run
38
- end
39
- end
40
-
41
- puts "** Perquackey is running at http://localhost:#{conf.port}"
42
- config.join
29
+ server = WEBrick::HTTPServer.new(:Port => conf.port)
30
+ server.mount '/', WEBrick::CampingHandler, Perquackey
31
+ trap(:INT) { server.shutdown }
32
+ server.start
43
33
  end
@@ -1,5 +1,19 @@
1
1
  require 'perquackey'
2
+ require 'readline'
2
3
 
3
- def method_missing(symbol, *args, &block)
4
- Perquackey::Game.new.words(symbol.to_s).each { |row| puts row.join(' ') }
5
- end
4
+ puts 'Type ctrl-d or quit to exit.'
5
+
6
+ game = Perquackey::Game.new
7
+
8
+ loop do
9
+ line = Readline::readline('> ') || 'quit'
10
+ next if line.strip == ''
11
+ Readline::HISTORY.push(line)
12
+
13
+ if line == 'quit'
14
+ puts 'Goodbye.'
15
+ exit
16
+ else
17
+ game.words(line).each { |row| puts row.join(' ') }
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matthewtodd-perquackey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Todd
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-12 00:00:00 -07:00
12
+ date: 2009-04-18 00:00:00 -07:00
13
13
  default_executable: perquackey
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: RubyInline
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,15 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: camping
26
- version_requirement:
27
- version_requirements: !ruby/object:Gem::Requirement
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- version: "0"
32
- version:
33
- - !ruby/object:Gem::Dependency
34
- name: mongrel
27
+ type: :runtime
35
28
  version_requirement:
36
29
  version_requirements: !ruby/object:Gem::Requirement
37
30
  requirements:
@@ -68,7 +61,7 @@ rdoc_options:
68
61
  - --main
69
62
  - README
70
63
  - --title
71
- - perquackey-0.3.2
64
+ - perquackey-0.4.0
72
65
  - --inline-source
73
66
  - --line-numbers
74
67
  require_paths:
@@ -90,7 +83,7 @@ requirements: []
90
83
  rubyforge_project:
91
84
  rubygems_version: 1.2.0
92
85
  signing_key:
93
- specification_version: 2
94
- summary: Provides irb console session and Camping webapp for looking up Perquackey word matches
86
+ specification_version: 3
87
+ summary: Provides console session and Camping webapp for looking up Perquackey word matches
95
88
  test_files: []
96
89