capistrano-jukebox 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.
- data/.gitignore +18 -0
- data/Gemfile +3 -0
- data/README.md +46 -0
- data/Rakefile +2 -0
- data/capistrano-jukebox.gemspec +23 -0
- data/lib/capistrano/jukebox/version.rb +3 -0
- data/lib/capistrano/jukebox.rb +61 -0
- data/music/jeopardy_thinking.mp3 +0 -0
- metadata +71 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
capistrano-jukebox
|
2
|
+
==================
|
3
|
+
|
4
|
+
Sometimes deployment takes long time... We need some amusement!
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
gem install capistrano-jukebox
|
10
|
+
|
11
|
+
# config/deploy.rb
|
12
|
+
require "capistrano/jukebox"
|
13
|
+
|
14
|
+
|
15
|
+
Usage
|
16
|
+
-----
|
17
|
+
|
18
|
+
__When you type `cap deploy` the jukebox starts to play automatically and stops when the deployment has finished.__
|
19
|
+
|
20
|
+
For playing "Jeopardy think music"
|
21
|
+
|
22
|
+
cap deploy
|
23
|
+
|
24
|
+
For playing your own file
|
25
|
+
|
26
|
+
cap deploy -s file=http://domain.com/my_music.mp3
|
27
|
+
|
28
|
+
|
29
|
+
__You can also use the cap tasks manually to start/stop music__
|
30
|
+
|
31
|
+
For playing "Jeopardy think music"
|
32
|
+
|
33
|
+
cap jukebox:play
|
34
|
+
|
35
|
+
For playing your own file
|
36
|
+
|
37
|
+
cap jukebox:play -s file=http://domain.com/my_music.mp3
|
38
|
+
|
39
|
+
Dependencies
|
40
|
+
============
|
41
|
+
|
42
|
+
MPlayer (http://www.mplayerhq.hu/design7/info.html)
|
43
|
+
|
44
|
+
OSX Installation:
|
45
|
+
|
46
|
+
brew install mplayer
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "capistrano/jukebox/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'capistrano-jukebox'
|
7
|
+
s.version = CapistranoJukebox::VERSION.dup
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.author = 'Robin Böning'
|
11
|
+
s.email = 'rb@magiclabs.de'
|
12
|
+
s.homepage = 'https://github.com/robinboening/capistrano-jukebox'
|
13
|
+
s.summary = %q{A Jukebox playing music while deployment with Capistrano}
|
14
|
+
s.description = %q{Sometimes deployment takes long time... You need some amusement!}
|
15
|
+
s.requirements << 'MPlayer (http://www.mplayerhq.hu)'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency 'capistrano'
|
23
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'capistrano'
|
2
|
+
|
3
|
+
module Capistrano::Jukebox
|
4
|
+
|
5
|
+
def self.load_into(configuration)
|
6
|
+
|
7
|
+
configuration.load do
|
8
|
+
|
9
|
+
# Start playing music before :deploy
|
10
|
+
on :before, :only => :deploy do
|
11
|
+
start_playing(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Stop playing music after :deploy
|
15
|
+
on :after, :only => :deploy do
|
16
|
+
stop_playing
|
17
|
+
end
|
18
|
+
|
19
|
+
# Jukebox start/stop cap tasks
|
20
|
+
namespace :jukebox do
|
21
|
+
desc 'Start playing music on the jukebox'
|
22
|
+
task :play, :roles => :app, :except => {:no_release => true} do
|
23
|
+
file = configuration[:file]
|
24
|
+
file = File.expand_path('../../../music/jeopardy_thinking.mp3', __FILE__) if file.nil?
|
25
|
+
start_playing(file)
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Stop the jukebox from playing music'
|
29
|
+
task :stop, :roles => :app, :except => {:no_release => true} do
|
30
|
+
puts "You have forced the jukebox to stop the music."
|
31
|
+
stop_playing
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# Starting mplayer playing the file in the background
|
36
|
+
def start_playing(file)
|
37
|
+
puts "Jukebox is starting to play '#{file}'"
|
38
|
+
@pid = fork do
|
39
|
+
exec("mplayer #{file} -really-quiet -framedrop -cache 16384 -cache-min 20/100")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Stops mplayer by killing it by pid
|
44
|
+
# If no pid is known, all running player processes are killed
|
45
|
+
def stop_playing
|
46
|
+
unless @pid.nil?
|
47
|
+
::Process.kill("TERM", @pid)
|
48
|
+
else
|
49
|
+
exec("killall mplayer")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
if Capistrano::Configuration.instance
|
60
|
+
Capistrano::Jukebox.load_into(Capistrano::Configuration.instance)
|
61
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-jukebox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robin Böning
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: capistrano
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Sometimes deployment takes long time... You need some amusement!
|
31
|
+
email: rb@magiclabs.de
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- .gitignore
|
37
|
+
- Gemfile
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- capistrano-jukebox.gemspec
|
41
|
+
- lib/capistrano/jukebox.rb
|
42
|
+
- lib/capistrano/jukebox/version.rb
|
43
|
+
- music/jeopardy_thinking.mp3
|
44
|
+
homepage: https://github.com/robinboening/capistrano-jukebox
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements:
|
64
|
+
- MPlayer (http://www.mplayerhq.hu)
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.8.24
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: A Jukebox playing music while deployment with Capistrano
|
70
|
+
test_files: []
|
71
|
+
has_rdoc:
|