graphtunes 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.2 2008-05-05
2
+
3
+ * 1 major enhancement:
4
+ * Command created (woops!)
5
+
1
6
  == 0.0.1 2008-05-03
2
7
 
3
8
  * 1 major enhancement:
data/Manifest.txt CHANGED
@@ -3,6 +3,7 @@ License.txt
3
3
  Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
+ bin/graphtunes
6
7
  config/hoe.rb
7
8
  config/requirements.rb
8
9
  lib/graphtunes.rb
@@ -11,6 +12,7 @@ script/console
11
12
  script/destroy
12
13
  script/generate
13
14
  setup.rb
15
+ spec/graphtunes_command_spec.rb
14
16
  spec/graphtunes_spec.rb
15
17
  spec/spec.opts
16
18
  spec/spec_helper.rb
data/README.txt CHANGED
@@ -1,6 +1,12 @@
1
1
  graphtunes is for visualization of music playlist data
2
2
 
3
- At the moment, it only makes a line graph of the BPM data for a playlist, and it expects as input an XML-exported iTunes playlist[1].
3
+ At the moment, it only makes a line graph of the BPM data for a playlist, and it expects as input an XML-exported iTunes playlist[1].
4
+
5
+ Running it as
6
+
7
+ graphtunes playlist.xml
8
+
9
+ will output a graph to 'playlist.png'. It's as simple as that.
4
10
 
5
11
  It uses REXML to parse the playlist (stdlib, yay) and gruff for the graphing (enjoy installing RMagick and friends if you haven't already).
6
12
 
data/bin/graphtunes ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2008-5-5.
4
+ # Copyright (c) 2008. All rights reserved.
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ # no rubygems to load, so we fail silently
10
+ end
11
+
12
+ require 'optparse'
13
+ require 'graphtunes'
14
+
15
+ # NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
16
+
17
+ OPTIONS = {}
18
+ MANDATORY_OPTIONS = %w[]
19
+
20
+ parser = OptionParser.new do |opts|
21
+ opts.banner = <<BANNER
22
+ Usage: #{File.basename($0)} [filename]
23
+
24
+ Options are:
25
+ BANNER
26
+ opts.separator ''
27
+ opts.on('-v', '--version',
28
+ "Show the #{File.basename($0)} version number and exit") { puts "graphtunes #{Graphtunes::VERSION::STRING}"; exit }
29
+ opts.on('-h', '--help',
30
+ 'Show this help message.') { puts opts; exit }
31
+ opts.parse!(ARGV)
32
+
33
+ if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
34
+ puts opts; exit
35
+ end
36
+ end
37
+
38
+ # do stuff
39
+ filename = ARGV[0]
40
+
41
+ unless filename
42
+ puts "Usage: #{File.basename($0)} [filename]"
43
+ exit
44
+ end
45
+
46
+ Graphtunes.process(filename)
@@ -2,7 +2,7 @@ module Graphtunes #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe 'graphtunes command' do
4
+ def run_command(*args)
5
+ Object.const_set(:ARGV, args)
6
+ begin
7
+ eval File.read(File.join(File.dirname(__FILE__), *%w[.. bin graphtunes]))
8
+ rescue SystemExit
9
+ end
10
+ end
11
+
12
+ before :all do
13
+ path = File.join(File.dirname(__FILE__), *%w[.. bin])
14
+ ENV['PATH'] = [path, ENV['PATH']].join(':')
15
+ end
16
+
17
+ before :each do
18
+ Graphtunes.stubs(:process)
19
+ end
20
+
21
+ it 'should exist' do
22
+ lambda { run_command('blah') }.should_not raise_error(Errno::ENOENT)
23
+ end
24
+
25
+ it 'should require a filename' do
26
+ self.expects(:puts) { |text| text.match(/usage.+filename/i) }
27
+ run_command
28
+ end
29
+
30
+ it 'should pass the filename to Graphtunes for processing' do
31
+ Graphtunes.expects(:process).with('blah')
32
+ run_command('blah')
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphtunes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yossef Mendelssohn
@@ -9,15 +9,15 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-05-03 00:00:00 -05:00
12
+ date: 2008-05-05 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
16
  description: for visualization of music playlist data
17
17
  email:
18
18
  - ymendel@pobox.com
19
- executables: []
20
-
19
+ executables:
20
+ - graphtunes
21
21
  extensions: []
22
22
 
23
23
  extra_rdoc_files:
@@ -31,6 +31,7 @@ files:
31
31
  - Manifest.txt
32
32
  - README.txt
33
33
  - Rakefile
34
+ - bin/graphtunes
34
35
  - config/hoe.rb
35
36
  - config/requirements.rb
36
37
  - lib/graphtunes.rb
@@ -39,6 +40,7 @@ files:
39
40
  - script/destroy
40
41
  - script/generate
41
42
  - setup.rb
43
+ - spec/graphtunes_command_spec.rb
42
44
  - spec/graphtunes_spec.rb
43
45
  - spec/spec.opts
44
46
  - spec/spec_helper.rb