say 0.1.0 → 0.2.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/History.txt +10 -0
- data/LICENSE +1 -1
- data/README.rdoc +14 -19
- data/VERSION +1 -1
- data/lib/say.rb +38 -6
- data/say.gemspec +2 -1
- data/spec/say_spec.rb +7 -0
- metadata +2 -1
data/History.txt
ADDED
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,30 +1,25 @@
|
|
1
1
|
= say
|
2
2
|
|
3
3
|
Instead of printing your statements(Kernel.p), you can say them(Kernel.say)!
|
4
|
+
OS X has many build in voices you can use one of them by calling say_as(voice, args)
|
4
5
|
Inspired by jugyo's g gem.
|
5
6
|
|
6
|
-
|
7
|
+
Requirements
|
7
8
|
--------
|
8
9
|
|
9
|
-
|
10
|
+
Must be on os x >= 1.4
|
10
11
|
|
11
|
-
Copyright (c) 2008-2009 jugyo
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
the following conditions:
|
13
|
+
TODO
|
14
|
+
--------
|
15
|
+
|
16
|
+
Support more OSs
|
17
|
+
Detect Error codes returned by shell call
|
18
|
+
Ensure OS X detection is correct
|
20
19
|
|
21
|
-
|
22
|
-
|
20
|
+
Contact
|
21
|
+
--------
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
28
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
29
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
30
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
Have fun with the gem, fork at will.
|
24
|
+
Contact me (Steve Martocci) if you have any trouble or feedback.
|
25
|
+
Visit my blog at www.ragingonrails.com
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/say.rb
CHANGED
@@ -1,18 +1,49 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'pp'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require 'rbconfig'
|
4
|
+
|
5
|
+
VOICES = [
|
6
|
+
"Agnes",
|
7
|
+
"Kathy",
|
8
|
+
"Princess",
|
9
|
+
"Vicki",
|
10
|
+
"Victoria",
|
11
|
+
"Bruce",
|
12
|
+
"Fred",
|
13
|
+
"Junior",
|
14
|
+
"Ralph",
|
15
|
+
"Albert",
|
16
|
+
"Bad News",
|
17
|
+
"Bahh",
|
18
|
+
"Bells",
|
19
|
+
"Boing",
|
20
|
+
"Bubbles",
|
21
|
+
"Cellos",
|
22
|
+
"Deranged",
|
23
|
+
"Good News",
|
24
|
+
"Hysterical",
|
25
|
+
"Pipe Organ",
|
26
|
+
"Trinoids",
|
27
|
+
"Whisper",
|
28
|
+
"Zarvox"
|
29
|
+
]
|
30
|
+
unless Config::CONFIG['host_os'] =~ /darwin/
|
31
|
+
raise "say is only supported by OS X right now"
|
32
|
+
end
|
7
33
|
|
8
34
|
module Kernel
|
9
35
|
|
10
36
|
def say(*args, &block)
|
37
|
+
say_as(nil, *args, &block)
|
38
|
+
end
|
39
|
+
|
40
|
+
def say_as(voice, *args, &block)
|
11
41
|
args.push(block) if block
|
12
42
|
|
13
43
|
messages = args.empty? ? ["I have nothing to say"] : args.map{|i| i.pretty_inspect}
|
14
|
-
|
15
|
-
|
44
|
+
say_args = ""
|
45
|
+
say_args += "-v #{voice}" if VOICES.include?(voice)
|
46
|
+
messages.each {|i| `say #{say_args} #{i}`}
|
16
47
|
|
17
48
|
if args.empty?
|
18
49
|
nil
|
@@ -22,6 +53,7 @@ module Kernel
|
|
22
53
|
args
|
23
54
|
end
|
24
55
|
end
|
56
|
+
|
25
57
|
end
|
26
58
|
|
27
59
|
|
data/say.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{say}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Steve Martocci"]
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
".gitignore",
|
22
|
+
"History.txt",
|
22
23
|
"LICENSE",
|
23
24
|
"README.rdoc",
|
24
25
|
"Rakefile",
|
data/spec/say_spec.rb
CHANGED
@@ -5,4 +5,11 @@ describe "Say" do
|
|
5
5
|
p "If you don't hear the test passing.... it failed?"
|
6
6
|
say("The test has passed").should == "The test has passed"
|
7
7
|
end
|
8
|
+
|
9
|
+
it "should be able to say as all the voices" do
|
10
|
+
VOICES.each do |voice|
|
11
|
+
p "My name is #{voice}"
|
12
|
+
say_as(voice, "My name is #{voice}")
|
13
|
+
end
|
14
|
+
end
|
8
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: say
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Martocci
|
@@ -34,6 +34,7 @@ extra_rdoc_files:
|
|
34
34
|
files:
|
35
35
|
- .document
|
36
36
|
- .gitignore
|
37
|
+
- History.txt
|
37
38
|
- LICENSE
|
38
39
|
- README.rdoc
|
39
40
|
- Rakefile
|