From e6ca82b82d889207e20de3ae1d251c180f72661a Mon Sep 17 00:00:00 2001 From: Taku YASUI Date: Fri, 8 Aug 2008 15:41:23 +0000 Subject: [PATCH] Update and install import.rb --- debian/rules | 3 ++- lib/rbphoto/import.rb | 52 ++++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/debian/rules b/debian/rules index 0bab26b..ffc28d9 100755 --- a/debian/rules +++ b/debian/rules @@ -5,6 +5,7 @@ include /usr/share/cdbs/1/rules/debhelper.mk RUBYLIBDIR = $(shell ruby -rrbconfig -e "puts RbConfig::CONFIG['rubylibdir']") install/rbphoto:: - mkdir -p $(DEB_DESTDIR)/$(RUBYLIBDIR) + mkdir -p $(DEB_DESTDIR)/$(RUBYLIBDIR)/rbphoto install -m 755 bin/* $(DEB_DESTDIR)/usr/bin/ install -m 755 lib/rbphoto.rb $(DEB_DESTDIR)/$(RUBYLIBDIR) + install -m 755 lib/rbphoto/import.rb $(DEB_DESTDIR)/$(RUBYLIBDIR)/rbphoto diff --git a/lib/rbphoto/import.rb b/lib/rbphoto/import.rb index 45e51cd..6b18b78 100755 --- a/lib/rbphoto/import.rb +++ b/lib/rbphoto/import.rb @@ -35,31 +35,6 @@ def datetime end class RbPhoto - class Args < Hash - def initialize - parser = GetoptLong.new( - ['--datedir', '-D', GetoptLong::NO_ARGUMENT], - ['--force', '-f', GetoptLong::NO_ARGUMENT], - ['--no-gui', '-G', GetoptLong::NO_ARGUMENT], - ['--help', '-h', GetoptLong::NO_ARGUMENT], - ['--with-movie', '-M', GetoptLong::NO_ARGUMENT], - ['--move', '-m', GetoptLong::NO_ARGUMENT], - ['--without-rename', '-N', GetoptLong::NO_ARGUMENT], - ['--no-act', '-n', GetoptLong::NO_ARGUMENT], - ['--photographer', '-p', GetoptLong::REQUIRED_ARGUMENT], - ['--version', '-V', GetoptLong::NO_ARGUMENT], - ['--verbose', '-v', GetoptLong::NO_ARGUMENT]) - begin - parser.each do |name, arg| - arg = true if (arg == "") - self[name.sub(/^--/, '').gsub(/-/, '_').downcase] = arg - end - rescue - self['help'] = true - end - end - end - class Import include GetText bindtextdomain("rbphoto") @@ -198,6 +173,33 @@ def version warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. _EOT end + + class Options + def initialize + parser = GetoptLong.new( + ['--datedir', '-D', GetoptLong::NO_ARGUMENT], + ['--force', '-f', GetoptLong::NO_ARGUMENT], + ['--no-gui', '-G', GetoptLong::NO_ARGUMENT], + ['--help', '-h', GetoptLong::NO_ARGUMENT], + ['--with-movie', '-M', GetoptLong::NO_ARGUMENT], + ['--move', '-m', GetoptLong::NO_ARGUMENT], + ['--without-rename', '-N', GetoptLong::NO_ARGUMENT], + ['--no-act', '-n', GetoptLong::NO_ARGUMENT], + ['--photographer', '-p', GetoptLong::REQUIRED_ARGUMENT], + ['--version', '-V', GetoptLong::NO_ARGUMENT], + ['--verbose', '-v', GetoptLong::NO_ARGUMENT]) + begin + parser.each do |name, arg| + arg = true if (arg == "") + name = name.sub(/^--/, '').gsub(/-/, '_').downcase + instance_variable_set("@#{name}", arg) + end + rescue + @help = true + end + end + attr_accessor :datedir :force :no_gui :help :with_movie :move :without_rename :no_act :photographer :version :verbose + end end end