linux_fortune 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Rakefile +1 -1
- data/lib/linux_fortune.rb +3 -3
- data/linux_fortune.gemspec +3 -3
- data/test/test_linux_fortune.rb +8 -4
- data.tar.gz.sig +0 -0
- metadata +3 -3
- metadata.gz.sig +0 -0
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('linux_fortune', '0.0.
|
5
|
+
Echoe.new('linux_fortune', '0.0.2') do |p|
|
6
6
|
p.description = "A gem that provides a wrapper for the linux fortune program"
|
7
7
|
p.url = "http://github.com/srejbi/linux_fortune"
|
8
8
|
p.author = "George Schreiber"
|
data/lib/linux_fortune.rb
CHANGED
@@ -169,7 +169,7 @@ module LinuxFortune
|
|
169
169
|
srclist.each do |source|
|
170
170
|
weight,src = source.strip.split
|
171
171
|
if src.match(/(\/.*)*/)
|
172
|
-
puts "#{src} -> #{weight}"
|
172
|
+
#puts "#{src} -> #{weight}"
|
173
173
|
path = src
|
174
174
|
else
|
175
175
|
sources << FortuneSource.new( :path => path, :source => src, :weight => weight )
|
@@ -180,8 +180,8 @@ module LinuxFortune
|
|
180
180
|
|
181
181
|
# executes the fortune program
|
182
182
|
def self.fortune(sources = nil)
|
183
|
-
puts "executing #{self.binary_path} -c #{fortune_options} #{sources.each { |s| s
|
184
|
-
`#{self.binary_path} -c #{fortune_options} #{sources.each { |s| s
|
183
|
+
#puts "executing #{self.binary_path} -c #{fortune_options} #{sources.each { |s| s.strip }.join(" ") unless sources.nil?} 2>&1"
|
184
|
+
`#{self.binary_path} -c #{fortune_options} #{sources.each { |s| s.strip }.join(" ") unless sources.nil?} 2>&1`
|
185
185
|
end
|
186
186
|
|
187
187
|
# generates a fortune message
|
data/linux_fortune.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{linux_fortune}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["George Schreiber"]
|
9
9
|
s.cert_chain = ["/home/george/.ssh/gem/gem-public_cert.pem"]
|
10
|
-
s.date = %q{2010-03-
|
10
|
+
s.date = %q{2010-03-24}
|
11
11
|
s.description = %q{A gem that provides a wrapper for the linux fortune program}
|
12
12
|
s.email = %q{gy.schreiber @nospam@ mobility.hu}
|
13
13
|
s.extra_rdoc_files = ["README.rdoc", "lib/linux_fortune.rb"]
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Linux_fortune", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.rubyforge_project = %q{linux_fortune}
|
19
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.6}
|
20
20
|
s.signing_key = %q{/home/george/.ssh/gem/gem-private_key.pem}
|
21
21
|
s.summary = %q{A gem that provides a wrapper for the linux fortune program}
|
22
22
|
s.test_files = ["test/test_helper.rb", "test/test_linux_fortune.rb"]
|
data/test/test_linux_fortune.rb
CHANGED
@@ -25,7 +25,7 @@ class TestLinuxFortune < Test::Unit::TestCase
|
|
25
25
|
assert LinuxFortune.short # short should be set to true
|
26
26
|
assert LinuxFortune.long == false # long to false
|
27
27
|
assert LinuxFortune.fortune_options.include?("-s")
|
28
|
-
assert LinuxFortune.fortune_options.include?("-n")
|
28
|
+
assert LinuxFortune.fortune_options.include?("-n") || LinuxFortune.short_length == 160
|
29
29
|
10.times do # check multiple times if the generated length is ok
|
30
30
|
lf = LinuxFortune.generate
|
31
31
|
assert lf.body.size < LinuxFortune.short_length # check if actual size is less than the max. short length
|
@@ -38,7 +38,7 @@ class TestLinuxFortune < Test::Unit::TestCase
|
|
38
38
|
assert LinuxFortune.long # long should be set to short
|
39
39
|
assert LinuxFortune.short == false # short to false
|
40
40
|
assert LinuxFortune.fortune_options.include?("-l")
|
41
|
-
assert LinuxFortune.fortune_options.include?("-n")
|
41
|
+
assert LinuxFortune.fortune_options.include?("-n") || LinuxFortune.short_length == 160
|
42
42
|
5.times do # check multiple times if the generated length is ok
|
43
43
|
lf = LinuxFortune.generate
|
44
44
|
#puts "#{lf.body.size} characters"
|
@@ -64,11 +64,15 @@ class TestLinuxFortune < Test::Unit::TestCase
|
|
64
64
|
# test if fortune messages are from the sources requested
|
65
65
|
# TODO pick random sources from sources
|
66
66
|
def test_fortune_from_sources
|
67
|
+
# just get whatever length fortunes
|
68
|
+
LinuxFortune.short=false
|
69
|
+
LinuxFortune.long=false
|
70
|
+
# check multiple times
|
67
71
|
5.times do
|
68
|
-
lf = LinuxFortune.generate(["chucknorris"])
|
72
|
+
lf = LinuxFortune.generate(["chucknorris","linux"])
|
69
73
|
#puts lf.source
|
70
74
|
#puts lf.source.split("/").last
|
71
|
-
assert ["chucknorris"].include?(lf.source.split("/").last.strip)
|
75
|
+
assert ["chucknorris","linux"].include?(lf.source.split("/").last.strip)
|
72
76
|
end
|
73
77
|
end
|
74
78
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- George Schreiber
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
0ps4N+22wwDW/tu5hg8+hebo
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2010-03-
|
38
|
+
date: 2010-03-24 00:00:00 +01:00
|
39
39
|
default_executable:
|
40
40
|
dependencies: []
|
41
41
|
|
metadata.gz.sig
CHANGED
Binary file
|