rack-deflatermaus 0.0.1
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 +7 -0
- data/.gitignore +15 -0
- data/ATTRIBUTION.txt +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +72 -0
- data/Rakefile +2 -0
- data/lib/rack/deflatermaus/overture.mp3 +0 -0
- data/lib/rack/deflatermaus/player.rb +26 -0
- data/lib/rack/deflatermaus/version.rb +5 -0
- data/lib/rack/deflatermaus.rb +16 -0
- data/rack-deflatermaus.gemspec +24 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1dd437a4c7124c0a9ef5befd8e1c916f66d02757
|
4
|
+
data.tar.gz: 107f3c9c4b0b143fd17d0a75c89c1eae903105ee
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d4027d7c4e898d4beaaa3b43110e3e0cae9f82937ec79750917587139f0bac5942d462f37fcd7a4a1430d33f249d3b619185eb790fc096b9e932a9ae63e51c14
|
7
|
+
data.tar.gz: 69b7c8b2d363a42170e5c62e160fe17352a24b679ca5cc40199b6265b9ae3b56eaed66d8017dfd351e6c845bc59b5ffead16e018ba221473c4eac0e087703323
|
data/.gitignore
ADDED
data/ATTRIBUTION.txt
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Gabe Berke-Williams
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# Rack::Deflatermaus
|
2
|
+
|
3
|
+
Play a selection from the operetta *[Die Fledermaus][wiki]* on every request to
|
4
|
+
a Rack app.
|
5
|
+
|
6
|
+
This may slow down your application significantly.
|
7
|
+
|
8
|
+
[wiki]: https://en.wikipedia.org/wiki/Die_Fledermaus
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
`Rack::Deflatermaus` uses the [audite] gem, which requires portaudio and mpg123.
|
13
|
+
Refer to audite's [installation instructions][audite-libs] to find out how to
|
14
|
+
install those on your system.
|
15
|
+
|
16
|
+
[audite]: https://github.com/georgi/audite
|
17
|
+
[audite-libs]: https://github.com/georgi/audite#requirements
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem "rack-deflatermaus"
|
23
|
+
```
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
$ bundle
|
28
|
+
|
29
|
+
Or install it yourself as:
|
30
|
+
|
31
|
+
$ gem install rack-deflatermaus
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
`Rack::Deflatermaus` is a standard Rack middleware.
|
36
|
+
|
37
|
+
In Rails:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# config/application.rb, or
|
41
|
+
# config/environments/development.rb if you lack conviction
|
42
|
+
|
43
|
+
config.middleware.use Rack::Deflatermaus
|
44
|
+
```
|
45
|
+
|
46
|
+
In any Rack application:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# config.ru
|
50
|
+
use Rack::Deflatermaus
|
51
|
+
```
|
52
|
+
|
53
|
+
Restart your application, and load a page, any page.
|
54
|
+
|
55
|
+
## I want to use this with Rack::Timeout, how long does the music play for?
|
56
|
+
|
57
|
+
First: you might want to figure out why you're using this with an app that is
|
58
|
+
also tracking how long requests take. I find writing down a pro/con list
|
59
|
+
personally helpful, but you do you.
|
60
|
+
|
61
|
+
Done? Great.
|
62
|
+
|
63
|
+
It plays five minutes of Die Fledermaus, and you should probably...not use
|
64
|
+
Rack::Timeout with this.
|
65
|
+
|
66
|
+
## Contributing
|
67
|
+
|
68
|
+
1. Fork it: https://github.com/gabebw/rack-deflatermaus/fork
|
69
|
+
2. Create your feature branch: `git checkout -b my-new-feature`
|
70
|
+
3. Commit your changes: `git commit -am 'Add some feature'`
|
71
|
+
4. Push to the branch: `git push origin my-new-feature`
|
72
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
Binary file
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "audite"
|
2
|
+
|
3
|
+
module Rack
|
4
|
+
class Deflatermaus
|
5
|
+
class Player
|
6
|
+
PATH_TO_OVERTURE = ::File.expand_path("../overture.mp3", __FILE__)
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@audite = Audite.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def play
|
13
|
+
@audite.load(PATH_TO_OVERTURE)
|
14
|
+
@audite.start_stream
|
15
|
+
|
16
|
+
# We need to do something (or just sleep) while the song plays in the
|
17
|
+
# background thread.
|
18
|
+
#
|
19
|
+
# The song is 7:30, but sleeping `@audite.length_in_seconds` sleeps
|
20
|
+
# longer than that. Sleeping for 5 minutes is safely under 7:30.
|
21
|
+
sleep 60 * 5
|
22
|
+
@audite.stop_stream
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rack/deflatermaus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rack-deflatermaus"
|
8
|
+
spec.version = Rack::Deflatermaus::VERSION
|
9
|
+
spec.authors = ["Gabe Berke-Williams"]
|
10
|
+
spec.email = ["gabebw@gabebw.com"]
|
11
|
+
spec.summary = %q{Play a selection from Die Fledermaus with every request.}
|
12
|
+
spec.homepage = "https://github.com/gabebw/rack-deflatermaus"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "audite", "~> 0.4.0"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-deflatermaus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabe Berke-Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: audite
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- gabebw@gabebw.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ATTRIBUTION.txt
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/rack/deflatermaus.rb
|
69
|
+
- lib/rack/deflatermaus/overture.mp3
|
70
|
+
- lib/rack/deflatermaus/player.rb
|
71
|
+
- lib/rack/deflatermaus/version.rb
|
72
|
+
- rack-deflatermaus.gemspec
|
73
|
+
homepage: https://github.com/gabebw/rack-deflatermaus
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Play a selection from Die Fledermaus with every request.
|
97
|
+
test_files: []
|