sweeper 0.3 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v0.3.1. Fix some annoying Windows bugs.
3
+
2
4
  v0.3. Pure Ruby Levenshtein algorithm, for Windows support.
3
5
 
4
6
  v0.2.4. More robust XSD error handling.
data/Manifest CHANGED
@@ -2,6 +2,7 @@ bin/sweeper
2
2
  CHANGELOG
3
3
  ext/extconf.rb
4
4
  ext/Makefile
5
+ ext/nmake.bat
5
6
  lib/sweeper.rb
6
7
  LICENSE
7
8
  Manifest
File without changes
@@ -7,7 +7,7 @@ require 'open-uri'
7
7
  require 'uri'
8
8
  require 'Text'
9
9
 
10
- require 'ruby-debug' if ENV['DEBUG']
10
+ begin; require 'ruby-debug' if ENV['DEBUG']; rescue LoadError; end
11
11
 
12
12
  class ID3Lib::Tag
13
13
  def url
@@ -36,7 +36,15 @@ class Sweeper
36
36
 
37
37
  # Instantiate a new Sweeper. See <tt>bin/sweeper</tt> for <tt>options</tt> details.
38
38
  def initialize(options = {})
39
- @dir = File.expand_path(options['dir'] || Dir.pwd)
39
+ @dir = File.expand_path(options['dir'] || Dir.pwd)
40
+
41
+ if RUBY_PLATFORM =~ /win32/
42
+ @dir = @dir[2..-1] # Strip drive letter
43
+ @null = "nul"
44
+ else
45
+ @null = "/dev/null"
46
+ end
47
+
40
48
  @options = options
41
49
  @errf = Tempfile.new("stderr")
42
50
  @match_cache = {}
@@ -51,7 +59,6 @@ class Sweeper
51
59
  Kernel.at_exit do
52
60
  if @read == 0
53
61
  puts "No mp3 files found. Maybe you meant --recursive?"
54
- exec "#{$0} --help"
55
62
  else
56
63
  puts "Read: #{@read}\nUpdated: #{@updated}\nFailed: #{@failed}"
57
64
  end
@@ -71,7 +78,8 @@ class Sweeper
71
78
  def recurse(dir)
72
79
  # Hackishly avoid problems with metacharacters in the Dir[] string.
73
80
  dir = dir.gsub(/[^\s\w\.\/\\\-]/, '?')
74
- # p dir if ENV['DEBUG']
81
+ p dir if ENV['DEBUG']
82
+
75
83
  Dir["#{dir}/*"].each do |filename|
76
84
  if File.directory? filename and options['recursive']
77
85
  recurse(filename)
@@ -153,7 +161,9 @@ class Sweeper
153
161
  # Lookup the basic metadata for an mp3 file. Accepts a pathname. Returns a tag hash.
154
162
  def lookup_basic(filename)
155
163
  Dir.chdir File.dirname(binary) do
156
- response = `./#{File.basename(binary)} #{filename.inspect} 2> #{@errf.path}`
164
+ cmd = "#{binary} #{filename.inspect} 2> #{@null}"
165
+ p cmd if ENV['DEBUG']
166
+ response = `#{cmd}`
157
167
  object = begin
158
168
  XSD::Mapping.xml2obj(response)
159
169
  rescue Object => e
@@ -237,12 +247,12 @@ class Sweeper
237
247
 
238
248
  # Returns the path to the fingerprinter binary for this platform.
239
249
  def binary
240
- @binary ||= "#{File.dirname(__FILE__)}/../vendor/" +
250
+ @binary ||= "#{File.expand_path(File.dirname(__FILE__))}/../vendor/" +
241
251
  case RUBY_PLATFORM
242
- when /darwin/
243
- "lastfm.fpclient.beta2.OSX-intel/lastfmfpclient"
244
252
  when /win32/
245
253
  "lastfm.fpclient.beta2.win32/lastfmfpclient.exe"
254
+ when /darwin/
255
+ "lastfm.fpclient.beta2.OSX-intel/lastfmfpclient"
246
256
  else
247
257
  "lastfm.fpclient.beta2.linux-32/lastfmfpclient"
248
258
  end
@@ -1,10 +1,10 @@
1
1
 
2
- # Gem::Specification for Sweeper-0.3
2
+ # Gem::Specification for Sweeper-0.3.1
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{sweeper}
7
- s.version = "0.3"
7
+ s.version = "0.3.1"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = ["sweeper"]
18
18
  s.extensions = ["ext/extconf.rb"]
19
19
  s.extra_rdoc_files = ["CHANGELOG", "lib/sweeper.rb", "LICENSE", "README", "TODO"]
20
- s.files = ["bin/sweeper", "CHANGELOG", "ext/extconf.rb", "ext/Makefile", "lib/sweeper.rb", "LICENSE", "Manifest", "README", "test/integration/sweeper_test.rb", "TODO", "vendor/lastfm.fpclient.beta2.linux-32/lastfmfpclient", "vendor/lastfm.fpclient.beta2.linux-32/readme.txt", "vendor/lastfm.fpclient.beta2.OSX-intel/lastfmfpclient", "vendor/lastfm.fpclient.beta2.OSX-intel/libcurl.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libmad.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libsamplerate.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libtag.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/readme.txt", "vendor/lastfm.fpclient.beta2.win32/lastfmfpclient.exe", "vendor/lastfm.fpclient.beta2.win32/libcurl.dll", "vendor/lastfm.fpclient.beta2.win32/libfftw3f-3.dll", "vendor/lastfm.fpclient.beta2.win32/Microsoft.VC80.CRT.manifest", "vendor/lastfm.fpclient.beta2.win32/msvcm80.dll", "vendor/lastfm.fpclient.beta2.win32/msvcp80.dll", "vendor/lastfm.fpclient.beta2.win32/msvcr80.dll", "vendor/lastfm.fpclient.beta2.win32/taglib.dll", "vendor/lastfm.fpclient.beta2.win32/zlib1.dll", "sweeper.gemspec"]
20
+ s.files = ["bin/sweeper", "CHANGELOG", "ext/extconf.rb", "ext/Makefile", "ext/nmake.bat", "lib/sweeper.rb", "LICENSE", "Manifest", "README", "test/integration/sweeper_test.rb", "TODO", "vendor/lastfm.fpclient.beta2.linux-32/lastfmfpclient", "vendor/lastfm.fpclient.beta2.linux-32/readme.txt", "vendor/lastfm.fpclient.beta2.OSX-intel/lastfmfpclient", "vendor/lastfm.fpclient.beta2.OSX-intel/libcurl.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libmad.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libsamplerate.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/libtag.dylib", "vendor/lastfm.fpclient.beta2.OSX-intel/readme.txt", "vendor/lastfm.fpclient.beta2.win32/lastfmfpclient.exe", "vendor/lastfm.fpclient.beta2.win32/libcurl.dll", "vendor/lastfm.fpclient.beta2.win32/libfftw3f-3.dll", "vendor/lastfm.fpclient.beta2.win32/Microsoft.VC80.CRT.manifest", "vendor/lastfm.fpclient.beta2.win32/msvcm80.dll", "vendor/lastfm.fpclient.beta2.win32/msvcp80.dll", "vendor/lastfm.fpclient.beta2.win32/msvcr80.dll", "vendor/lastfm.fpclient.beta2.win32/taglib.dll", "vendor/lastfm.fpclient.beta2.win32/zlib1.dll", "sweeper.gemspec"]
21
21
  s.has_rdoc = true
22
22
  s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/sweeper/}
23
23
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sweeper", "--main", "README"]
@@ -1,7 +1,7 @@
1
1
 
2
2
  require 'test/unit'
3
3
  require "#{File.dirname(__FILE__)}/../../lib/sweeper"
4
- require 'ruby-debug'
4
+ begin; require 'ruby-debug'; rescue LoadError; end
5
5
 
6
6
  class SweeperTest < Test::Unit::TestCase
7
7
  def setup
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweeper
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Weaver
@@ -86,6 +86,7 @@ files:
86
86
  - CHANGELOG
87
87
  - ext/extconf.rb
88
88
  - ext/Makefile
89
+ - ext/nmake.bat
89
90
  - lib/sweeper.rb
90
91
  - LICENSE
91
92
  - Manifest
metadata.gz.sig CHANGED
Binary file