graphtunes 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/License.txt +20 -0
- data/Manifest.txt +20 -0
- data/README.txt +8 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +73 -0
- data/config/requirements.rb +15 -0
- data/lib/graphtunes/version.rb +9 -0
- data/lib/graphtunes.rb +108 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/setup.rb +1585 -0
- data/spec/graphtunes_spec.rb +518 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +23 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +9 -0
- metadata +77 -0
@@ -0,0 +1,518 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe Graphtunes do
|
4
|
+
it 'should process' do
|
5
|
+
Graphtunes.should respond_to(:process)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe 'processing' do
|
9
|
+
before :each do
|
10
|
+
@filename = 'blah'
|
11
|
+
@data = stub('imported data')
|
12
|
+
Graphtunes.stubs(:import).returns(@data)
|
13
|
+
Graphtunes.stubs(:graph)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should require a filename' do
|
17
|
+
lambda { Graphtunes.process }.should raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should accept a filename' do
|
21
|
+
lambda { Graphtunes.process(@filename) }.should_not raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should import data from the file' do
|
25
|
+
Graphtunes.expects(:import).with(@filename)
|
26
|
+
Graphtunes.process(@filename)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should graph the imported data' do
|
30
|
+
Graphtunes.expects(:graph).with(@data, anything)
|
31
|
+
Graphtunes.process(@filename)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should create an output filename that replaces the input filename's .xml extension with .png" do
|
35
|
+
@filename = 'testing.xml'
|
36
|
+
Graphtunes.expects(:graph).with(@data, 'testing.png')
|
37
|
+
Graphtunes.process(@filename)
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should create an output filename that appends .png to the input filename if it has no .xml extension" do
|
41
|
+
@filename = 'testblah'
|
42
|
+
Graphtunes.expects(:graph).with(@data, 'testblah.png')
|
43
|
+
Graphtunes.process(@filename)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should import data' do
|
48
|
+
Graphtunes.should respond_to(:import)
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'importing data' do
|
52
|
+
before :each do
|
53
|
+
@filename = 'blah'
|
54
|
+
File.stubs(:file?).returns(true)
|
55
|
+
@data = stub('file data')
|
56
|
+
File.stubs(:read).with(@filename).returns(@data)
|
57
|
+
Graphtunes.stubs(:get_track_list)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should require a filename' do
|
61
|
+
lambda { Graphtunes.import }.should raise_error(ArgumentError)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should accept a filename' do
|
65
|
+
lambda { Graphtunes.import(@filename) }.should_not raise_error(ArgumentError)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should require the argument to be a real file' do
|
69
|
+
File.stubs(:file?).with(@filename).returns(false)
|
70
|
+
lambda { Graphtunes.import(@filename) }.should raise_error(TypeError)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should require the argument to be a real file' do
|
74
|
+
File.stubs(:file?).with(@filename).returns(true)
|
75
|
+
lambda { Graphtunes.import(@filename) }.should_not raise_error(TypeError)
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should read the contents of the file' do
|
79
|
+
File.expects(:read).with(@filename)
|
80
|
+
Graphtunes.import(@filename)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should get the track list from the file' do
|
84
|
+
Graphtunes.expects(:get_track_list).with(@data)
|
85
|
+
Graphtunes.import(@filename)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should get the track list' do
|
90
|
+
Graphtunes.should respond_to(:get_track_list)
|
91
|
+
end
|
92
|
+
|
93
|
+
describe 'getting the track list' do
|
94
|
+
before :each do
|
95
|
+
@data = %q[
|
96
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
97
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
98
|
+
<plist version="1.0">
|
99
|
+
<dict>
|
100
|
+
<key>Major Version</key><integer>1</integer>
|
101
|
+
<key>Tracks</key>
|
102
|
+
<dict>
|
103
|
+
</dict>
|
104
|
+
</dict>
|
105
|
+
</plist>
|
106
|
+
]
|
107
|
+
@tracks = stub('tracks')
|
108
|
+
Graphtunes.stubs(:get_tracks).returns(@tracks)
|
109
|
+
@order = stub('order')
|
110
|
+
Graphtunes.stubs(:get_track_order).returns(@order)
|
111
|
+
Graphtunes.stubs(:order_tracks)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should require data' do
|
115
|
+
lambda { Graphtunes.get_track_list }.should raise_error(ArgumentError)
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should accept data' do
|
119
|
+
lambda { Graphtunes.get_track_list(@data) }.should_not raise_error(ArgumentError)
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should require there to be a notifier of track data' do
|
123
|
+
@data = %q[
|
124
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
125
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
126
|
+
<plist version="1.0">
|
127
|
+
<dict>
|
128
|
+
<key>Major Version</key><integer>1</integer>
|
129
|
+
</dict>
|
130
|
+
</plist>
|
131
|
+
]
|
132
|
+
lambda { Graphtunes.get_track_list(@data) }.should raise_error
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'should require there to be track data' do
|
136
|
+
@data = %q[
|
137
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
138
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
139
|
+
<plist version="1.0">
|
140
|
+
<dict>
|
141
|
+
<key>Major Version</key><integer>1</integer>
|
142
|
+
<key>Tracks</key>
|
143
|
+
</dict>
|
144
|
+
</plist>
|
145
|
+
]
|
146
|
+
lambda { Graphtunes.get_track_list(@data) }.should raise_error
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
it 'should accept data that includes track data' do
|
151
|
+
@data = %q[
|
152
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
153
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
154
|
+
<plist version="1.0">
|
155
|
+
<dict>
|
156
|
+
<key>Major Version</key><integer>1</integer>
|
157
|
+
<key>Tracks</key>
|
158
|
+
<dict>
|
159
|
+
</dict>
|
160
|
+
</dict>
|
161
|
+
</plist>
|
162
|
+
]
|
163
|
+
lambda { Graphtunes.get_track_list(@data) }.should_not raise_error
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'should get the tracks' do
|
167
|
+
Graphtunes.expects(:get_tracks) # NOTE: should make sure the right data is being passed
|
168
|
+
Graphtunes.get_track_list(@data)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'should get the track ordering' do
|
172
|
+
Graphtunes.expects(:get_track_order) # NOTE: should make sure the right data is being passed
|
173
|
+
Graphtunes.get_track_list(@data)
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'should order the tracks' do
|
177
|
+
Graphtunes.expects(:order_tracks).with(@tracks, @order)
|
178
|
+
Graphtunes.get_track_list(@data)
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should return the ordered tracks' do
|
182
|
+
ordered = stub('ordered tracks')
|
183
|
+
Graphtunes.stubs(:order_tracks).returns(ordered)
|
184
|
+
Graphtunes.get_track_list(@data).should == ordered
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should get tracks' do
|
189
|
+
Graphtunes.should respond_to(:get_tracks)
|
190
|
+
end
|
191
|
+
|
192
|
+
describe 'getting tracks' do
|
193
|
+
before :each do
|
194
|
+
@key = '1234'
|
195
|
+
input = %Q[
|
196
|
+
<dict>
|
197
|
+
<key>#{@key}</key>
|
198
|
+
<dict>
|
199
|
+
<key>Track ID</key><integer>#{@key}</integer>
|
200
|
+
</dict>
|
201
|
+
</dict>
|
202
|
+
]
|
203
|
+
@data = get_track_list(input)
|
204
|
+
Graphtunes.stubs(:extract_track_data)
|
205
|
+
end
|
206
|
+
|
207
|
+
def get_track_list(data)
|
208
|
+
REXML::Document.new(data).root
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'should require data' do
|
212
|
+
lambda { Graphtunes.get_tracks }.should raise_error(ArgumentError)
|
213
|
+
end
|
214
|
+
|
215
|
+
it 'should accept data' do
|
216
|
+
lambda { Graphtunes.get_tracks(@data) }.should_not raise_error(ArgumentError)
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'should extract track data' do
|
220
|
+
Graphtunes.expects(:extract_track_data) # NOTE: should make sure the right data is being passed
|
221
|
+
Graphtunes.get_tracks(@data)
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'should return the extracted track data' do
|
225
|
+
val = stub('extracted track data')
|
226
|
+
Graphtunes.expects(:extract_track_data).returns(val)
|
227
|
+
Graphtunes.get_tracks(@data)[@key].should == val
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should extract track data for each track' do
|
231
|
+
input = %q[
|
232
|
+
<dict>
|
233
|
+
<key>1234</key>
|
234
|
+
<dict>
|
235
|
+
<key>Track ID</key><integer>1234</integer>
|
236
|
+
</dict>
|
237
|
+
<key>12345</key>
|
238
|
+
<dict>
|
239
|
+
<key>Track ID</key><integer>12345</integer>
|
240
|
+
</dict>
|
241
|
+
</dict>
|
242
|
+
]
|
243
|
+
@data = get_track_list(input)
|
244
|
+
Graphtunes.expects(:extract_track_data).times(2) # NOTE: should make sure the right data is being passed
|
245
|
+
Graphtunes.get_tracks(@data)
|
246
|
+
end
|
247
|
+
|
248
|
+
it 'should not extract track data if there are no tracks' do
|
249
|
+
input = %q[
|
250
|
+
<dict>
|
251
|
+
</dict>
|
252
|
+
]
|
253
|
+
@data = get_track_list(input)
|
254
|
+
Graphtunes.expects(:extract_track_data).never
|
255
|
+
Graphtunes.get_tracks(@data)
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'should extract track data' do
|
260
|
+
Graphtunes.should respond_to(:extract_track_data)
|
261
|
+
end
|
262
|
+
|
263
|
+
describe 'extracting track data' do
|
264
|
+
before :each do
|
265
|
+
@id = '1234'
|
266
|
+
@name = 'track name'
|
267
|
+
@artist = 'track artist'
|
268
|
+
@album = 'track album'
|
269
|
+
@bpm = 50
|
270
|
+
|
271
|
+
input = %Q[
|
272
|
+
<dict>
|
273
|
+
<key>Track ID</key><integer>#{@id}</integer>
|
274
|
+
<key>Name</key><string>#{@name}</string>
|
275
|
+
<key>Artist</key><string>#{@artist}</string>
|
276
|
+
<key>Album</key><string>#{@album}</string>
|
277
|
+
<key>BPM</key><integer>#{@bpm}</integer>
|
278
|
+
</dict>
|
279
|
+
]
|
280
|
+
@data = get_track_data(input)
|
281
|
+
end
|
282
|
+
|
283
|
+
def get_track_data(data)
|
284
|
+
REXML::Document.new(data).root
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'should require data' do
|
288
|
+
lambda { Graphtunes.extract_track_data }.should raise_error(ArgumentError)
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'should accept data' do
|
292
|
+
lambda { Graphtunes.extract_track_data(@data) }.should_not raise_error(ArgumentError)
|
293
|
+
end
|
294
|
+
|
295
|
+
it 'should extract the track ID if present' do
|
296
|
+
Graphtunes.extract_track_data(@data)['Track ID'].should == @id
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'should not bother with the track ID if absent' do
|
300
|
+
input = %Q[
|
301
|
+
<dict>
|
302
|
+
<key>Name</key><string>#{@name}</string>
|
303
|
+
<key>Artist</key><string>#{@artist}</string>
|
304
|
+
<key>Album</key><string>#{@album}</string>
|
305
|
+
<key>BPM</key><integer>#{@bpm}</integer>
|
306
|
+
</dict>
|
307
|
+
]
|
308
|
+
@data = get_track_data(input)
|
309
|
+
Graphtunes.extract_track_data(@data).should_not include('Track ID')
|
310
|
+
end
|
311
|
+
|
312
|
+
it 'should extract the track name if present' do
|
313
|
+
Graphtunes.extract_track_data(@data)['Name'].should == @name
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should not bother with the track name if absent' do
|
317
|
+
input = %Q[
|
318
|
+
<dict>
|
319
|
+
<key>Track ID</key><integer>#{@id}</integer>
|
320
|
+
<key>Artist</key><string>#{@artist}</string>
|
321
|
+
<key>Album</key><string>#{@album}</string>
|
322
|
+
<key>BPM</key><integer>#{@bpm}</integer>
|
323
|
+
</dict>
|
324
|
+
]
|
325
|
+
@data = get_track_data(input)
|
326
|
+
Graphtunes.extract_track_data(@data).should_not include('Name')
|
327
|
+
end
|
328
|
+
|
329
|
+
it 'should extract the track artist if present' do
|
330
|
+
Graphtunes.extract_track_data(@data)['Artist'].should == @artist
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'should not bother with the track artist if absent' do
|
334
|
+
input = %Q[
|
335
|
+
<dict>
|
336
|
+
<key>Track ID</key><integer>#{@id}</integer>
|
337
|
+
<key>Name</key><string>#{@name}</string>
|
338
|
+
<key>Album</key><string>#{@album}</string>
|
339
|
+
<key>BPM</key><integer>#{@bpm}</integer>
|
340
|
+
</dict>
|
341
|
+
]
|
342
|
+
@data = get_track_data(input)
|
343
|
+
Graphtunes.extract_track_data(@data).should_not include('Artist')
|
344
|
+
end
|
345
|
+
|
346
|
+
it 'should extract the track album if present' do
|
347
|
+
Graphtunes.extract_track_data(@data)['Album'].should == @album
|
348
|
+
end
|
349
|
+
|
350
|
+
it 'should not bother with the track album if absent' do
|
351
|
+
input = %Q[
|
352
|
+
<dict>
|
353
|
+
<key>Track ID</key><integer>#{@id}</integer>
|
354
|
+
<key>Name</key><string>#{@name}</string>
|
355
|
+
<key>Artist</key><string>#{@artist}</string>
|
356
|
+
<key>BPM</key><integer>#{@bpm}</integer>
|
357
|
+
</dict>
|
358
|
+
]
|
359
|
+
@data = get_track_data(input)
|
360
|
+
Graphtunes.extract_track_data(@data).should_not include('Album')
|
361
|
+
end
|
362
|
+
|
363
|
+
it 'should extract the track BPM if present' do
|
364
|
+
Graphtunes.extract_track_data(@data)['BPM'].should == @bpm
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'should not bother with the track BPM if absent' do
|
368
|
+
input = %Q[
|
369
|
+
<dict>
|
370
|
+
<key>Track ID</key><integer>#{@id}</integer>
|
371
|
+
<key>Name</key><string>#{@name}</string>
|
372
|
+
<key>Artist</key><string>#{@artist}</string>
|
373
|
+
<key>Album</key><string>#{@album}</string>
|
374
|
+
</dict>
|
375
|
+
]
|
376
|
+
@data = get_track_data(input)
|
377
|
+
Graphtunes.extract_track_data(@data).should_not include('BPM')
|
378
|
+
end
|
379
|
+
end
|
380
|
+
|
381
|
+
it 'should get the track ordering' do
|
382
|
+
Graphtunes.should respond_to(:get_track_order)
|
383
|
+
end
|
384
|
+
|
385
|
+
describe 'getting the track order' do
|
386
|
+
before :each do
|
387
|
+
input = %q[
|
388
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
389
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
390
|
+
<plist version="1.0">
|
391
|
+
<dict>
|
392
|
+
<key>Tracks</key>
|
393
|
+
<dict>
|
394
|
+
</dict>
|
395
|
+
<key>Playlists</key>
|
396
|
+
<array>
|
397
|
+
<dict>
|
398
|
+
<key>Name</key><string>Some Playlist</string>
|
399
|
+
<key>Playlist Items</key>
|
400
|
+
<array>
|
401
|
+
<dict>
|
402
|
+
<key>Track ID</key><integer>1234</integer>
|
403
|
+
</dict>
|
404
|
+
<dict>
|
405
|
+
<key>Track ID</key><integer>12345</integer>
|
406
|
+
</dict>
|
407
|
+
<dict>
|
408
|
+
<key>Track ID</key><integer>123</integer>
|
409
|
+
</dict>
|
410
|
+
</array>
|
411
|
+
</dict>
|
412
|
+
</array>
|
413
|
+
</dict>
|
414
|
+
</plist>
|
415
|
+
]
|
416
|
+
@data = REXML::Document.new(input)
|
417
|
+
end
|
418
|
+
|
419
|
+
it 'should require data' do
|
420
|
+
lambda { Graphtunes.get_track_order }.should raise_error(ArgumentError)
|
421
|
+
end
|
422
|
+
|
423
|
+
it 'should accept data' do
|
424
|
+
lambda { Graphtunes.get_track_order(@data) }.should_not raise_error(ArgumentError)
|
425
|
+
end
|
426
|
+
|
427
|
+
it 'should return the order' do
|
428
|
+
Graphtunes.get_track_order(@data).should == ['1234', '12345', '123']
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
it 'should order the tracks' do
|
433
|
+
Graphtunes.should respond_to(:order_tracks)
|
434
|
+
end
|
435
|
+
|
436
|
+
describe 'ordering tracks' do
|
437
|
+
before :each do
|
438
|
+
@vals = Array.new(6) { |i| stub("track #{i}") }
|
439
|
+
@tracks = {}
|
440
|
+
1.upto(5) do |i|
|
441
|
+
@tracks[i.to_s] = @vals[i]
|
442
|
+
end
|
443
|
+
@order = ['5', '3', '2', '4', '1']
|
444
|
+
end
|
445
|
+
|
446
|
+
it 'should require tracks' do
|
447
|
+
lambda { Graphtunes.order_tracks }.should raise_error(ArgumentError)
|
448
|
+
end
|
449
|
+
|
450
|
+
it 'should require order' do
|
451
|
+
lambda { Graphtunes.order_tracks(@tracks) }.should raise_error(ArgumentError)
|
452
|
+
end
|
453
|
+
|
454
|
+
it 'should accept tracks and order' do
|
455
|
+
lambda { Graphtunes.order_tracks(@tracks, @order) }.should_not raise_error(ArgumentError)
|
456
|
+
end
|
457
|
+
|
458
|
+
it 'should return the tracks in the specified order' do
|
459
|
+
Graphtunes.order_tracks(@tracks, @order).should == @vals.values_at(5,3,2,4,1)
|
460
|
+
end
|
461
|
+
end
|
462
|
+
|
463
|
+
it 'should graph the data' do
|
464
|
+
Graphtunes.should respond_to(:graph)
|
465
|
+
end
|
466
|
+
|
467
|
+
describe 'graphing the data' do
|
468
|
+
before :each do
|
469
|
+
@data = [
|
470
|
+
{ 'BPM' => 5 },
|
471
|
+
{ 'BPM' => 4 },
|
472
|
+
{ 'BPM' => 6 },
|
473
|
+
{ 'BPM' => 1 },
|
474
|
+
{ 'BPM' => 2 }
|
475
|
+
]
|
476
|
+
@filename = 'outfile.png'
|
477
|
+
@graph = stub('graph', :data => nil, :hide_dots= => nil, :write => nil)
|
478
|
+
Gruff::Line.stubs(:new).returns(@graph)
|
479
|
+
end
|
480
|
+
|
481
|
+
it 'should require data' do
|
482
|
+
lambda { Graphtunes.graph }.should raise_error(ArgumentError)
|
483
|
+
end
|
484
|
+
|
485
|
+
it 'should require a filename' do
|
486
|
+
lambda { Graphtunes.graph(@data) }.should raise_error(ArgumentError)
|
487
|
+
end
|
488
|
+
|
489
|
+
it 'should accept data and a filename' do
|
490
|
+
lambda { Graphtunes.graph(@data, @filename) }.should_not raise_error(ArgumentError)
|
491
|
+
end
|
492
|
+
|
493
|
+
it 'should create a line graph' do
|
494
|
+
Gruff::Line.expects(:new).returns(@graph)
|
495
|
+
Graphtunes.graph(@data, @filename)
|
496
|
+
end
|
497
|
+
|
498
|
+
it 'should create a line for the BPMs' do
|
499
|
+
@graph.expects(:data).with('BPM', [5, 4, 6, 1, 2])
|
500
|
+
Graphtunes.graph(@data, @filename)
|
501
|
+
end
|
502
|
+
|
503
|
+
it 'should hide dots' do
|
504
|
+
@graph.expects(:hide_dots=).with(true)
|
505
|
+
Graphtunes.graph(@data, @filename)
|
506
|
+
end
|
507
|
+
|
508
|
+
it 'should output the graph' do
|
509
|
+
@graph.expects(:write)
|
510
|
+
Graphtunes.graph(@data, @filename)
|
511
|
+
end
|
512
|
+
|
513
|
+
it 'should use the supplied filename for graph output' do
|
514
|
+
@graph.expects(:write).with(@filename)
|
515
|
+
Graphtunes.graph(@data, @filename)
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
# this is my favorite way to require ever
|
10
|
+
begin
|
11
|
+
require 'mocha'
|
12
|
+
rescue LoadError
|
13
|
+
require 'rubygems'
|
14
|
+
gem 'mocha'
|
15
|
+
require 'mocha'
|
16
|
+
end
|
17
|
+
|
18
|
+
Spec::Runner.configure do |config|
|
19
|
+
config.mock_with :mocha
|
20
|
+
end
|
21
|
+
|
22
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
23
|
+
require 'graphtunes'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
desc 'Release the website and new gem version'
|
2
|
+
task :deploy => [:check_version, :website, :release] do
|
3
|
+
puts "Remember to create SVN tag:"
|
4
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
puts "Suggested comment:"
|
7
|
+
puts "Tagging release #{CHANGES}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
+
task :local_deploy => [:website_generate, :install_gem]
|
12
|
+
|
13
|
+
task :check_version do
|
14
|
+
unless ENV['VERSION']
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
unless ENV['VERSION'] == VERS
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :manifest do
|
30
|
+
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
+
task :refresh do
|
32
|
+
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
+
end
|
34
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
end
|
data/tasks/website.rake
ADDED
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: graphtunes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yossef Mendelssohn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-03 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: for visualization of music playlist data
|
17
|
+
email:
|
18
|
+
- ymendel@pobox.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- History.txt
|
25
|
+
- License.txt
|
26
|
+
- Manifest.txt
|
27
|
+
- README.txt
|
28
|
+
files:
|
29
|
+
- History.txt
|
30
|
+
- License.txt
|
31
|
+
- Manifest.txt
|
32
|
+
- README.txt
|
33
|
+
- Rakefile
|
34
|
+
- config/hoe.rb
|
35
|
+
- config/requirements.rb
|
36
|
+
- lib/graphtunes.rb
|
37
|
+
- lib/graphtunes/version.rb
|
38
|
+
- script/console
|
39
|
+
- script/destroy
|
40
|
+
- script/generate
|
41
|
+
- setup.rb
|
42
|
+
- spec/graphtunes_spec.rb
|
43
|
+
- spec/spec.opts
|
44
|
+
- spec/spec_helper.rb
|
45
|
+
- tasks/deployment.rake
|
46
|
+
- tasks/environment.rake
|
47
|
+
- tasks/rspec.rake
|
48
|
+
- tasks/website.rake
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://yomendel.rubyforge.org
|
51
|
+
post_install_message: ""
|
52
|
+
rdoc_options:
|
53
|
+
- --main
|
54
|
+
- README.txt
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project: yomendel
|
72
|
+
rubygems_version: 1.1.1
|
73
|
+
signing_key:
|
74
|
+
specification_version: 2
|
75
|
+
summary: for visualization of music playlist data
|
76
|
+
test_files: []
|
77
|
+
|