humpday 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c284c04206a1a7bd557ad3bd30d2b460201991a
4
- data.tar.gz: 478694c7de0c4c6ea945449b104e231eff68c422
3
+ metadata.gz: dd6841aabda03227c9e48aaca75c26c9b5a27338
4
+ data.tar.gz: fbae404dc614756d824918c3059abb63a669a1d3
5
5
  SHA512:
6
- metadata.gz: 352ddf9b96e7af8f3e9e6678cb8c315f29dc64ea7b8e37305d036b183cdc0040e577f2ad6d4212e27d0d3458d9ec7751df4d98bfa037e71fce8d836f2fc8c93c
7
- data.tar.gz: 61f515db7bdeb3d09827b5b958a28109315cfeb0e2586cd9c7ada770e01b0e831066c521ba093379e3a8d6dd0aaa04c86bfc7a34a1550e0f4d81edde35f3531e
6
+ metadata.gz: 00f69fd1688fabb98eef9b87e82ebf5a857709b912572852c8a1cd97fce6060568228a25e17c5659ec9b3929be038842a6fe55d8c2a9b89af4af9ca8df5acc19
7
+ data.tar.gz: b0e012fd4edae921fad8878daa182360fa983d9118d925a41e9d6709f292ad5c368deda61660ec041f03a9ca2d3d700cc260b40edbebd1c25f288ff4ada94ada
data/bin/humpday CHANGED
@@ -1,17 +1,41 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'sounder'
4
- require_relative '../lib/humpday'
4
+ require 'humpday'
5
+
6
+ sounds = {
7
+ 'uhoh' => 'uhoh',
8
+ 'guess_what_day' => 'guess_what_day_it_is',
9
+ 'guess_what_day_2'=> 'guess_what_day_it_is2',
10
+ 'huh' => 'huh_anybody',
11
+ 'cmon' => 'aw_cmon_i_know_you_can_hear_me',
12
+ 'laugh' => 'laugh',
13
+ 'whoowhoa' => 'whoowhoa',
14
+ 'humpday' => 'humpday'
15
+ }
16
+ sound_files = {}
17
+ sounds.each do |name, file|
18
+ sound_files[name] = File.expand_path("../../lib/support/#{file}.m4a", __FILE__)
19
+ end
20
+
21
+ humpday = Sounder::SoundGroup.new sound_files
22
+
23
+ usage = humpday.usage.map do |line|
24
+ " #{line}"
25
+ end
26
+ usage = ["humpday version #{Humpday::VERSION}","Usage:"] + usage
27
+ usage = usage.join "\n"
5
28
 
6
29
  if ARGV.size == 1 && ARGV[0] == 'random'
7
- Humpday.random
30
+ humpday.random
8
31
  elsif ARGV.size == 1 && ARGV[0] != '-h' && ARGV[0] != 'help' && ARGV[0] != '--help'
9
32
  begin
10
- Humpday.play ARGV[0]
11
- rescue Humpday::UnknownSoundError
12
- abort "#{ARGV[0]} does not match a known sound"
33
+ humpday.play ARGV[0]
34
+ rescue Sounder::UnknownSoundError
35
+ puts "Error: #{ARGV[0]} does not match a known sound"
36
+ puts usage
13
37
  end
14
38
  else
15
- puts Humpday.usage
39
+ puts usage
16
40
  end
17
41
 
data/humpday.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Humpday::VERSION
9
9
  spec.authors = ["Adam Zaninovich"]
10
10
  spec.email = ["adam.zaninovich@gmail.com"]
11
- spec.description = %q{says humpday}
12
- spec.summary = %q{says humpday}
11
+ spec.description = %q{plays humpday sounds}
12
+ spec.summary = %q{plays humpday sounds}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "sounder", "~> 0.0.2"
21
+ spec.add_dependency "sounder", "~> 1.0.1"
22
22
  spec.add_development_dependency "bundler", "~> 1.3"
23
23
  spec.add_development_dependency "rake"
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module Humpday
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/humpday.rb CHANGED
@@ -1,46 +1,4 @@
1
1
  require 'humpday/version'
2
2
 
3
3
  module Humpday
4
-
5
- class UnknownSoundError < ArgumentError; end
6
-
7
- SOUNDS = {
8
- 'uhoh' => 'uhoh',
9
- 'guess_what_day' => 'guess_what_day_it_is',
10
- 'guess_what_day_2'=> 'guess_what_day_it_is2',
11
- 'huh' => 'huh_anybody',
12
- 'cmon' => 'aw_cmon_i_know_you_can_hear_me',
13
- 'laugh' => 'laugh',
14
- 'whoowhoa' => 'whoowhoa',
15
- 'humpday' => 'humpday'
16
- }
17
-
18
- def self.play name
19
- sound_name = self.fuzzy_find name
20
- raise UnknownSoundError if sound_name.nil?
21
- sound = SOUNDS.fetch(sound_name) { raise UnknownSoundError }
22
- audio_file = File.expand_path("../../lib/support/#{sound}.m4a", __FILE__)
23
- Sounder.play audio_file
24
- end
25
-
26
- def self.random
27
- self.play SOUNDS.keys.sample
28
- end
29
-
30
- def self.usage
31
- usage = [ "humpday version #{Humpday::VERSION}",
32
- "Usage: humpday help (this)",
33
- "Usage: humpday random (picks a random sound)",
34
- "Usage: humpday <sound name> (it will fuzzy match the name)",
35
- "Sounds:"
36
- ] + SOUNDS.keys.map do |sound|
37
- " #{sound}"
38
- end
39
- usage.join "\n"
40
- end
41
-
42
- private
43
- def self.fuzzy_find name
44
- SOUNDS.keys.select { |sn| sn.include? name }.first
45
- end
46
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humpday
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Zaninovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-02 00:00:00.000000000 Z
11
+ date: 2013-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sounder
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.2
19
+ version: 1.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.2
26
+ version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: says humpday
55
+ description: plays humpday sounds
56
56
  email:
57
57
  - adam.zaninovich@gmail.com
58
58
  executables:
@@ -100,5 +100,5 @@ rubyforge_project:
100
100
  rubygems_version: 2.0.5
101
101
  signing_key:
102
102
  specification_version: 4
103
- summary: says humpday
103
+ summary: plays humpday sounds
104
104
  test_files: []