anagram 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,20 +1,21 @@
1
1
  require 'rake/gempackagetask'
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
- s.name = "anagram"
5
- s.summary = "Find anagrams of words supplied on the command line"
6
- s.description = File.read(File.join(File.dirname(__FILE__), 'README'))
7
- s.requirements = [ 'An installed dictionary (most Unix systems have one)' ]
8
- s.version = "0.0.1"
9
- s.author = "Dave Thomas"
10
- s.email = "dave@pragprog.com"
11
- s.homepage = "http://pragdave.pragprog.com"
12
- s.platform = Gem::Platform::RUBY
4
+ s.name = "anagram"
5
+ s.summary = "Find anagrams of words supplied on the command line"
6
+ s.description= File.read(File.join(File.dirname(__FILE__), 'README'))
7
+ s.requirements =
8
+ [ 'An installed dictionary (most Unix systems have one)' ]
9
+ s.version = "0.0.1"
10
+ s.author = "Dave Thomas"
11
+ s.email = "dave@pragprog.com"
12
+ s.homepage = "http://pragdave.pragprog.com"
13
+ s.platform = Gem::Platform::RUBY
13
14
  s.required_ruby_version = '>=1.9'
14
- s.files = Dir['**/**']
15
+ s.files = Dir['**/**']
15
16
  s.executables = [ 'anagram' ]
16
- s.test_files = Dir["test/test*.rb"]
17
- s.has_rdoc = false
17
+ s.test_files = Dir["test/test*.rb"]
18
+ s.has_rdoc = false
18
19
  end
19
20
 
20
- Rake::GemPackageTask.new(spec) {}
21
+ Rake::GemPackageTask.new(spec).define
Binary file
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "anagram"
3
+ s.summary = "Find anagrams of words supplied on the command line"
4
+ s.description = File.read(File.join(File.dirname(__FILE__), 'README'))
5
+ s.requirements =
6
+ [ 'An installed dictionary (most Unix systems have one)' ]
7
+ s.version = "0.0.2"
8
+ s.author = "Dave Thomas"
9
+ s.email = "dave@pragprog.com"
10
+ s.homepage = "http://pragdave.pragprog.com"
11
+ s.platform = Gem::Platform::RUBY
12
+ s.required_ruby_version = '>=1.9'
13
+ s.files = Dir['**/**']
14
+ s.executables = [ 'anagram' ]
15
+ s.test_files = Dir["test/test*.rb"]
16
+ s.has_rdoc = false
17
+ end
@@ -0,0 +1,17 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "anagram"
3
+ s.summary = "Find anagrams of words supplied on the command line"
4
+ s.description= File.read(File.join(File.dirname(__FILE__), 'README'))
5
+ s.requirements =
6
+ [ 'An installed dictionary (most Unix systems have one)' ]
7
+ s.version = "0.0.1"
8
+ s.author = "Dave Thomas"
9
+ s.email = "dave@pragprog.com"
10
+ s.homepage = "http://pragdave.pragprog.com"
11
+ s.platform = Gem::Platform::RUBY
12
+ s.required_ruby_version = '>=1.9'
13
+ s.files = Dir['**/**']
14
+ s.executables = [ 'anagram' ]
15
+ s.test_files = Dir["test/test*.rb"]
16
+ s.has_rdoc = false
17
+ end
@@ -15,10 +15,10 @@ module Anagram
15
15
  if anagrams
16
16
  puts "Anagrams of #{word}: #{anagrams.join(', ')}"
17
17
  else
18
- puts "No anagrams of #{word} in #{dictionary}"
18
+ puts "No anagrams of #{word} in #{@options.dictionary}"
19
19
  end
20
20
  end
21
21
  end
22
22
  end
23
23
  end
24
-
24
+
@@ -5,28 +5,31 @@ require_relative '../lib/anagram/finder'
5
5
  class TestFinder < Test::Unit::TestCase
6
6
 
7
7
  context "signature" do
8
- { "cat" => "act", "act" => "act", "wombat" => "abmotw" }.each do |word, signature|
9
- should "be #{signature} for #{word}" do
10
- assert_equal signature, Anagram::Finder.signature_of(word)
8
+ { "cat" => "act", "act" => "act", "wombat" => "abmotw" }.each do
9
+ |word, signature|
10
+ should "be #{signature} for #{word}" do
11
+ assert_equal signature, Anagram::Finder.signature_of(word)
11
12
  end
12
13
  end
13
14
  end
14
15
 
15
16
  context "lookup" do
16
- finder = Anagram::Finder.new(["cat", "wombat"])
17
+ setup do
18
+ @finder = Anagram::Finder.new(["cat", "wombat"])
19
+ end
17
20
 
18
21
  should "return word if word given" do
19
- assert_equal ["cat"], finder.lookup("cat")
22
+ assert_equal ["cat"], @finder.lookup("cat")
20
23
  end
21
24
 
22
25
  should "return word if anagram given" do
23
- assert_equal ["cat"], finder.lookup("act")
24
- assert_equal ["cat"], finder.lookup("tca")
26
+ assert_equal ["cat"], @finder.lookup("act")
27
+ assert_equal ["cat"], @finder.lookup("tca")
25
28
  end
26
29
 
27
30
  should "return nil if no word matches anagram" do
28
- assert_nil finder.lookup("wibble")
31
+ assert_nil @finder.lookup("wibble")
29
32
  end
30
33
  end
31
34
 
32
- end
35
+ end
@@ -1,6 +1,8 @@
1
1
  require 'test/unit'
2
2
  require 'shoulda'
3
+ #START:require
3
4
  require_relative '../lib/anagram/options'
5
+ #END:require
4
6
 
5
7
  class TestOptions < Test::Unit::TestCase
6
8
 
@@ -31,4 +33,4 @@ class TestOptions < Test::Unit::TestCase
31
33
  assert_equal ["word1", "word2"], opts.words_to_find
32
34
  end
33
35
  end
34
- end
36
+ end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anagram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 2
9
+ version: 0.0.2
5
10
  platform: ruby
6
11
  authors:
7
12
  - Dave Thomas
@@ -9,11 +14,24 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2008-07-03 00:00:00 -05:00
17
+ date: 2010-09-21 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
16
- description: "The Anagram application searches a dictionary for anagrams of words supplied on the command line. $ anagram teaching code Anagrams of teaching: cheating, teaching Anagrams of code: code, coed It is not (currently) smart enough to deal with multi-word anagrams. This code is Copyright 2008 Dave Thomas, The Pragmatic Programmers. It is released under the terms of the MIT License. See the file LICENSE."
21
+ description: |
22
+ The Anagram application searches a dictionary for anagrams of words supplied
23
+ on the command line.
24
+
25
+ $ anagram teaching code
26
+ Anagrams of teaching: cheating, teaching
27
+ Anagrams of code: code, coed
28
+
29
+ It is not (currently) smart enough to deal with multi-word anagrams.
30
+
31
+ This code is Copyright 2008 Dave Thomas, The Pragmatic Programmers.
32
+
33
+ It is released under the terms of the MIT License. See the file LICENSE.
34
+
17
35
  email: dave@pragprog.com
18
36
  executables:
19
37
  - anagram
@@ -22,10 +40,10 @@ extensions: []
22
40
  extra_rdoc_files: []
23
41
 
24
42
  files:
25
- - bin
43
+ - anagram-0.0.1.gem
44
+ - anagram.gemspec
45
+ - anagram.gemspec~
26
46
  - bin/anagram
27
- - lib
28
- - lib/anagram
29
47
  - lib/anagram/finder.rb
30
48
  - lib/anagram/options.rb
31
49
  - lib/anagram/runner.rb
@@ -33,34 +51,40 @@ files:
33
51
  - Rakefile
34
52
  - README
35
53
  - setup.rb
36
- - test
37
54
  - test/test_finder.rb
38
55
  - test/test_options.rb
39
- has_rdoc: false
56
+ has_rdoc: true
40
57
  homepage: http://pragdave.pragprog.com
58
+ licenses: []
59
+
41
60
  post_install_message:
42
61
  rdoc_options: []
43
62
 
44
63
  require_paths:
45
64
  - lib
46
65
  required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
47
67
  requirements:
48
68
  - - ">="
49
69
  - !ruby/object:Gem::Version
70
+ segments:
71
+ - 1
72
+ - 9
50
73
  version: "1.9"
51
- version:
52
74
  required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
53
76
  requirements:
54
77
  - - ">="
55
78
  - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
56
81
  version: "0"
57
- version:
58
82
  requirements:
59
83
  - An installed dictionary (most Unix systems have one)
60
84
  rubyforge_project:
61
- rubygems_version: 1.2.0.1824
85
+ rubygems_version: 1.3.7
62
86
  signing_key:
63
- specification_version: 2
87
+ specification_version: 3
64
88
  summary: Find anagrams of words supplied on the command line
65
89
  test_files:
66
90
  - test/test_finder.rb