mdeering-booty 0.1.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.
- data/.gitignore +4 -0
- data/LICENSE +20 -0
- data/README.textile +19 -0
- data/Rakefile +66 -0
- data/VERSION +1 -0
- data/booty.gemspec +49 -0
- data/lib/booty.rb +97 -0
- data/spec/booty_spec.rb +10 -0
- data/spec/test_helper.rb +7 -0
- metadata +64 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Michael Deering
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
h1. Booty: Pirate Speak Gem
|
2
|
+
|
3
|
+
h2. Install
|
4
|
+
<pre><code>gem sources -a http://gems.github.com
|
5
|
+
sudo gem install mdeering-booty</code></pre>
|
6
|
+
|
7
|
+
h2. Usage
|
8
|
+
<pre><code># We all require a little...
|
9
|
+
require 'booty'
|
10
|
+
msg = 'There was no question this was going to work as a singleton call. All puns intended!'
|
11
|
+
Booty.call(msg) # => "There was nay question this was going t' brig as a singleton call. All puns intended! surrender yer booty."</code></pre>
|
12
|
+
|
13
|
+
h2. Credits
|
14
|
+
|
15
|
+
I directly poached they Booty class from here "wcyd/devel/ircbot/rbot/lib":http://github.com/fapestniegd/wcyd
|
16
|
+
|
17
|
+
h2. Copyright
|
18
|
+
|
19
|
+
Copyright (c) 2009 "Michael Deering(Edmonton Ruby on Rails)":http://mdeering.com See MIT-LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "booty"
|
8
|
+
gem.summary = 'Bring \'er alongside. Tis be eh Ruby gem that converts english t\' pirate speak. Arrr.'
|
9
|
+
gem.description = 'Bring \'er alongside. Tis be eh Ruby gem that converts english t\' pirate speak. Arrr.'
|
10
|
+
gem.email = "mdeering@mdeering.com"
|
11
|
+
gem.homepage = "http://github.com/mdeering/booty"
|
12
|
+
gem.authors = ["Michael Deering"]
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Take no prisoners! Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Default: spec tests.'
|
19
|
+
task :default => :spec
|
20
|
+
|
21
|
+
begin
|
22
|
+
require 'rake/rdoctask'
|
23
|
+
require 'spec/rake/spectask'
|
24
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
25
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
t.spec_opts = ["-c"]
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run all examples with RCov"
|
30
|
+
Spec::Rake::SpecTask.new('examples_with_rcov') do |t|
|
31
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
32
|
+
t.rcov = true
|
33
|
+
t.rcov_opts = ['--exclude', '/opt,spec,Library']
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
puts "Take no prisoners! RSpec (or a dependency) not avalible: sudo gem install rspec"
|
37
|
+
end
|
38
|
+
|
39
|
+
begin
|
40
|
+
require 'rcov/rcovtask'
|
41
|
+
Rcov::RcovTask.new do |test|
|
42
|
+
test.libs << 'test'
|
43
|
+
test.pattern = 'test/**/*_test.rb'
|
44
|
+
test.verbose = true
|
45
|
+
end
|
46
|
+
rescue LoadError
|
47
|
+
task :rcov do
|
48
|
+
abort "Take no prisoners! RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
task :test => :check_dependencies
|
53
|
+
|
54
|
+
require 'rake/rdoctask'
|
55
|
+
Rake::RDocTask.new do |rdoc|
|
56
|
+
if File.exist?('VERSION')
|
57
|
+
version = File.read('VERSION')
|
58
|
+
else
|
59
|
+
version = ""
|
60
|
+
end
|
61
|
+
|
62
|
+
rdoc.rdoc_dir = 'rdoc'
|
63
|
+
rdoc.title = "booty #{version}"
|
64
|
+
rdoc.rdoc_files.include('README*')
|
65
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
66
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/booty.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{booty}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Michael Deering"]
|
12
|
+
s.date = %q{2009-09-17}
|
13
|
+
s.description = %q{Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.}
|
14
|
+
s.email = %q{mdeering@mdeering.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.textile"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".gitignore",
|
21
|
+
"LICENSE",
|
22
|
+
"README.textile",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"booty.gemspec",
|
26
|
+
"lib/booty.rb",
|
27
|
+
"spec/booty_spec.rb",
|
28
|
+
"spec/test_helper.rb"
|
29
|
+
]
|
30
|
+
s.homepage = %q{http://github.com/mdeering/booty}
|
31
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
+
s.require_paths = ["lib"]
|
33
|
+
s.rubygems_version = %q{1.3.5}
|
34
|
+
s.summary = %q{Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.}
|
35
|
+
s.test_files = [
|
36
|
+
"spec/booty_spec.rb",
|
37
|
+
"spec/test_helper.rb"
|
38
|
+
]
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
45
|
+
else
|
46
|
+
end
|
47
|
+
else
|
48
|
+
end
|
49
|
+
end
|
data/lib/booty.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
class Booty
|
2
|
+
def self.call(input)
|
3
|
+
# Entire words only
|
4
|
+
map = {
|
5
|
+
'is' => 'be', 'big' => 'vast',
|
6
|
+
'friend' => 'matey', 'my' => 'me',
|
7
|
+
'say' => 'cry', 'small' => 'puny',
|
8
|
+
'cheat' => 'hornswaggle', 'everyone' => 'all hands',
|
9
|
+
'isn\'t' => 'be not', 'the' => 'tha',
|
10
|
+
'are' => 'be', 'to' => 't\'',
|
11
|
+
'of' => 'o\'', 'am' => 'be',
|
12
|
+
'you' => 'ya', 'yes' => 'aye',
|
13
|
+
'kill' => 'keelhaul', 'you' => 'ye',
|
14
|
+
'no' => 'nay', 'never' => 'nary',
|
15
|
+
'i\'m' => 'i be', 'you\'re' => 'you be',
|
16
|
+
'girl' => 'lass', 'woman' => 'wench',
|
17
|
+
'hello' => 'ahoy', 'beer' => 'grog',
|
18
|
+
'quickly' => 'smartly', 'do' => 'd\'',
|
19
|
+
'your' => 'yer', 'for' => 'fer',
|
20
|
+
'go' => 'sail', 'we' => 'our jolly crew',
|
21
|
+
'and' => 'n\'', 'good' => 'jolly good',
|
22
|
+
'yeah' => 'aye', 'that\'s' => 'that be',
|
23
|
+
'over' => 'o\'er', 'yah' => 'aye',
|
24
|
+
'hand' => 'hook', 'leg' => 'peg',
|
25
|
+
'eye' => 'eye-patch', 'flag' => 'jolly roger',
|
26
|
+
'dick' => 'plank', 'penis' => 'plank',
|
27
|
+
'fuck' => 'curse', 'shit' => 'shite',
|
28
|
+
'treasure' => 'booty', 'butt' => 'booty',
|
29
|
+
'really' => 'verily', 'leg' => 'peg',
|
30
|
+
'them' => '\'em', 'house' => 'shanty',
|
31
|
+
'home' => 'shanty', 'quickly' => 'smartly',
|
32
|
+
'posted' => 'tacked to the yardarm',
|
33
|
+
'address' => 'port o\' call', 'work' => 'brig',
|
34
|
+
'invalid' => 'sunk', 'sorry' => 'yarr',
|
35
|
+
'hey' => 'ahoy', 'boss' => 'admiral',
|
36
|
+
'manager' => 'admiral', 'captain' => 'Cap\'n',
|
37
|
+
'friends' => 'shipmates', 'people' => 'scallywags',
|
38
|
+
'earlier' => 'afore', 'women' => 'wenches',
|
39
|
+
'wife' => 'lady', 'girls' => 'lassies',
|
40
|
+
'interstate'=> 'high seas', 'highway' => 'ocean',
|
41
|
+
'car' => 'boat', 'truck' => 'schooner',
|
42
|
+
'suv' => 'ship', 'airplane' => 'flying machine',
|
43
|
+
'machine' => 'contraption', 'driving' => 'sailing',
|
44
|
+
}
|
45
|
+
|
46
|
+
# Pirate filler
|
47
|
+
fill = [
|
48
|
+
'avast', 'splice the mainbrace',
|
49
|
+
'shiver me timbers', 'ahoy',
|
50
|
+
'arrrrr', 'arrgh',
|
51
|
+
'yo ho ho', 'yarrr',
|
52
|
+
'eh', 'arrrghhh',
|
53
|
+
'where\'s me rum?', 'walk tha plank',
|
54
|
+
'arrr', 'ahoy matey',
|
55
|
+
'surrender yer booty', 'prepare to be boarded',
|
56
|
+
'hoist the mizzen', 'blow me down',
|
57
|
+
'swap the poop deck', 'ye landlubber',
|
58
|
+
'bring \'er alongside', 'hang \'im from the yardarm',
|
59
|
+
'blow the man down', 'let go and haul',
|
60
|
+
'heave to', 'take no prisoners',
|
61
|
+
'belay that', 'me bucko',
|
62
|
+
'lock \'im in irons', 'and a bottle \'o rum',
|
63
|
+
'and donae spare the whip', 'pass the grog',
|
64
|
+
'and swab the deck', 'fire the cannon',
|
65
|
+
'sleep with t\' fishes',
|
66
|
+
]
|
67
|
+
|
68
|
+
# Punctuation
|
69
|
+
punct = ['!', '.', '!!']
|
70
|
+
|
71
|
+
words = Array.new()
|
72
|
+
input = input.split(/ /)
|
73
|
+
input.each do|a|
|
74
|
+
#print "word: #{a}\n"
|
75
|
+
words.push(a)
|
76
|
+
end
|
77
|
+
|
78
|
+
words.each_index {|w|
|
79
|
+
if map.has_key?(words[w])
|
80
|
+
#print "Word: #{words[w]} Match: #{map[words[w]]}\n"
|
81
|
+
words[w] = map[words[w]]
|
82
|
+
end
|
83
|
+
}
|
84
|
+
|
85
|
+
sentence = words.join(" ")
|
86
|
+
#print "Sentence: #{sentence}\n"
|
87
|
+
|
88
|
+
if rand(5) + 1 == 1
|
89
|
+
sentence = fill[rand(fill.length)] << punct[rand(punct.length)] << " #{sentence}"
|
90
|
+
elsif rand(5) + 1 == 1
|
91
|
+
sentence = "#{sentence} " << fill[rand(fill.length)] << punct[rand(punct.length)]
|
92
|
+
end
|
93
|
+
|
94
|
+
#print "#{sentence}\n"
|
95
|
+
return sentence
|
96
|
+
end
|
97
|
+
end
|
data/spec/booty_spec.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
require 'booty'
|
3
|
+
|
4
|
+
describe Booty, '#call should except my booty call any dam time of the night!' do
|
5
|
+
{ 'this' => 'this', 'go' => 'sail', 'posted' => 'tacked to the yardarm' }.each do |key, value|
|
6
|
+
it "and turn '#{key}' into '#{value}'" do
|
7
|
+
Booty.call(key).include?(value).should be_true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/spec/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mdeering-booty
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Deering
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-17 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.
|
17
|
+
email: mdeering@mdeering.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.textile
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- LICENSE
|
28
|
+
- README.textile
|
29
|
+
- Rakefile
|
30
|
+
- VERSION
|
31
|
+
- booty.gemspec
|
32
|
+
- lib/booty.rb
|
33
|
+
- spec/booty_spec.rb
|
34
|
+
- spec/test_helper.rb
|
35
|
+
has_rdoc: false
|
36
|
+
homepage: http://github.com/mdeering/booty
|
37
|
+
licenses:
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options:
|
40
|
+
- --charset=UTF-8
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
version:
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
requirements: []
|
56
|
+
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 1.3.5
|
59
|
+
signing_key:
|
60
|
+
specification_version: 3
|
61
|
+
summary: Bring 'er alongside. Tis be eh Ruby gem that converts english t' pirate speak. Arrr.
|
62
|
+
test_files:
|
63
|
+
- spec/booty_spec.rb
|
64
|
+
- spec/test_helper.rb
|