jimmy_jukebox 0.3.7 → 0.4.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/spec/song_spec.rb CHANGED
@@ -35,25 +35,25 @@ describe Song do
35
35
 
36
36
  end
37
37
 
38
- describe "#paused" do
38
+ describe "#paused?" do
39
39
 
40
40
  before(:each) do
41
41
  @song = Song.new("~/Music/JAZZ/art_tatum.mp3")
42
42
  end
43
43
 
44
44
  it "is initially not paused" do
45
- @song.paused.should be_false
45
+ @song.paused?.should be_false
46
46
  end
47
47
 
48
48
  it "is paused after calling #pause" do
49
49
  @song.pause
50
- @song.paused.should be_true
50
+ @song.paused?.should be_true
51
51
  end
52
52
 
53
53
  it "is unpaused after calling #pause and #unpause" do
54
54
  @song.pause
55
55
  @song.unpause
56
- @song.paused.should be_false
56
+ @song.paused?.should be_false
57
57
  end
58
58
 
59
59
  end
data/spec/spec_helper.rb CHANGED
@@ -4,14 +4,38 @@ RSpec.configure do |config|
4
4
  end
5
5
  end
6
6
 
7
- # Override exec() to prevent songs from actually playing
8
- # Instead, start a brief sleep process
9
- module Kernel
10
- alias :real_exec :exec
7
+ require 'fakefs/spec_helpers'
8
+
9
+ # Overriding FakeFS' File.expand_path
10
+ # because it delegates to the same class
11
+ # method in the REAL file system
12
+ module FakeFS
13
+ class File
14
+ def self.expand_path(*args)
15
+ args[0].gsub(/~/,'/home/xavier')
16
+ end
17
+ end
18
+ # Started overriding FileUtils.ln because FakeFS doesn't know about it
19
+ # Instead switched to using File.link, which FakeFS knows about
20
+ end
11
21
 
12
- def exec(*cmd)
13
- real_exec("sleep 0.2")
22
+ # Overriding File.expand_path
23
+ # so it will provide the fake user's
24
+ # home directory
25
+ class File
26
+ def self.expand_path(*args)
27
+ args[0].gsub(/~/,'/home/xavier')
14
28
  end
15
29
  end
16
30
 
31
+ # Override exec() to prevent songs from actually playing
32
+ # Instead, start a brief sleep process
33
+ #module Kernel
34
+ # alias :real_exec :exec
35
+ #
36
+ # def exec(*cmd)
37
+ # real_exec("sleep 0.2")
38
+ # end
39
+ #end
40
+
17
41
 
@@ -1,14 +1,13 @@
1
1
  require 'spec_helper'
2
- require 'fakefs/safe'
3
2
  require File.dirname(__FILE__) + '/../lib/jimmy_jukebox/user_config'
4
3
  include JimmyJukebox
5
4
 
6
5
  describe UserConfig do
7
6
 
7
+ include FakeFS::SpecHelpers
8
+
8
9
  before(:all) do
9
- #ARGV.delete_if { |val| true }
10
10
  ARGV.clear
11
- #ARGV.pop
12
11
  end
13
12
 
14
13
  #describe "#configure_preferences" do
@@ -28,23 +27,23 @@ describe UserConfig do
28
27
  describe "#top_music_dir" do
29
28
 
30
29
  it "should parse '~/Music'" do
31
- UserConfig.top_music_dir("~/Music").should == "/home/james/Music"
30
+ UserConfig.top_music_dir("~/Music").should == "/home/xavier/Music"
32
31
  end
33
32
 
34
- it "should parse '/home/james/Music'" do
35
- UserConfig.top_music_dir("/home/james/Music").should == "/home/james/Music"
33
+ it "should parse '/home/xavier/Music'" do
34
+ UserConfig.top_music_dir("/home/xavier/Music").should == "/home/xavier/Music"
36
35
  end
37
36
 
38
37
  it "should parse '~/Music/Rock/The_Eagles/hotel_california.mp3'" do
39
- UserConfig.top_music_dir("~/Music/Rock/The_Eagles/hotel_california.mp3").should == "/home/james/Music"
38
+ UserConfig.top_music_dir("~/Music/Rock/The_Eagles/hotel_california.mp3").should == "/home/xavier/Music"
40
39
  end
41
40
 
42
41
  it "should parse '~/Music/Rock/The Eagles/Hotel California.mp3'" do
43
- UserConfig.top_music_dir("~/Music/Rock/The Eagles/Hotel California.mp3").should == "/home/james/Music"
42
+ UserConfig.top_music_dir("~/Music/Rock/The Eagles/Hotel California.mp3").should == "/home/xavier/Music"
44
43
  end
45
44
 
46
45
  it "should parse '~/My Music'" do
47
- UserConfig.top_music_dir("~/My Music").should == "/home/james/My Music"
46
+ UserConfig.top_music_dir("~/My Music").should == "/home/xavier/My Music"
48
47
  end
49
48
 
50
49
  end
@@ -55,8 +54,31 @@ describe UserConfig do
55
54
  ARGV.delete_if { |val| true }
56
55
  end
57
56
 
57
+ let(:uc) { UserConfig.new }
58
+
59
+ context "with no songs" do
60
+
61
+ it "finds no songs" do
62
+ uc.songs.length.should == 0
63
+ end
64
+
65
+ end
66
+
67
+ context "with songs" do
68
+
69
+ before do
70
+ FileUtils.mkdir_p "/home/xavier/Music"
71
+ FileUtils.touch "/home/xavier/Music/Yellow_Submarine.mp3"
72
+ end
73
+
74
+ it "finds songs" do
75
+ uc.songs.should_not be_empty
76
+ uc.songs.length.should == 1
77
+ end
78
+
79
+ end
80
+
58
81
  it "does not complain when ogg123 & mpg123 both installed" do
59
- uc = UserConfig.new
60
82
  uc.should_receive(:`).with("which ogg123").and_return("/usr/bin/ogg123")
61
83
  uc.should_receive(:`).with("which mpg123").and_return("/usr/bin/mpg123")
62
84
  uc.should_not_receive(:puts)
@@ -66,7 +88,6 @@ describe UserConfig do
66
88
  end
67
89
 
68
90
  it "does not complain when ogg123 & mpg321 both installed but not mpg123" do
69
- uc = UserConfig.new
70
91
  uc.should_receive(:`).with("which ogg123").and_return("/usr/bin/ogg123")
71
92
  uc.should_receive(:`).with("which mpg123").and_return("")
72
93
  uc.should_receive(:`).with("which mpg321").and_return("/usr/bin/mpg321")
@@ -77,7 +98,6 @@ describe UserConfig do
77
98
  end
78
99
 
79
100
  it "complains when ogg123 installed but mpg123, mpg321, music123, afplay & play not installed" do
80
- uc = UserConfig.new
81
101
  uc.instance_variable_set(:@ogg_player, nil)
82
102
  uc.instance_variable_set(:@mp3_player, nil)
83
103
  uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("/usr/bin/ogg123")
@@ -94,7 +114,6 @@ describe UserConfig do
94
114
  end
95
115
 
96
116
  it "complains when mpg123 installed but ogg123, mpg321, music123, afplay & play not installed" do
97
- uc = UserConfig.new
98
117
  uc.instance_variable_set(:@ogg_player, nil)
99
118
  uc.instance_variable_set(:@mp3_player, nil)
100
119
  uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("")
@@ -110,7 +129,6 @@ describe UserConfig do
110
129
  end
111
130
 
112
131
  it "complains when mpg321 installed but mpg123, music123, ogg123, afplay & play not installed" do
113
- uc = UserConfig.new
114
132
  uc.instance_variable_set(:@ogg_player, nil)
115
133
  uc.instance_variable_set(:@mp3_player, nil)
116
134
  uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("")
@@ -127,7 +145,6 @@ describe UserConfig do
127
145
  end
128
146
 
129
147
  it "prints message and exits when mpg123, mpg321, ogg123, music123, afplay & play all not installed" do
130
- uc = UserConfig.new
131
148
  uc.instance_variable_set(:@ogg_player, nil)
132
149
  uc.instance_variable_set(:@mp3_player, nil)
133
150
  uc.should_receive(:`).at_least(:once).with("which ogg123").and_return("")
metadata CHANGED
@@ -1,120 +1,129 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jimmy_jukebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
5
- prerelease:
4
+ prerelease:
5
+ version: 0.4.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Lavin
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-08 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
16
+ version_requirements: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - ! '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
20
+ version: !binary |-
21
+ MA==
25
22
  none: false
23
+ requirement: !ruby/object:Gem::Requirement
26
24
  requirements:
27
- - - ! '>='
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- version: '0'
27
+ version: !binary |-
28
+ MA==
29
+ none: false
30
+ prerelease: false
31
+ type: :development
30
32
  - !ruby/object:Gem::Dependency
31
33
  name: rspec-core
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
+ version_requirements: !ruby/object:Gem::Requirement
34
35
  requirements:
35
- - - ! '>='
36
+ - - ">="
36
37
  - !ruby/object:Gem::Version
37
- version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
38
+ version: !binary |-
39
+ MA==
41
40
  none: false
41
+ requirement: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - ! '>='
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: !binary |-
46
+ MA==
47
+ none: false
48
+ prerelease: false
49
+ type: :development
46
50
  - !ruby/object:Gem::Dependency
47
51
  name: rspec-mocks
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
52
+ version_requirements: !ruby/object:Gem::Requirement
50
53
  requirements:
51
- - - ! '>='
54
+ - - ">="
52
55
  - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
56
+ version: !binary |-
57
+ MA==
57
58
  none: false
59
+ requirement: !ruby/object:Gem::Requirement
58
60
  requirements:
59
- - - ! '>='
61
+ - - ">="
60
62
  - !ruby/object:Gem::Version
61
- version: '0'
63
+ version: !binary |-
64
+ MA==
65
+ none: false
66
+ prerelease: false
67
+ type: :development
62
68
  - !ruby/object:Gem::Dependency
63
69
  name: rspec-expectations
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
70
+ version_requirements: !ruby/object:Gem::Requirement
66
71
  requirements:
67
- - - ! '>='
72
+ - - ">="
68
73
  - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :development
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
74
+ version: !binary |-
75
+ MA==
73
76
  none: false
77
+ requirement: !ruby/object:Gem::Requirement
74
78
  requirements:
75
- - - ! '>='
79
+ - - ">="
76
80
  - !ruby/object:Gem::Version
77
- version: '0'
81
+ version: !binary |-
82
+ MA==
83
+ none: false
84
+ prerelease: false
85
+ type: :development
78
86
  - !ruby/object:Gem::Dependency
79
87
  name: fakefs
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
88
+ version_requirements: !ruby/object:Gem::Requirement
82
89
  requirements:
83
- - - ! '>='
90
+ - - ">="
84
91
  - !ruby/object:Gem::Version
85
- version: '0'
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
92
+ version: !binary |-
93
+ MA==
89
94
  none: false
95
+ requirement: !ruby/object:Gem::Requirement
90
96
  requirements:
91
- - - ! '>='
97
+ - - ">="
92
98
  - !ruby/object:Gem::Version
93
- version: '0'
99
+ version: !binary |-
100
+ MA==
101
+ none: false
102
+ prerelease: false
103
+ type: :development
94
104
  - !ruby/object:Gem::Dependency
95
105
  name: fakeweb
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
106
+ version_requirements: !ruby/object:Gem::Requirement
98
107
  requirements:
99
- - - ! '>='
108
+ - - ">="
100
109
  - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
110
+ version: !binary |-
111
+ MA==
105
112
  none: false
113
+ requirement: !ruby/object:Gem::Requirement
106
114
  requirements:
107
- - - ! '>='
115
+ - - ">="
108
116
  - !ruby/object:Gem::Version
109
- version: '0'
110
- description: jimmy_jukebox plays random MP3 & OGG songs under a directory (or set
111
- of directories) and can download music
117
+ version: !binary |-
118
+ MA==
119
+ none: false
120
+ prerelease: false
121
+ type: :development
122
+ description: jimmy_jukebox plays random MP3 & OGG songs under a directory (or set of directories) and can download music
112
123
  email: james@jameslavin.com
113
124
  executables:
114
125
  - play_jukebox
115
126
  - load_jukebox
116
- - jplay_jukebox
117
- - jload_jukebox
118
127
  extensions: []
119
128
  extra_rdoc_files: []
120
129
  files:
@@ -137,6 +146,7 @@ files:
137
146
  - lib/jimmy_jukebox/songs/ColemanHawkins.yml
138
147
  - lib/jimmy_jukebox/songs/KingOliver.yml
139
148
  - lib/jimmy_jukebox/songs/OriginalDixielandJazzBand.yml
149
+ - lib/jimmy_jukebox/songs/Dixieland.yml
140
150
  - lib/jimmy_jukebox/songs/LouisArmstrong.yml
141
151
  - lib/jimmy_jukebox/songs/DjangoReinhardt.yml
142
152
  - lib/jimmy_jukebox/songs/RedNorvo.yml
@@ -145,13 +155,16 @@ files:
145
155
  - lib/jimmy_jukebox/songs/BixBeiderbecke.yml
146
156
  - lib/jimmy_jukebox/songs/ArtieShaw.yml
147
157
  - lib/jimmy_jukebox/songs/MilesDavis.yml
158
+ - lib/jimmy_jukebox/songs/CliffordHayesJugBlowers.yml
148
159
  - lib/jimmy_jukebox/songs/DizzyGillespie.yml
149
160
  - lib/jimmy_jukebox/songs/DukeEllington.yml
150
161
  - lib/jimmy_jukebox/songs/BennyGoodman.yml
151
162
  - lib/jimmy_jukebox/songs/CountBasie.yml
163
+ - lib/jimmy_jukebox/songs/ArchibaldCampBanjo.yml
152
164
  - lib/jimmy_jukebox/songs/SidneyBechet.yml
153
165
  - lib/jimmy_jukebox/songs/JamesPJohnson.yml
154
166
  - lib/jimmy_jukebox/songs/JellyRollMorton.yml
167
+ - lib/jimmy_jukebox/songs/Ragtime.yml
155
168
  - lib/jimmy_jukebox/songs/EarlHines.yml
156
169
  - spec/jimmy_jukebox_spec.rb
157
170
  - spec/song_loader_spec.rb
@@ -160,31 +173,30 @@ files:
160
173
  - spec/spec_helper.rb
161
174
  - bin/play_jukebox
162
175
  - bin/load_jukebox
163
- - bin/jplay_jukebox
164
- - bin/jload_jukebox
165
176
  homepage: https://github.com/JamesLavin/jimmy_jukebox
166
177
  licenses: []
167
- post_install_message: I really hope you enjoy the great jazz downloadable using this
168
- gem!
178
+ post_install_message: I really hope you enjoy the great jazz downloadable using this gem!
169
179
  rdoc_options: []
170
180
  require_paths:
171
181
  - lib
172
182
  required_ruby_version: !ruby/object:Gem::Requirement
173
- none: false
174
183
  requirements:
175
- - - ! '>='
184
+ - - ">="
176
185
  - !ruby/object:Gem::Version
177
- version: '0'
178
- required_rubygems_version: !ruby/object:Gem::Requirement
186
+ version: !binary |-
187
+ MA==
179
188
  none: false
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
190
  requirements:
181
- - - ! '>='
191
+ - - ">="
182
192
  - !ruby/object:Gem::Version
183
- version: '0'
193
+ version: !binary |-
194
+ MA==
195
+ none: false
184
196
  requirements: []
185
197
  rubyforge_project: jimmy_jukebox
186
- rubygems_version: 1.8.23
187
- signing_key:
198
+ rubygems_version: 1.8.24
199
+ signing_key:
188
200
  specification_version: 3
189
201
  summary: plays your MP3 & OGG files and lets you easily download music
190
202
  test_files:
data/bin/jload_jukebox DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env jruby
2
-
3
- require File.dirname(__FILE__) + '/../lib/jimmy_jukebox/load_jukebox_code.rb'
data/bin/jplay_jukebox DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env jruby
2
-
3
- begin
4
- require 'readline'
5
- require 'spoon'
6
- rescue LoadError => e
7
- raise unless e.message =~ /readline|spoon/
8
- puts "*** You must install the 'spoon' gem to use JimmyJukebox on JRuby ***"
9
- exit
10
- end
11
-
12
- lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
13
- $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
14
- require 'jimmy_jukebox'
15
- include JimmyJukebox
16
-