edward-auto-emo 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/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +9 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/auto-emo.gemspec +41 -0
- data/bin/auto-emo +39 -0
- data/lib/auto-emo.rb +18 -0
- data/lib/poems +275 -1
- data/test/auto-emo_test.rb +7 -0
- data/test/test_helper.rb +9 -0
- metadata +66 -0
data/.document
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009 Edward Ocampo-Gooding
|
|
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.rdoc
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
= auto-emo
|
|
2
|
+
|
|
3
|
+
Sometimes, you just need a whole lot of generated emo poetry.
|
|
4
|
+
|
|
5
|
+
Poems were filched from across the web. No more than a single line from each appears in any generated stanza. So, the marshalled poems are definitely not copyrighted by me, but everything else is.
|
|
6
|
+
|
|
7
|
+
== Copyright
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2009 Edward Ocampo-Gooding. See LICENSE for details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'jeweler'
|
|
6
|
+
Jeweler::Tasks.new do |gem|
|
|
7
|
+
gem.name = "auto-emo"
|
|
8
|
+
gem.summary = %Q{Sometimes, you just need a whole lot of generated emo poetry}
|
|
9
|
+
gem.email = "edward@edwardog.net"
|
|
10
|
+
gem.homepage = "http://github.com/edward/auto-emo"
|
|
11
|
+
gem.authors = ["Edward Ocampo-Gooding"]
|
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
rescue LoadError
|
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
require 'rake/testtask'
|
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
|
21
|
+
test.libs << 'lib' << 'test'
|
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
|
23
|
+
test.verbose = true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
begin
|
|
27
|
+
require 'rcov/rcovtask'
|
|
28
|
+
Rcov::RcovTask.new do |test|
|
|
29
|
+
test.libs << 'test'
|
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
|
31
|
+
test.verbose = true
|
|
32
|
+
end
|
|
33
|
+
rescue LoadError
|
|
34
|
+
task :rcov do
|
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
task :default => :test
|
|
41
|
+
|
|
42
|
+
require 'rake/rdoctask'
|
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
|
44
|
+
if File.exist?('VERSION.yml')
|
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
47
|
+
else
|
|
48
|
+
version = ""
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
52
|
+
rdoc.title = "auto-emo #{version}"
|
|
53
|
+
rdoc.rdoc_files.include('README*')
|
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
55
|
+
end
|
|
56
|
+
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|
data/auto-emo.gemspec
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = %q{auto-emo}
|
|
3
|
+
s.version = "0.1.0"
|
|
4
|
+
|
|
5
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Edward Ocampo-Gooding"]
|
|
9
|
+
s.date = %q{2009-06-25}
|
|
10
|
+
s.default_executable = %q{auto-emo}
|
|
11
|
+
s.email = %q{edward@edwardog.net}
|
|
12
|
+
s.executables = ["auto-emo"]
|
|
13
|
+
s.extra_rdoc_files = [
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.rdoc"
|
|
16
|
+
]
|
|
17
|
+
s.files = [
|
|
18
|
+
".document",
|
|
19
|
+
".gitignore",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.rdoc",
|
|
22
|
+
"Rakefile",
|
|
23
|
+
"VERSION",
|
|
24
|
+
"auto-emo.gemspec",
|
|
25
|
+
"bin/auto-emo",
|
|
26
|
+
"lib/auto-emo.rb",
|
|
27
|
+
"lib/poems",
|
|
28
|
+
"test/auto-emo_test.rb",
|
|
29
|
+
"test/test_helper.rb"
|
|
30
|
+
]
|
|
31
|
+
s.has_rdoc = true
|
|
32
|
+
s.homepage = %q{http://github.com/edward/auto-emo}
|
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
34
|
+
s.require_paths = ["lib"]
|
|
35
|
+
s.rubygems_version = %q{1.0.1}
|
|
36
|
+
s.summary = %q{Sometimes, you just need a whole lot of generated emo poetry}
|
|
37
|
+
s.test_files = [
|
|
38
|
+
"test/auto-emo_test.rb",
|
|
39
|
+
"test/test_helper.rb"
|
|
40
|
+
]
|
|
41
|
+
end
|
data/bin/auto-emo
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env ruby -wKU
|
|
2
|
+
|
|
3
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib auto-emo])
|
|
4
|
+
require "optparse"
|
|
5
|
+
|
|
6
|
+
AUTO_EMO_VERSION = File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION]))
|
|
7
|
+
|
|
8
|
+
options = {:number => 3}
|
|
9
|
+
|
|
10
|
+
ARGV.options do |opts|
|
|
11
|
+
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [-n poems]"
|
|
12
|
+
|
|
13
|
+
opts.on("-n", "--number N", Integer, "Generate N poems") do |n|
|
|
14
|
+
options[:number] = n
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
|
18
|
+
puts opts
|
|
19
|
+
exit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
opts.on_tail("--version", "Show version") do
|
|
23
|
+
puts AUTO_EMO_VERSION
|
|
24
|
+
exit
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
begin
|
|
28
|
+
opts.parse!
|
|
29
|
+
|
|
30
|
+
options[:number].times do |n|
|
|
31
|
+
puts AutoEmo::Poem.generate
|
|
32
|
+
puts "\n\n" if n < (options[:number] - 1)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
rescue
|
|
36
|
+
puts opts
|
|
37
|
+
exit
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/auto-emo.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module AutoEmo
|
|
2
|
+
class Poem
|
|
3
|
+
File.open(File.join(File.dirname(__FILE__), 'poems')) do |f|
|
|
4
|
+
@@poems = Marshal.load(f)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.generate
|
|
8
|
+
length = 4 + rand(7)
|
|
9
|
+
lines = []
|
|
10
|
+
|
|
11
|
+
length.times do
|
|
12
|
+
lines << @@poems[rand(@@poems.size)]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
lines.join("\n")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|