airhorn 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/audio/airhorn.wav +0 -0
- data/bin/airhorn +4 -0
- data/lib/airhorn.rb +25 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3a000837b83bcca920c272aa40e32bfc11553c84
|
4
|
+
data.tar.gz: dbe20fba2b8180a290c4effb06c5635cdf0af89f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c28f6079d1be6eac97eb85705c55ef79f5a08090bec336a2a98b0a9f90dd6e33bf601e17685619f39fe55bec27d0d6e94438169af1870caed5135c2c77c82a66
|
7
|
+
data.tar.gz: dbd8a48e2889cb2906b5d55f02de19709bf35296296b36f984f9d794c3340e9e717c35779ca350bd2bf20d3dd35fe4d528f78d7f48cf3b84b3226d6524c0295c
|
data/audio/airhorn.wav
ADDED
Binary file
|
data/bin/airhorn
ADDED
data/lib/airhorn.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
class Airhorn
|
2
|
+
def self.blow (args)
|
3
|
+
pid = play audio_file_path('airhorn.wav')
|
4
|
+
return if pid.nil?
|
5
|
+
tpid = spawn('printf "B"; while sleep 0.1; do printf "R"; done')
|
6
|
+
Process.wait pid
|
7
|
+
Process.kill 'TERM', tpid
|
8
|
+
return
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.play (file_path)
|
12
|
+
if system 'command -v afplay >/dev/null 2>&1'
|
13
|
+
# mac
|
14
|
+
spawn("afplay -t 1.4 #{file_path} >/dev/null 2>&1")
|
15
|
+
elsif system 'command -v aplay >/dev/null 2>&1'
|
16
|
+
# linux
|
17
|
+
spawn("aplay -d 1.4 #{file_path} >/dev/null 2>&1")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.audio_file_path (file)
|
22
|
+
File.expand_path("../../audio/#{file}", __FILE__)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: airhorn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Kim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: christopherjkim@gmail.com
|
15
|
+
executables:
|
16
|
+
- airhorn
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/airhorn.rb
|
21
|
+
- audio/airhorn.wav
|
22
|
+
- bin/airhorn
|
23
|
+
homepage: http://github.com/dy-dx/airhorn
|
24
|
+
licenses: []
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.0.5
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: BRRRRR
|
46
|
+
test_files: []
|