perquackey 0.7.1 → 0.7.2
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.
- data/CHANGELOG.rdoc +7 -1
- data/Gemfile +3 -2
- data/Gemfile.lock +43 -0
- data/TODO.rdoc +0 -1
- data/bin/perquackey +15 -1
- data/data/perquackey/templates/index.erb +2 -0
- data/lib/perquackey.rb +9 -2
- data/lib/perquackey/application.rb +16 -17
- data/man/perquackey.1 +84 -0
- data/man/perquackey.1.ronn +76 -0
- data/perquackey.gemspec +2 -0
- data/test/helper.rb +6 -3
- metadata +24 -7
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
==
|
1
|
+
== 0.7.2 -- 2010-04-21
|
2
|
+
* Clean up command-line options.
|
3
|
+
* Write a perquackey(1) man page.
|
4
|
+
* `gem check --test perquackey` should work now!
|
5
|
+
* Require at least Ruby 1.8.7 -- building on 1.8.6 fails.
|
6
|
+
|
7
|
+
== 0.7.1 -- 2010-04-15
|
2
8
|
* Refactor Dictionary to have Ruby parts, with a C extension starting at the fgets on the IO stream.
|
3
9
|
* Reorganize code for autoloading.
|
4
10
|
* Reorganize code to properly use datadir.
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
dependencies:
|
3
|
+
shoe:
|
4
|
+
group:
|
5
|
+
- :development
|
6
|
+
version: ">= 0"
|
7
|
+
ronn:
|
8
|
+
group:
|
9
|
+
- :development
|
10
|
+
version: ">= 0"
|
11
|
+
sinatra:
|
12
|
+
group:
|
13
|
+
- :default
|
14
|
+
version: ">= 0"
|
15
|
+
redgreen:
|
16
|
+
group:
|
17
|
+
- :development
|
18
|
+
version: ">= 0"
|
19
|
+
specs:
|
20
|
+
- rake:
|
21
|
+
version: 0.8.7
|
22
|
+
- configuration:
|
23
|
+
version: 1.1.0
|
24
|
+
- hpricot:
|
25
|
+
version: 0.8.2
|
26
|
+
- launchy:
|
27
|
+
version: 0.3.5
|
28
|
+
- rack:
|
29
|
+
version: 1.1.0
|
30
|
+
- rdiscount:
|
31
|
+
version: 1.6.3.1
|
32
|
+
- redgreen:
|
33
|
+
version: 1.2.2
|
34
|
+
- ronn:
|
35
|
+
version: "0.5"
|
36
|
+
- shoe:
|
37
|
+
version: 0.6.0
|
38
|
+
- sinatra:
|
39
|
+
version: "1.0"
|
40
|
+
hash: 43e16f41a78020948379f93caebbae6705f7a82c
|
41
|
+
sources:
|
42
|
+
- Rubygems:
|
43
|
+
uri: http://gemcutter.org
|
data/TODO.rdoc
CHANGED
data/bin/perquackey
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
begin
|
4
|
+
require 'perquackey'
|
5
|
+
rescue LoadError
|
6
|
+
raise unless $!.message =~ /\bperquackey$/
|
7
|
+
|
8
|
+
lib = File.expand_path('../../lib', __FILE__)
|
9
|
+
if !$:.include?(lib)
|
10
|
+
warn "WARN: #{$!}.\n Trying again with #{lib} on the $LOAD_PATH..."
|
11
|
+
$:.unshift(lib)
|
12
|
+
retry
|
13
|
+
end
|
14
|
+
|
15
|
+
raise
|
16
|
+
end
|
17
|
+
|
4
18
|
Perquackey::Application.run!(ARGV)
|
@@ -2,11 +2,13 @@
|
|
2
2
|
<input name="letters"
|
3
3
|
value="<%= letters %>"
|
4
4
|
autocomplete="on"
|
5
|
+
autosave="perquackey"
|
5
6
|
autofocus="on"
|
6
7
|
maxlength="13"
|
7
8
|
pattern="[a-z]{10}([a-z]{3})?"
|
8
9
|
placeholder="Type your letters here."
|
9
10
|
required="on"
|
11
|
+
results="12"
|
10
12
|
title="Perquackey rolls are 10 or 13 letters."
|
11
13
|
type="search"
|
12
14
|
/>
|
data/lib/perquackey.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rbconfig'
|
|
3
3
|
require 'rbconfig/datadir'
|
4
4
|
|
5
5
|
module Perquackey
|
6
|
-
VERSION = '0.7.
|
6
|
+
VERSION = '0.7.2'
|
7
7
|
|
8
8
|
autoload :Anagrams, 'perquackey/anagrams'
|
9
9
|
autoload :Application,'perquackey/application'
|
@@ -14,6 +14,13 @@ module Perquackey
|
|
14
14
|
autoload :WordTable, 'perquackey/word_table'
|
15
15
|
|
16
16
|
def self.datadir
|
17
|
-
|
17
|
+
@@datadir ||= begin
|
18
|
+
datadir = RbConfig.datadir('perquackey')
|
19
|
+
if !File.exist?(datadir)
|
20
|
+
warn "WARN: #{datadir} does not exist.\n Trying again with relative data directory..."
|
21
|
+
datadir = File.expand_path('../../data/perquackey', __FILE__)
|
22
|
+
end
|
23
|
+
Pathname.new(datadir)
|
24
|
+
end
|
18
25
|
end
|
19
26
|
end
|
@@ -7,35 +7,34 @@ module Perquackey
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def initialize
|
10
|
-
@
|
10
|
+
@defaults = %w(--console)
|
11
11
|
|
12
|
-
@options
|
13
|
-
opts.banner
|
12
|
+
@options = OptionParser.new do |opts|
|
13
|
+
opts.banner = "Usage: #{File.basename($0)} [-c|-s]"
|
14
|
+
opts.version = Perquackey::VERSION
|
14
15
|
opts.separator ''
|
15
|
-
opts.separator 'Specific options:'
|
16
16
|
|
17
|
-
opts.on('-
|
17
|
+
opts.on('-c', '--console', 'Run an interactive console.') do
|
18
|
+
@mode = :console
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-s', '--server[=port]', 'Run an http server.') do |port|
|
18
22
|
@mode = :server
|
19
23
|
@port = port || 3000
|
20
24
|
end
|
21
25
|
|
22
26
|
opts.separator ''
|
23
|
-
opts.separator '
|
24
|
-
|
25
|
-
opts.on_tail('-h', '--help', 'Show this message.') do
|
26
|
-
puts opts
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
|
30
|
-
opts.on_tail('-v', '--version', 'Print version and exit.') do
|
31
|
-
puts "perquackey #{Perquackey::VERSION}"
|
32
|
-
exit
|
33
|
-
end
|
27
|
+
opts.separator 'Defaults:'
|
28
|
+
opts.separator "#{opts.summary_indent}#{@defaults.join(' ')}"
|
34
29
|
end
|
35
30
|
end
|
36
31
|
|
37
32
|
def run!(argv)
|
38
|
-
|
33
|
+
begin
|
34
|
+
@options.parse(@defaults.dup.concat(argv))
|
35
|
+
rescue OptionParser::ParseError
|
36
|
+
@options.abort($!)
|
37
|
+
end
|
39
38
|
|
40
39
|
case @mode
|
41
40
|
when :console
|
data/man/perquackey.1
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
.\" generated with Ronn/v0.5
|
2
|
+
.\" http://github.com/rtomayko/ronn/
|
3
|
+
.
|
4
|
+
.TH "PERQUACKEY" "1" "April 2010" "Matthew Todd" "RubyGems Manual"
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBperquackey\fR \-\- print a list of anagrams
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBperquackey\fR
|
11
|
+
.
|
12
|
+
.br
|
13
|
+
\fBperquackey\fR \-\-server[=\fIport\fR]
|
14
|
+
.
|
15
|
+
.SH "DESCRIPTION"
|
16
|
+
\fBperquackey\fR prints a list of anagrams for a given letter set, arranged in
|
17
|
+
columns by length. It's designed as a companion to the Perquackey word game,
|
18
|
+
vindicating you on the tough rolls and taunting you when you're blind to the \fII\fR \fIN\fR \fIG\fR right in front of your nose. Use with caution.
|
19
|
+
.
|
20
|
+
.SH "OPTIONS"
|
21
|
+
By default, \fBperquackey\fR runs an interactive console for you to type in your
|
22
|
+
letters. You can change that with the following options:
|
23
|
+
.
|
24
|
+
.TP
|
25
|
+
\fB\-c\fR, \fB\-\-console\fR
|
26
|
+
Run an interactive console. Being the default mode, this option exists
|
27
|
+
purely for the sake of symmetry.
|
28
|
+
.
|
29
|
+
.TP
|
30
|
+
\fB\-s\fR, \fB\-\-server\fR[=\fIport\fR]
|
31
|
+
Run an http server. You can then type your letters in and see results at \fIhttp://localhost:port/\fR, where \fIport\fR defaults to \fI3000\fR.
|
32
|
+
.
|
33
|
+
.P
|
34
|
+
\fBperquackey\fR also responds to the following standard options:
|
35
|
+
.
|
36
|
+
.TP
|
37
|
+
\fB\-h\fR, \fB\-\-help\fR
|
38
|
+
Print a help message and exit.
|
39
|
+
.
|
40
|
+
.TP
|
41
|
+
\fB\-v\fR, \fB\-\-version\fR[=all]
|
42
|
+
Print \fBperquackey\fR's version number and exit. If \fB=all\fR is given, also
|
43
|
+
print version numbers of \fBperquackey\fR's dependencies. (This is standard \fBoptparse\fR behavior that deserves more attention!)
|
44
|
+
.
|
45
|
+
.SH "EXAMPLE"
|
46
|
+
Run an interactive console session, look up anagrams for "amwortixet," and exit:
|
47
|
+
.
|
48
|
+
.IP "" 4
|
49
|
+
.
|
50
|
+
.nf
|
51
|
+
|
52
|
+
$ perquackey
|
53
|
+
Type ctrl\-d or quit to exit.
|
54
|
+
> amwortixet
|
55
|
+
aim aero aimer attire omitter amoretti
|
56
|
+
air airt amort extort toxemia
|
57
|
+
ait amie armet imaret tritoma
|
58
|
+
ami amir axiom matier wartime
|
59
|
+
are atom axite matrix
|
60
|
+
arm emir extra matter
|
61
|
+
art emit irate ratite
|
62
|
+
ate exam ixora remixt
|
63
|
+
att exit mater rotate
|
64
|
+
|
65
|
+
(...and so on...)
|
66
|
+
|
67
|
+
> quit
|
68
|
+
Goodbye.
|
69
|
+
.
|
70
|
+
.fi
|
71
|
+
.
|
72
|
+
.IP "" 0
|
73
|
+
.
|
74
|
+
.SH "BUGS"
|
75
|
+
Anagrams are generated from an internal copy of TWL06, the standard accepted
|
76
|
+
word list at North American Scrabble tournaments. You're going to see some
|
77
|
+
weird ones. ("Ixora"?!)
|
78
|
+
.
|
79
|
+
.SH "AUTHOR"
|
80
|
+
Matthew Todd, \fI@matthewtodd\fR on GitHub and Twitter. Do drop me a line if you
|
81
|
+
use \fBperquackey\fR \-\- I'd love to hear from you!
|
82
|
+
.
|
83
|
+
.SH "SEE ALSO"
|
84
|
+
\fIhttp://en.wikipedia.org/wiki/Perquackey\fR, \fIhttp://en.wikipedia.org/wiki/Tournament_Word_List\fR, \fIhttp://perquackey.matthewtodd.org/\fR
|
@@ -0,0 +1,76 @@
|
|
1
|
+
perquackey(1) -- print a list of anagrams
|
2
|
+
=========================================
|
3
|
+
|
4
|
+
## SYNOPSIS
|
5
|
+
|
6
|
+
`perquackey`
|
7
|
+
`perquackey` --server[=_port_]
|
8
|
+
|
9
|
+
## DESCRIPTION
|
10
|
+
|
11
|
+
`perquackey` prints a list of anagrams for a given letter set, arranged in
|
12
|
+
columns by length. It's designed as a companion to the Perquackey word game,
|
13
|
+
vindicating you on the tough rolls and taunting you when you're blind to the
|
14
|
+
_I_ _N_ _G_ right in front of your nose. Use with caution.
|
15
|
+
|
16
|
+
## OPTIONS
|
17
|
+
|
18
|
+
By default, `perquackey` runs an interactive console for you to type in your
|
19
|
+
letters. You can change that with the following options:
|
20
|
+
|
21
|
+
* `-c`, `--console`:
|
22
|
+
Run an interactive console. Being the default mode, this option exists
|
23
|
+
purely for the sake of symmetry.
|
24
|
+
|
25
|
+
* `-s`, `--server`[=_port_]:
|
26
|
+
Run an http server. You can then type your letters in and see results at
|
27
|
+
<http://localhost:port/>, where <port> defaults to _3000_.
|
28
|
+
|
29
|
+
`perquackey` also responds to the following standard options:
|
30
|
+
|
31
|
+
* `-h`, `--help`:
|
32
|
+
Print a help message and exit.
|
33
|
+
|
34
|
+
* `-v`, `--version`[=all]:
|
35
|
+
Print `perquackey`'s version number and exit. If `=all` is given, also
|
36
|
+
print version numbers of `perquackey`'s dependencies. (This is standard
|
37
|
+
`optparse` behavior that deserves more attention!)
|
38
|
+
|
39
|
+
## EXAMPLE
|
40
|
+
|
41
|
+
Run an interactive console session, look up anagrams for "amwortixet," and exit:
|
42
|
+
|
43
|
+
$ perquackey
|
44
|
+
Type ctrl-d or quit to exit.
|
45
|
+
> amwortixet
|
46
|
+
aim aero aimer attire omitter amoretti
|
47
|
+
air airt amort extort toxemia
|
48
|
+
ait amie armet imaret tritoma
|
49
|
+
ami amir axiom matier wartime
|
50
|
+
are atom axite matrix
|
51
|
+
arm emir extra matter
|
52
|
+
art emit irate ratite
|
53
|
+
ate exam ixora remixt
|
54
|
+
att exit mater rotate
|
55
|
+
|
56
|
+
(...and so on...)
|
57
|
+
|
58
|
+
> quit
|
59
|
+
Goodbye.
|
60
|
+
|
61
|
+
## BUGS
|
62
|
+
|
63
|
+
Anagrams are generated from an internal copy of TWL06, the standard accepted
|
64
|
+
word list at North American Scrabble tournaments. You're going to see some
|
65
|
+
weird ones. ("Ixora"?!)
|
66
|
+
|
67
|
+
## AUTHOR
|
68
|
+
|
69
|
+
Matthew Todd, _@matthewtodd_ on GitHub and Twitter. Do drop me a line if you
|
70
|
+
use `perquackey` -- I'd love to hear from you!
|
71
|
+
|
72
|
+
## SEE ALSO
|
73
|
+
|
74
|
+
<http://en.wikipedia.org/wiki/Perquackey>,
|
75
|
+
<http://en.wikipedia.org/wiki/Tournament_Word_List>,
|
76
|
+
<http://perquackey.matthewtodd.org/>
|
data/perquackey.gemspec
CHANGED
@@ -11,8 +11,10 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = 'matthew.todd@gmail.com'
|
12
12
|
spec.homepage = 'http://github.com/matthewtodd/perquackey'
|
13
13
|
|
14
|
+
spec.required_ruby_version = '>= 1.8.7'
|
14
15
|
spec.add_runtime_dependency 'sinatra'
|
15
16
|
spec.add_development_dependency 'redgreen'
|
17
|
+
spec.add_development_dependency 'ronn'
|
16
18
|
spec.add_development_dependency 'shoe'
|
17
19
|
|
18
20
|
def spec.git_files(glob=nil)
|
data/test/helper.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
require 'perquackey'
|
2
1
|
require 'test/unit'
|
2
|
+
require 'perquackey'
|
3
3
|
|
4
|
-
|
5
|
-
require 'redgreen'
|
4
|
+
begin
|
5
|
+
require 'redgreen' if $stdout.tty?
|
6
|
+
rescue LoadError
|
7
|
+
# It's nice not to have hard dependencies on any gems for testing, so that
|
8
|
+
# it's super-easy for your users to run `gem check --test perquackey.`
|
6
9
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 7
|
8
|
-
-
|
9
|
-
version: 0.7.
|
8
|
+
- 2
|
9
|
+
version: 0.7.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matthew Todd
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-21 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
type: :development
|
43
43
|
version_requirements: *id002
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
45
|
+
name: ronn
|
46
46
|
prerelease: false
|
47
47
|
requirement: &id003 !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
@@ -53,6 +53,18 @@ dependencies:
|
|
53
53
|
version: "0"
|
54
54
|
type: :development
|
55
55
|
version_requirements: *id003
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: shoe
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
65
|
+
version: "0"
|
66
|
+
type: :development
|
67
|
+
version_requirements: *id004
|
56
68
|
description: Provides console session and simple webapp for looking up Perquackey word matches
|
57
69
|
email: matthew.todd@gmail.com
|
58
70
|
executables:
|
@@ -67,6 +79,7 @@ files:
|
|
67
79
|
- .gitignore
|
68
80
|
- CHANGELOG.rdoc
|
69
81
|
- Gemfile
|
82
|
+
- Gemfile.lock
|
70
83
|
- README.rdoc
|
71
84
|
- Rakefile
|
72
85
|
- TODO.rdoc
|
@@ -83,6 +96,8 @@ files:
|
|
83
96
|
- lib/perquackey/game.rb
|
84
97
|
- lib/perquackey/server.rb
|
85
98
|
- lib/perquackey/word_table.rb
|
99
|
+
- man/perquackey.1
|
100
|
+
- man/perquackey.1.ronn
|
86
101
|
- perquackey.gemspec
|
87
102
|
- test/dictionary_test.rb
|
88
103
|
- test/helper.rb
|
@@ -96,7 +111,7 @@ rdoc_options:
|
|
96
111
|
- --main
|
97
112
|
- README.rdoc
|
98
113
|
- --title
|
99
|
-
- perquackey-0.7.
|
114
|
+
- perquackey-0.7.2
|
100
115
|
- --inline-source
|
101
116
|
require_paths:
|
102
117
|
- lib
|
@@ -105,8 +120,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
120
|
- - ">="
|
106
121
|
- !ruby/object:Gem::Version
|
107
122
|
segments:
|
108
|
-
-
|
109
|
-
|
123
|
+
- 1
|
124
|
+
- 8
|
125
|
+
- 7
|
126
|
+
version: 1.8.7
|
110
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
128
|
requirements:
|
112
129
|
- - ">="
|