lib/commandbase.rb in narou-1.4.4 vs lib/commandbase.rb in narou-1.4.5
- old
+ new
@@ -23,9 +23,19 @@
rescue OptionParser::MissingArgument => e
error "オプションの引数が不正です(#{e})"
exit 1
end
+ def load_local_settings
+ command_prefix = self.class.to_s.scan(/[^:]+$/)[0].downcase
+ local_settings = LocalSetting.get["local_setting"]
+ local_settings.each do |name, value|
+ if name =~ /^#{command_prefix}\.(.+)$/
+ @options[$1] = value
+ end
+ end
+ end
+
#
# 普通にコマンドを実行するけど、exit(2) を補足してexitstatus を返す
# 正常終了なら0
#
def self.execute_and_rescue_exit(argv)