talks 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,70 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gon (3.0.2)
5
- actionpack (>= 2.3.0)
6
- json
4
+ talks (0.0.2)
7
5
 
8
6
  GEM
9
7
  remote: http://rubygems.org/
10
8
  specs:
11
- actionpack (3.2.3)
12
- activemodel (= 3.2.3)
13
- activesupport (= 3.2.3)
14
- builder (~> 3.0.0)
15
- erubis (~> 2.7.0)
16
- journey (~> 1.0.1)
17
- rack (~> 1.4.0)
18
- rack-cache (~> 1.2)
19
- rack-test (~> 0.6.1)
20
- sprockets (~> 2.1.2)
21
- activemodel (3.2.3)
22
- activesupport (= 3.2.3)
23
- builder (~> 3.0.0)
24
- activesupport (3.2.3)
25
- i18n (~> 0.6)
26
- multi_json (~> 1.0)
27
- blankslate (2.1.2.4)
28
- builder (3.0.0)
29
- diff-lcs (1.1.3)
30
- erubis (2.7.0)
31
- hike (1.2.1)
32
- i18n (0.6.0)
33
- jbuilder (0.4.0)
34
- activesupport (>= 3.0.0)
35
- blankslate (>= 2.1.2.4)
36
- journey (1.0.3)
37
- json (1.7.1)
38
- multi_json (1.2.0)
39
- rabl (0.6.9)
40
- activesupport (>= 2.3.14)
41
- multi_json (~> 1.0)
42
- rack (1.4.1)
43
- rack-cache (1.2)
44
- rack (>= 0.4)
45
- rack-test (0.6.1)
46
- rack (>= 1.0)
47
- rake (0.9.2.2)
48
- rspec (2.9.0)
49
- rspec-core (~> 2.9.0)
50
- rspec-expectations (~> 2.9.0)
51
- rspec-mocks (~> 2.9.0)
52
- rspec-core (2.9.0)
53
- rspec-expectations (2.9.1)
54
- diff-lcs (~> 1.1.3)
55
- rspec-mocks (2.9.0)
56
- sprockets (2.1.3)
57
- hike (~> 1.2)
58
- rack (~> 1.0)
59
- tilt (~> 1.1, != 1.3.0)
60
- tilt (1.3.3)
61
9
 
62
10
  PLATFORMS
63
11
  ruby
64
12
 
65
13
  DEPENDENCIES
66
- gon!
67
- jbuilder
68
- rabl
69
- rake
70
- rspec
14
+ talks!
data/README.md CHANGED
@@ -1 +1,79 @@
1
- Comming soon
1
+ # Talks gem — now your ruby on your mac can talk with you
2
+
3
+ ### This is beta now
4
+
5
+ ## It was checked only on MacOS X. I don't know what present on linux or windows
6
+
7
+ If you want to HEAR some response from your code, just use this gem.
8
+
9
+ ## Why?
10
+
11
+ For example - some really long task and you just get some coffee, read book or surf internet
12
+ and you want to know when this task will ends, but don't want to check your mac or terminal each minute -
13
+ you can just add small hook in the end of your code and when it will ends - you will hear it with voice that you
14
+ choose from MacOS X `say` function collection.
15
+
16
+ ## How?
17
+
18
+ This gem just using native MacOS X `say` command line tool.
19
+
20
+ ### Using talks in your code
21
+
22
+ ```bash
23
+ $ gem install talks
24
+ ```
25
+
26
+ Then in your code you can require and use Talks functions:
27
+
28
+ ```ruby
29
+ require 'talks'
30
+
31
+ Talks.say 'Hello bro!'
32
+
33
+ # There are 4 types of voice: say or info, warn, success, error
34
+ Talks.info 'This is info'
35
+ # Talks.warn 'Some text'
36
+ # Talks.success 'Some text'
37
+ # Talks.error 'Some text'
38
+ ```
39
+
40
+ `Talks.say` can be customized with type of message and voice by adding options to executing this method:
41
+
42
+ ```ruby
43
+ Talks.say 'Hello like pipe', voice: 'pipe'
44
+ Talks.say 'Hello like error', type: :error # the same as using Talks.error
45
+ ```
46
+
47
+ All voices which I found in manual for `say`:
48
+ ```ruby
49
+ VOICES = %w(
50
+ agnes albert alex bad bahh bells boing bruce bubbles cellos
51
+ deranged fred good hysterical junior kathy pipe princess ralph
52
+ trinoids vicki victoria whisper zarvox
53
+ )
54
+ ```
55
+
56
+ ## Who?
57
+
58
+ I did it myself
59
+
60
+ ### Contributors
61
+
62
+ * @gazay
63
+
64
+ ### A lot of thanks
65
+
66
+ You can help me with this fun gem and I'll gladly add you here, or above
67
+
68
+ ## License
69
+
70
+ The MIT License
71
+
72
+ Copyright (c) 2012 gazay
73
+
74
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
75
+
76
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
77
+
78
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
79
+
data/lib/talks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Talks
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/talks.rb CHANGED
@@ -2,16 +2,16 @@ module Talks
2
2
  class << self
3
3
 
4
4
  VOICES = %w(
5
- Agnes Albert Alex Bad Bahh Bells Boing Bruce Bubbles Cellos
6
- Deranged Fred Good Hysterical Junior Kathy Pipe Princess Ralph
7
- Trinoids Vicki Victoria Whisper Zarvox
5
+ agnes albert alex bad bahh bells boing bruce bubbles cellos
6
+ deranged fred good hysterical junior kathy pipe princess ralph
7
+ trinoids vicki victoria whisper zarvox
8
8
  )
9
9
 
10
10
  PREFS = {
11
- info: 'Bruce',
12
- warn: 'Whisper',
13
- success: 'Fred',
14
- error: 'Trinoids'
11
+ info: 'vicki',
12
+ warn: 'whisper',
13
+ success: 'vicki',
14
+ error: 'bad'
15
15
  }
16
16
 
17
17
  def voice
@@ -22,10 +22,14 @@ module Talks
22
22
  @voice ||= voice
23
23
  end
24
24
 
25
- def say(message, type = voice, options = {})
26
- type = type.to_sym
25
+ def voices
26
+ VOICES
27
+ end
28
+
29
+ def say(message, options = {})
30
+ type = options[:type].to_sym if options[:type]
27
31
  say_voice = \
28
- if options[:voice] and VOICES.include?(options[:voice].to_downcase)
32
+ if options[:voice] and VOICES.include?(options[:voice].to_s)
29
33
  options[:voice]
30
34
  elsif PREFS.keys.include? type
31
35
  PREFS[type]
@@ -36,8 +40,8 @@ module Talks
36
40
  end
37
41
 
38
42
  PREFS.keys.each do |type|
39
- define_method type do |message, options = {}|
40
- say(message, type, options)
43
+ define_method type do |message, options = {type: type}|
44
+ say(message, options)
41
45
  end
42
46
  end
43
47
 
data/spec/talks.rb ADDED
@@ -0,0 +1,12 @@
1
+ require File.expand_path('../../lib/talks.rb', __FILE__)
2
+
3
+ Talks.voices.each do |v|
4
+ p v
5
+ Talks.say 'Tests start', nil, voice: v
6
+ end
7
+
8
+ Talks.say 'say'
9
+ Talks.info 'say again'
10
+ Talks.warn 'I warn you'
11
+ Talks.error 'This is how error sounds'
12
+ Talks.success 'This is success!'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: talks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-21 00:00:00.000000000 Z
12
+ date: 2012-05-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Simple gem for `say` function of mac os x
15
15
  email:
@@ -25,6 +25,7 @@ files:
25
25
  - Rakefile
26
26
  - lib/talks.rb
27
27
  - lib/talks/version.rb
28
+ - spec/talks.rb
28
29
  - talks.gemspec
29
30
  homepage: https://github.com/gazay/talks
30
31
  licenses: []
@@ -50,4 +51,5 @@ rubygems_version: 1.8.24
50
51
  signing_key:
51
52
  specification_version: 3
52
53
  summary: Simple gem for `say` function of mac os x
53
- test_files: []
54
+ test_files:
55
+ - spec/talks.rb