Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use newer Path gem

  • Loading branch information...
commit 753917dd955fcc79245a72696861f65cc9ca75e9 1 parent 061d0cf
@eregon authored
View
4 lib/suby.rb
@@ -22,7 +22,7 @@ def download_subtitles(files, options = {})
file = Path(file)
next if file.directory? or SUB_EXTENSIONS.include?(file.ext)
next puts "Skipping: #{file}" if SUB_EXTENSIONS.any? { |ext|
- f = file.replace_extension(ext) and f.exist? and f.size > 0
+ f = file.sub_ext(ext) and f.exist? and !f.empty?
}
download_subtitles_for_file(file, options)
}
@@ -67,7 +67,7 @@ def extract_sub_from_archive(archive, format, file)
entry.to_s =~ /\.#{Regexp.union SUB_EXTENSIONS}$/
}
raise "no subtitles in #{archive}" unless sub
- name = file.replace_extension(Path(sub.to_s).ext)
+ name = file.sub_ext(Path(sub).ext)
sub.extract(name.to_s)
}
else
View
4 spec/suby/filename_parser_spec.rb
@@ -4,7 +4,7 @@
show = 'How I Met Your Mother'
season, episode = 3, 9
title = 'Slapsgiving'
- ext = '.mkv'
+ ext = 'mkv'
dot_show = show.tr(' ', '.')
und_show = show.tr(' ', '_')
@@ -42,7 +42,7 @@
"#{dot_show}.0309",
].each do |filename|
it filename do
- file = Path(filename + ext)
+ file = Path(filename).add_ext(ext)
Suby::FilenameParser.parse(file).should == [show, season, episode]
end
end
View
2  suby.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.executables = ['suby']
s.required_ruby_version = '>= 1.9.2'
- s.add_dependency 'epath'
+ s.add_dependency 'epath', '>= 0.1.0'
s.add_dependency 'nokogiri'
s.add_dependency 'rubyzip2'
s.add_dependency 'term-ansicolor'
Please sign in to comment.
Something went wrong with that request. Please try again.