From cfb766c18f5f6347f002e3f5b1b4b47647c43a5a Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 12 Jun 2012 23:27:32 -0400 Subject: [PATCH] Fix the progressbar require path in uri_utilities.rb. Replace the makefile with a Rakefile. Update all of the test code to run under `rake test`. Add a short README. --- Rakefile | 26 ++++++++++++++++++++++++++ doc/README | 13 +++++++++++++ lib/whatever-dl/uri_utilities.rb | 2 +- makefile | 20 -------------------- test/bliptv_test.rb | 2 +- test/dailymotion_test.rb | 2 +- test/efukt_test.rb | 2 +- test/fuckedtube_test.rb | 2 +- test/howcast_test.rb | 2 +- test/infoq_test.rb | 2 +- test/megaporn_test.rb | 2 +- test/motherless_test.rb | 2 +- test/progressbar_test.rb | 19 +++++++++++++++++++ test/redtube_test.rb | 2 +- test/tnaflix_test.rb | 2 +- test/uri_utilities_test.rb | 2 +- test/veoh_test.rb | 2 +- test/vimeo_test.rb | 2 +- test/website_test.rb | 7 +------ test/yikers_test.rb | 2 +- test/youporn_test.rb | 2 +- test/youtube_test.rb | 2 +- 22 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 Rakefile create mode 100644 doc/README delete mode 100644 makefile create mode 100644 test/progressbar_test.rb diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..ce0bc56 --- /dev/null +++ b/Rakefile @@ -0,0 +1,26 @@ +require 'rake/testtask' + +desc "Clean up generated files" +task :clean do + `rm -f whatever-dl-*.gem` +end + + +desc "Build the gem" +task :build => :clean do + `gem build whatever-dl.gemspec` +end + + +desc "Install the gem locally (user install)" +task :install => :build do + `gem install --user-install whatever-dl-*.gem` +end + +Rake::TestTask.new do |t| + t.pattern = 'test/*test.rb' + t.libs << 'test' +end + +desc "Run tests" +task :default => :test diff --git a/doc/README b/doc/README new file mode 100644 index 0000000..1983fe1 --- /dev/null +++ b/doc/README @@ -0,0 +1,13 @@ +Installation +------------ + +To install the gem locally (as the current user), simply run, + + rake install + +You should then be able to run the script out of, + + $HOME/.gem/ruby/*/bin + +It might make sense to add that to your path. I don't know how this +gem thing works so much yet. diff --git a/lib/whatever-dl/uri_utilities.rb b/lib/whatever-dl/uri_utilities.rb index 78966e8..f7ff318 100644 --- a/lib/whatever-dl/uri_utilities.rb +++ b/lib/whatever-dl/uri_utilities.rb @@ -17,7 +17,7 @@ # require 'open-uri' -require 'vendor/ruby-progressbar/progressbar' +require 'ruby-progressbar/progressbar' # Just a couple of convenience methods for URIs. # These could be monkey-patched in, but with only diff --git a/makefile b/makefile deleted file mode 100644 index ccaac1c..0000000 --- a/makefile +++ /dev/null @@ -1,20 +0,0 @@ -.PHONY : build test - -all: install - -# Ruby 1.9 doesn't include the current directory in the load path, so -# we pass them on the command-line. -test: - ruby -I. test/test_suite.rb - -remote_test: - ruby -I. test/remote_test_suite.rb - -clean: - rm -f whatever-dl-*.gem - -build: clean - gem build whatever-dl.gemspec - -install: build - gem install --user-install whatever-dl-*.gem diff --git a/test/bliptv_test.rb b/test/bliptv_test.rb index 1a1348e..af524e3 100644 --- a/test/bliptv_test.rb +++ b/test/bliptv_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/bliptv' +require 'whatever-dl/websites/bliptv' class BliptvTest < Test::Unit::TestCase diff --git a/test/dailymotion_test.rb b/test/dailymotion_test.rb index 25ae463..8f02baf 100644 --- a/test/dailymotion_test.rb +++ b/test/dailymotion_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/dailymotion' +require 'whatever-dl/websites/dailymotion' class DailymotionTest < Test::Unit::TestCase diff --git a/test/efukt_test.rb b/test/efukt_test.rb index 26383f5..f1e45d8 100644 --- a/test/efukt_test.rb +++ b/test/efukt_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/efukt' +require 'whatever-dl/websites/efukt' class EfuktTest < Test::Unit::TestCase diff --git a/test/fuckedtube_test.rb b/test/fuckedtube_test.rb index 21d4319..9d1d9c7 100644 --- a/test/fuckedtube_test.rb +++ b/test/fuckedtube_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/fuckedtube' +require 'whatever-dl/websites/fuckedtube' class FuckedtubeTest < Test::Unit::TestCase diff --git a/test/howcast_test.rb b/test/howcast_test.rb index 91c1d6a..cf01832 100644 --- a/test/howcast_test.rb +++ b/test/howcast_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/howcast' +require 'whatever-dl/websites/howcast' # Unit tests for the Howcast class. # This class is easy because get_video_url is diff --git a/test/infoq_test.rb b/test/infoq_test.rb index d6cdf44..1001357 100644 --- a/test/infoq_test.rb +++ b/test/infoq_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/infoq' +require 'whatever-dl/websites/infoq' # Unit tests for the Infoq class. Basically just checking # the results of parse_video_url for now. diff --git a/test/megaporn_test.rb b/test/megaporn_test.rb index 6b35399..17c5932 100644 --- a/test/megaporn_test.rb +++ b/test/megaporn_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/megaporn' +require 'whatever-dl/websites/megaporn' class MegapornTest < Test::Unit::TestCase diff --git a/test/motherless_test.rb b/test/motherless_test.rb index 7c91a82..dd53414 100644 --- a/test/motherless_test.rb +++ b/test/motherless_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/motherless' +require 'whatever-dl/websites/motherless' class MotherlessTest < Test::Unit::TestCase diff --git a/test/progressbar_test.rb b/test/progressbar_test.rb new file mode 100644 index 0000000..37627e7 --- /dev/null +++ b/test/progressbar_test.rb @@ -0,0 +1,19 @@ +# +# Copyright Michael Orlitzky +# +# http://michael.orlitzky.com/ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# http://www.fsf.org/licensing/licenses/gpl.html +# + +require 'ruby-progressbar/test' diff --git a/test/redtube_test.rb b/test/redtube_test.rb index 39ee92a..26ff8b2 100644 --- a/test/redtube_test.rb +++ b/test/redtube_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/redtube' +require 'whatever-dl/websites/redtube' # Unit tests for the Redtube class. Basically just checking # the results of get_video_url for known ids. diff --git a/test/tnaflix_test.rb b/test/tnaflix_test.rb index 3bd42d0..411851b 100644 --- a/test/tnaflix_test.rb +++ b/test/tnaflix_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/tnaflix' +require 'whatever-dl/websites/tnaflix' class TnaflixTest < Test::Unit::TestCase diff --git a/test/uri_utilities_test.rb b/test/uri_utilities_test.rb index 60a266b..bb4bf7f 100644 --- a/test/uri_utilities_test.rb +++ b/test/uri_utilities_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/uri_utilities.rb' +require 'whatever-dl/uri_utilities.rb' class UriUtilitiesTest < Test::Unit::TestCase diff --git a/test/veoh_test.rb b/test/veoh_test.rb index fdb5bbf..3ae9fb4 100644 --- a/test/veoh_test.rb +++ b/test/veoh_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/veoh' +require 'whatever-dl/websites/veoh' class VeohTest < Test::Unit::TestCase diff --git a/test/vimeo_test.rb b/test/vimeo_test.rb index 203afae..e332aa3 100644 --- a/test/vimeo_test.rb +++ b/test/vimeo_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/vimeo' +require 'whatever-dl/websites/vimeo' # There are no remote tests for Vimeo because they use # an expiration timestamp to change certain values in the diff --git a/test/website_test.rb b/test/website_test.rb index 2c3f25d..d0219b8 100644 --- a/test/website_test.rb +++ b/test/website_test.rb @@ -17,15 +17,10 @@ # require 'test/unit' +require 'whatever-dl' # Tests common to all websites. -# All of the website classes are located in one -# directory, so we can 'require' them automatically. -Dir.glob('src/websites/*.rb').each do |r| - require r -end - class WebsiteTest < Test::Unit::TestCase def test_nobody_owns_misc_urls diff --git a/test/yikers_test.rb b/test/yikers_test.rb index 7bb8150..5b6f7f4 100644 --- a/test/yikers_test.rb +++ b/test/yikers_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/yikers' +require 'whatever-dl/websites/yikers' class YikersTest < Test::Unit::TestCase diff --git a/test/youporn_test.rb b/test/youporn_test.rb index 24d8643..a8b21ae 100644 --- a/test/youporn_test.rb +++ b/test/youporn_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/youporn' +require 'whatever-dl/websites/youporn' # Unit tests for the Youporn class. Basically just checking # the results of parse_video_url for now. diff --git a/test/youtube_test.rb b/test/youtube_test.rb index bcb350d..622ddc0 100644 --- a/test/youtube_test.rb +++ b/test/youtube_test.rb @@ -17,7 +17,7 @@ # require 'test/unit' -require 'src/websites/youtube' +require 'whatever-dl/websites/youtube' class YoutubeTest < Test::Unit::TestCase -- 2.44.2