airhorn 0.0.4 → 0.1.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: e8d1d8aa0d2ecb8d0405b038fe89ec325367d830
4
- data.tar.gz: 690205e580501087dcdd2be77079a155e7e2432e
3
+ metadata.gz: f1239f624b5d3532d0ec355a46de50893cb9b543
4
+ data.tar.gz: d8f67f03a1e1f2ba050c1ba6b032bbfc4bb3a361
5
5
  SHA512:
6
- metadata.gz: 2160128ded8055e8f94e20aada728c06e16ae765afe8c4ae5ec2d9b9ca4e06de9dd880afb734fce70802ebd734acc15b81bfc32cab56e48fa2874c35cfb42eda
7
- data.tar.gz: 93d5e68edf5f148184f20bb4c18a8dcebc24b3921a7768f35e02efab2565f5794db4be49f64129f8e2203181247b72aeb16f1e381357d67baa5673e6cd28c559
6
+ metadata.gz: 8da1431d338058c456781b3732758f99f9776fc142847955cc54ed21918eefec31c7f0ef1a712f2796401a6e6823ed3172c4e1411c1db4fd7f5f6201ac45b546
7
+ data.tar.gz: 80c497820834603f5c2d5aa0ae29a1a9ae9ac813662f35b401cbbca01e006f8960ad3fca0b5c0212b8f74e1d387a6105cf5c3ec284cae605309168cf8b75d901
Binary file
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'airhorn'
4
- puts Airhorn.blow(ARGV[0])
4
+ puts Airhorn.blow('airhorn.wav', 1.5)
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'airhorn'
4
+ puts Airhorn.blow('airhorns.wav', 2.8)
@@ -1,6 +1,6 @@
1
1
  class Airhorn
2
- def self.blow (args)
3
- pid = play audio_file_path('airhorn.wav')
2
+ def self.blow (file = 'airhorn.wav', duration = 1.5)
3
+ pid = play audio_file_path(file), duration
4
4
  return if pid.nil?
5
5
  tpid = spawn('printf "B"; while sleep 0.1; do printf "R"; done')
6
6
  Process.wait pid
@@ -8,13 +8,13 @@ class Airhorn
8
8
  return
9
9
  end
10
10
 
11
- def self.play (file_path)
11
+ def self.play (file_path, duration)
12
12
  if system 'command -v afplay >/dev/null 2>&1'
13
13
  # mac
14
- spawn("afplay -t 1.5 #{file_path} >/dev/null 2>&1")
14
+ spawn("afplay -t #{duration.to_s} #{file_path} >/dev/null 2>&1")
15
15
  elsif system 'command -v aplay >/dev/null 2>&1'
16
16
  # linux
17
- spawn("aplay -d 2 #{file_path} >/dev/null 2>&1")
17
+ spawn("aplay -d #{duration.ceil.to_s} #{file_path} >/dev/null 2>&1")
18
18
  end
19
19
  end
20
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airhorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kim
@@ -14,12 +14,15 @@ description:
14
14
  email: christopherjkim@gmail.com
15
15
  executables:
16
16
  - airhorn
17
+ - airhorns
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
- - lib/airhorn.rb
21
21
  - audio/airhorn.wav
22
+ - audio/airhorns.wav
22
23
  - bin/airhorn
24
+ - bin/airhorns
25
+ - lib/airhorn.rb
23
26
  homepage: http://github.com/dy-dx/airhorn
24
27
  licenses: []
25
28
  metadata: {}
@@ -29,17 +32,17 @@ require_paths:
29
32
  - lib
30
33
  required_ruby_version: !ruby/object:Gem::Requirement
31
34
  requirements:
32
- - - '>='
35
+ - - ">="
33
36
  - !ruby/object:Gem::Version
34
37
  version: '0'
35
38
  required_rubygems_version: !ruby/object:Gem::Requirement
36
39
  requirements:
37
- - - '>='
40
+ - - ">="
38
41
  - !ruby/object:Gem::Version
39
42
  version: '0'
40
43
  requirements: []
41
44
  rubyforge_project:
42
- rubygems_version: 2.0.5
45
+ rubygems_version: 2.2.2
43
46
  signing_key:
44
47
  specification_version: 4
45
48
  summary: BRRRRR