sounder 1.0.0 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 568c6f3644c7d7f3b1a41b30029be59d2ff60f60
4
- data.tar.gz: c6fd88b98ff40e065a478859f91e0f8a48e6cd7d
3
+ metadata.gz: 8df9741d168eeba2db6c05ee1c6d1d9532ecd663
4
+ data.tar.gz: 1398cba28a6d833eb95fa07869db03492d9aec5e
5
5
  SHA512:
6
- metadata.gz: a50a56173c91396b072444aaefa7bc6718c98c4f765bf0a625af24b6744b21b7f81fe9c1fdbbd5a2be4811c232f2f9a0791792d6517fb0927ac8044c791d8ca0
7
- data.tar.gz: 50af1099fca25b55b760e1fcc331a45518ccf04b6f48d1b0c2f572d666b33060805d4a216791de97290563f13136649f3503a17fc40120f9c96794d8c3fe9b8f
6
+ metadata.gz: 3e08ffcd9195685638dffec8ca961151067f31c0b0f0df7a916bbb1c7ecf1988d6a8ec1a637ea4b4537e9047f1aadedc53125b9c01c0abfdf7b45b0cf4e88428
7
+ data.tar.gz: 9c99e7251d3e7147ee47dc2d3c089d6870d79e84c59710d13aa43afea55463cb8a806ce7c92c49f74f1597ed5e935c419729aabe7501c7e8121511bd9ee94c6c
data/README.md CHANGED
@@ -25,10 +25,10 @@ Or install it yourself as:
25
25
  sound = Sounder::Sound.new "/path/to/audio/file"
26
26
  sound.play
27
27
 
28
- my_group = Sounder::SoundGroup.new {
28
+ my_group = Sounder::SoundGroup.new(
29
29
  :sound_one => File.expand_path('../../lib/support/sound1.m4a', __FILE__),
30
30
  "sound_two" => File.expand_path('../../lib/support/sound2.m4a', __FILE__)
31
- }
31
+ )
32
32
  my_group.play "tw" # fuzzy matching of names
33
33
  my_group.random # plays a random sound from the group
34
34
  my_group.usage # returns a usage string with all the sound
data/lib/sounder/sound.rb CHANGED
@@ -1,8 +1,10 @@
1
+ require 'shellwords'
2
+
1
3
  module Sounder
2
4
  class Sound
3
5
  attr_reader :file
4
6
  def initialize path
5
- @file = path
7
+ @file = Shellwords.escape path
6
8
  end
7
9
 
8
10
  def play
@@ -21,13 +21,12 @@ module Sounder
21
21
  end
22
22
 
23
23
  def usage
24
- usage = [ "random (picks a random sound)",
24
+ [ "random (picks a random sound)",
25
25
  "<sound name> (it will fuzzy match the name)",
26
26
  "Available sounds:"
27
27
  ] + @sounds.keys.map do |sound|
28
28
  " #{sound}"
29
29
  end
30
- usage.join "\n"
31
30
  end
32
31
 
33
32
 
@@ -1,3 +1,3 @@
1
1
  module Sounder
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -54,9 +54,9 @@ describe Sounder do
54
54
  describe '#usage' do
55
55
  it "returns usage info in a string" do
56
56
  group = Sounder::SoundGroup.new sounds
57
- group.usage.should include "random"
58
- group.usage.should include "sound_a"
59
- group.usage.should include "sound_b"
57
+ group.usage.should include "random (picks a random sound)"
58
+ group.usage.should include " sound_a"
59
+ group.usage.should include " sound_b"
60
60
  end
61
61
  end
62
62
  end
@@ -15,6 +15,11 @@ describe Sounder do
15
15
  sound.should_receive(:system).with %{/usr/bin/afplay "fake/file.m4a" &}
16
16
  sound.play
17
17
  end
18
+ it "is not super insecure" do
19
+ bad_sound = Sounder::Sound.new '";echo doing bad things;"'
20
+ bad_sound.should_receive(:system).with %{/usr/bin/afplay \"\\\"\\;echo\\ doing\\ bad\\ things\\;\\\"\" &}
21
+ bad_sound.play
22
+ end
18
23
  end
19
24
  end
20
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
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-06 00:00:00.000000000 Z
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler