say 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ == 0.2.0
2
+
3
+ * New Features
4
+ * Say now support multiple voices via say_as
5
+ * Say now checks that you are using os x
6
+
7
+
8
+ === 0.1.0
9
+ * New Features
10
+ * Say works
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Steve Martocci
1
+ Copyright (c) 2010 Steve Martocci
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -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
- License
7
+ Requirements
7
8
  --------
8
9
 
9
- (The MIT License)
10
+ Must be on os x >= 1.4
10
11
 
11
- Copyright (c) 2008-2009 jugyo
12
12
 
13
- Permission is hereby granted, free of charge, to any person obtaining
14
- a copy of this software and associated documentation files (the
15
- 'Software'), to deal in the Software without restriction, including
16
- without limitation the rights to use, copy, modify, merge, publish,
17
- distribute, sublicense, and/or sell copies of the Software, and to
18
- permit persons to whom the Software is furnished to do so, subject to
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
- The above copyright notice and this permission notice shall be
22
- included in all copies or substantial portions of the Software.
20
+ Contact
21
+ --------
23
22
 
24
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
25
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
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
1
+ 0.2.0
data/lib/say.rb CHANGED
@@ -1,18 +1,49 @@
1
1
  require 'rubygems'
2
2
  require 'pp'
3
-
4
- $g_host ||= "localhost"
5
- $g_priority ||= 0
6
- $g_sticky ||= true
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
- messages.each {|i| `say #{i}`}
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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{say}
8
- s.version = "0.1.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",
@@ -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.1.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