candelabra 0.0.1 → 1.0.0
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 +3 -0
- data/.rvmrc +1 -0
- data/Gemfile.lock +17 -0
- data/README.md +18 -0
- data/Rakefile +9 -0
- data/bin/candelabra +15 -0
- data/candelabra.gemspec +1 -2
- data/lib/candelabra/configuration.rb +50 -0
- data/lib/candelabra/event_cmd.rb +62 -0
- data/lib/candelabra/extensions.rb +70 -0
- data/lib/candelabra/installer.rb +249 -0
- data/lib/candelabra/osx.rb +88 -0
- data/lib/candelabra/pianobar.rb +142 -0
- data/lib/candelabra/remote.rb +152 -0
- data/lib/candelabra/runner.rb +93 -0
- data/lib/candelabra/templates/config.erb +4 -0
- data/lib/candelabra/templates/header.erb +11 -0
- data/lib/candelabra/templates/setup_config_file.erb +5 -0
- data/lib/candelabra/templates/what_is_installed.erb +11 -0
- data/lib/candelabra/ubuntu.rb +96 -0
- data/lib/candelabra/version.rb +1 -1
- data/lib/candelabra.rb +15 -2
- data/spec/candelabra_spec.rb +7 -0
- data/spec/configuration_spec.rb +81 -0
- data/spec/event_cmd_spec.rb +24 -0
- data/spec/helper.rb +28 -0
- data/spec/installer_spec.rb +63 -0
- data/spec/pianobar_spec.rb +58 -0
- data/spec/remote_spec.rb +41 -0
- data/spec/runner_spec.rb +17 -0
- metadata +32 -47
- data/README +0 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Candelabra::Installer do
|
4
|
+
describe 'with pianobar is installed' do
|
5
|
+
it 'should know that pianobar is installed' do
|
6
|
+
Candelabra::Installer.pianobar?.must_equal true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'without pinaobar installed' do
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'with the remote control file for pianobar setup' do
|
14
|
+
it 'should know if the control file is setup' do
|
15
|
+
Candelabra::Installer.ctl?.must_equal true
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should know the path of the control file' do
|
19
|
+
Candelabra::Installer.ctl_path.must_match /\/\.config\/pianobar\/ctl$/
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'without the remote control file for pianobar setup' do
|
24
|
+
it 'should know if the control file is setup' do
|
25
|
+
Candelabra::Installer.ctl?.must_equal true
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should know the path of the control file' do
|
29
|
+
Candelabra::Installer.ctl_path.must_match /\/\.config\/pianobar\/ctl$/
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'OSX' do
|
34
|
+
describe 'with brew installed' do
|
35
|
+
it 'should be able to detect the os' do
|
36
|
+
Candelabra::Installer.has_installer?.must_equal true
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should know the to brew' do
|
40
|
+
Candelabra::Installer.installer_path.must_match /.*\/bin\/brew$/
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'without brew installed' do
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'Ubuntu' do
|
50
|
+
describe 'with apt-get installed' do
|
51
|
+
it 'should be able to detect the os' do
|
52
|
+
Candelabra::Installer.has_installer?.must_equal true
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should know the to brew' do
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'without apt-get installed (really this can happen?)' do
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Candelabra::Pianobar do
|
4
|
+
after( :each ) { Candelabra::Pianobar.stop_all }
|
5
|
+
|
6
|
+
describe 'starting the process' do
|
7
|
+
it 'should start pianobar and find it by the pid' do
|
8
|
+
clean_up do
|
9
|
+
pid = Candelabra::Pianobar.start
|
10
|
+
%x[ ps ].must_match /\s#{pid}\s/
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should start pianobar and find it by the pid from the reader' do
|
15
|
+
clean_up do
|
16
|
+
Candelabra::Pianobar.start
|
17
|
+
%x[ ps ].must_match /\s#{Candelabra::Pianobar.pid}\s/
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should start pianobar and find it by the process name' do
|
22
|
+
clean_up do
|
23
|
+
Candelabra::Pianobar.start
|
24
|
+
%x[ ps ].must_match /pianobar$/
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'stoping the process' do
|
30
|
+
it 'should stop pianobar' do
|
31
|
+
pid = Candelabra::Pianobar.start
|
32
|
+
Candelabra::Pianobar.stop
|
33
|
+
%x[ ps ].wont_match /#{pid}\s/
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should be able to stop all pianobars' do
|
37
|
+
Candelabra::Pianobar.start
|
38
|
+
Candelabra::Pianobar.start
|
39
|
+
Candelabra::Pianobar.stop_all
|
40
|
+
%x[ ps ].wont_match /(pianobar)$/
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'checking the running process' do
|
45
|
+
it 'should know when pianobar is running' do
|
46
|
+
clean_up do
|
47
|
+
Candelabra::Pianobar.start
|
48
|
+
Candelabra::Pianobar.running?.must_equal true
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should know when pianobar is not running' do
|
53
|
+
Candelabra::Pianobar.stop_all
|
54
|
+
Candelabra::Pianobar.running?.must_equal false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
data/spec/remote_spec.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
|
5
|
+
describe Candelabra::Remote do
|
6
|
+
describe 'when pianobar is running' do
|
7
|
+
describe 'commands' do
|
8
|
+
it 'should be able to execute a command' do
|
9
|
+
clean_up do
|
10
|
+
ctl_file do |file|
|
11
|
+
Candelabra::Pianobar.start
|
12
|
+
Candelabra::Remote.execute_command :pause
|
13
|
+
# file.read.must_equal 'p'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should be able to execute the pause command' do
|
19
|
+
clean_up do
|
20
|
+
ctl_file do |file|
|
21
|
+
Candelabra::Pianobar.start
|
22
|
+
Candelabra::Remote.pause
|
23
|
+
# file.read.must_equal 'p'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'when pianobar is NOT running' do
|
31
|
+
it 'should start pianobar' do
|
32
|
+
clean_up do
|
33
|
+
ctl_file do |file|
|
34
|
+
Candelabra::Pianobar.stop_all
|
35
|
+
Candelabra::Remote.execute_command(:pause)
|
36
|
+
Candelabra::Pianobar.running?.must_equal true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/runner_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
describe Candelabra::Runner do
|
2
|
+
after(:each) { Candelabra::Pianobar.stop_all }
|
3
|
+
|
4
|
+
describe 'entering commands at the command line' do
|
5
|
+
it 'should have a start command' do
|
6
|
+
starter = Candelabra::Runner.new(['start'])
|
7
|
+
starter.run
|
8
|
+
Candelabra::Pianobar.running?.must_equal true
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should be able to stop' do
|
12
|
+
Candelabra::Pianobar.start
|
13
|
+
Candelabra::Runner.new(['stop'])
|
14
|
+
Candelabra::Pianobar.running?.must_equal false
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: candelabra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
11
6
|
platform: ruby
|
12
7
|
authors: []
|
13
8
|
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-02-16 00:00:00 -06:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -24,13 +19,8 @@ dependencies:
|
|
24
19
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
20
|
none: false
|
26
21
|
requirements:
|
27
|
-
- -
|
22
|
+
- - ~>
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 23
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
34
24
|
version: 1.0.0
|
35
25
|
type: :development
|
36
26
|
version_requirements: *id001
|
@@ -42,47 +32,50 @@ dependencies:
|
|
42
32
|
requirements:
|
43
33
|
- - ">="
|
44
34
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 11
|
46
|
-
segments:
|
47
|
-
- 2
|
48
|
-
- 0
|
49
|
-
- 2
|
50
35
|
version: 2.0.2
|
51
36
|
type: :development
|
52
37
|
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: tomdoc
|
55
|
-
prerelease: false
|
56
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - "="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
hash: 27
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 1
|
65
|
-
- 0
|
66
|
-
version: 0.1.0
|
67
|
-
type: :development
|
68
|
-
version_requirements: *id003
|
69
38
|
description: initial wrapper for pianobar
|
70
39
|
email: []
|
71
40
|
|
72
|
-
executables:
|
73
|
-
|
41
|
+
executables:
|
42
|
+
- candelabra
|
74
43
|
extensions: []
|
75
44
|
|
76
45
|
extra_rdoc_files: []
|
77
46
|
|
78
47
|
files:
|
79
48
|
- .gitignore
|
49
|
+
- .rvmrc
|
80
50
|
- Gemfile
|
81
|
-
-
|
51
|
+
- Gemfile.lock
|
52
|
+
- README.md
|
82
53
|
- Rakefile
|
54
|
+
- bin/candelabra
|
83
55
|
- candelabra.gemspec
|
84
56
|
- lib/candelabra.rb
|
57
|
+
- lib/candelabra/configuration.rb
|
58
|
+
- lib/candelabra/event_cmd.rb
|
59
|
+
- lib/candelabra/extensions.rb
|
60
|
+
- lib/candelabra/installer.rb
|
61
|
+
- lib/candelabra/osx.rb
|
62
|
+
- lib/candelabra/pianobar.rb
|
63
|
+
- lib/candelabra/remote.rb
|
64
|
+
- lib/candelabra/runner.rb
|
65
|
+
- lib/candelabra/templates/config.erb
|
66
|
+
- lib/candelabra/templates/header.erb
|
67
|
+
- lib/candelabra/templates/setup_config_file.erb
|
68
|
+
- lib/candelabra/templates/what_is_installed.erb
|
69
|
+
- lib/candelabra/ubuntu.rb
|
85
70
|
- lib/candelabra/version.rb
|
71
|
+
- spec/candelabra_spec.rb
|
72
|
+
- spec/configuration_spec.rb
|
73
|
+
- spec/event_cmd_spec.rb
|
74
|
+
- spec/helper.rb
|
75
|
+
- spec/installer_spec.rb
|
76
|
+
- spec/pianobar_spec.rb
|
77
|
+
- spec/remote_spec.rb
|
78
|
+
- spec/runner_spec.rb
|
86
79
|
has_rdoc: true
|
87
80
|
homepage: http://rubygems.org/gems/candelabra
|
88
81
|
licenses: []
|
@@ -97,25 +90,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
90
|
requirements:
|
98
91
|
- - ">="
|
99
92
|
- !ruby/object:Gem::Version
|
100
|
-
hash: 3
|
101
|
-
segments:
|
102
|
-
- 0
|
103
93
|
version: "0"
|
104
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
95
|
none: false
|
106
96
|
requirements:
|
107
97
|
- - ">="
|
108
98
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 23
|
110
|
-
segments:
|
111
|
-
- 1
|
112
|
-
- 3
|
113
|
-
- 6
|
114
99
|
version: 1.3.6
|
115
100
|
requirements: []
|
116
101
|
|
117
102
|
rubyforge_project: candelabra
|
118
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 1.5.0
|
119
104
|
signing_key:
|
120
105
|
specification_version: 3
|
121
106
|
summary: Wrapper for pianobar
|
data/README
DELETED
File without changes
|