Permalink
Browse files

prints usage if no directory is passed

  • Loading branch information...
1 parent 764ca2f commit 4e96c031372f8daabc0eb6491bfae41ced7a1ddd @fxn committed Aug 11, 2011
Showing with 28 additions and 7 deletions.
  1. +4 −0 History.txt
  2. +4 −2 README
  3. +2 −2 Rakefile
  4. +9 −3 bin/unmac
  5. +9 −0 test/test_unmac.rb
View
@@ -1,3 +1,7 @@
+== 1.0 2011-08-11
+
+ * Prints usage if no directory is passed.
+
== 0.9 2011-08-11
* Knows about mobile backups, new in Lion.
View
6 README
@@ -43,9 +43,11 @@ What's deleted:
* A folder called ".Trashes" in the root directory of volumes stores their
trashes. Those ones are taken into account by the Trash in the Dock.
- * Document revisions are stored in the /.DocumentRevisions-V100 folder. (New in Lion.)
+ * Document revisions are stored on a folder called .DocumentRevisions-V100
+ in the root directory. (New in Lion.)
- * Mobile backups are stored in the /.MobileBackups folder. (New in Lion.)
+ * Mobile backups are stored on a folder called .MobileBackups in the root
+ directory. (New in Lion.)
* Some archivers create auxiliary directories called "__MACOSX".
View
@@ -7,6 +7,6 @@ Rake::TestTask.new do |t|
t.verbose = true
end
-task :home do
- sh "scp home/index.html fxn@rubyforge.org:/var/www/gforge-projects/unmac/"
+task :readme do
+ system "ruby -Ilib bin/unmac > README"
end
View
@@ -51,9 +51,11 @@ What's deleted:
* A folder called "#{Unmacer::TRASHES}" in the root directory of volumes stores their
trashes. Those ones are taken into account by the Trash in the Dock.
- * Document revisions are stored in the /.DocumentRevisions-V100 folder. (New in Lion.)
+ * Document revisions are stored on a folder called #{Unmacer::REVISIONS}
+ in the root directory. (New in Lion.)
- * Mobile backups are stored in the /.MobileBackups folder. (New in Lion.)
+ * Mobile backups are stored on a folder called #{Unmacer::MBACKUPS} in the root
+ directory. (New in Lion.)
* Some archivers create auxiliary directories called "#{Unmacer::MACOSX}".
@@ -106,7 +108,11 @@ begin
test = true
end
end
- unmacer.unmac!(ARGV) unless test
+ if ARGV.empty?
+ usage and exit
+ else
+ unmacer.unmac!(ARGV) unless test
+ end
rescue GetoptLong::InvalidOption
usage and exit 1
end
View
@@ -281,4 +281,13 @@ def test_help
assert_match %r{^Usage\b}, buf
assert ARGV.empty?
end
+
+ def test_no_directory
+ buf = ''
+ $> = StringIO.open(buf, 'w')
+ call_unmac
+ $> = $stdout
+ assert_match %r{^unmac\b}, buf
+ assert_match %r{^Usage\b}, buf
+ end
end

0 comments on commit 4e96c03

Please sign in to comment.