diff --git a/lib/Config.rb b/lib/Config.rb index 92abad8..7663809 100644 --- a/lib/Config.rb +++ b/lib/Config.rb @@ -1,15 +1,13 @@ #!/usr/bin/ruby # author: nishiki # mail: nishiki@yaegashi.fr -# info: a simple script who manage your passwords -module MPW - - require 'rubygems' - require 'gpgme' - require 'yaml' - require 'i18n' +require 'rubygems' +require 'gpgme' +require 'yaml' +require 'i18n' +module MPW class Config attr_accessor :error_msg @@ -231,5 +229,4 @@ module MPW end end - end diff --git a/lib/MPW.rb b/lib/MPW.rb index 6817755..a29cff0 100644 --- a/lib/MPW.rb +++ b/lib/MPW.rb @@ -8,7 +8,8 @@ require 'csv' require 'i18n' require 'fileutils' require 'yaml' -require "#{APP_ROOT}/lib/Item" + +require_relative './Item' module MPW class MPW diff --git a/lib/Sync.rb b/lib/Sync.rb index 3f18f26..18dbad9 100644 --- a/lib/Sync.rb +++ b/lib/Sync.rb @@ -7,8 +7,9 @@ require 'rubygems' require 'i18n' require 'yaml' require 'tempfile' -require "#{APP_ROOT}/lib/Item" -require "#{APP_ROOT}/lib/MPW" + +require_relative './MPW' +require_relative './Item' module MPW class Sync diff --git a/lib/UI/Cli.rb b/lib/UI/Cli.rb index 98bcf70..eba7273 100644 --- a/lib/UI/Cli.rb +++ b/lib/UI/Cli.rb @@ -10,8 +10,9 @@ require 'readline' require 'i18n' require 'colorize' -require "#{APP_ROOT}/lib/MPW" -require "#{APP_ROOT}/lib/Sync" +require_relative '../Sync' +require_relative '../MPW' +require_relative '../Item' class Cli diff --git a/mpw b/mpw index 6689ade..bc63313 100755 --- a/mpw +++ b/mpw @@ -10,10 +10,9 @@ require 'locale' require 'set' require 'i18n' -APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath) -require "#{APP_ROOT}/lib/UI/Cli" -require "#{APP_ROOT}/lib/Config" -require "#{APP_ROOT}/lib/MPW" +require_relative 'lib/UI/Cli' +require_relative 'lib/Config' +require_relative 'lib/MPW' # --------------------------------------------------------- # # Set local @@ -25,6 +24,8 @@ if defined?(I18n.enforce_available_locales) I18n.enforce_available_locales = true end +APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath) + I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) I18n.load_path = Dir["#{APP_ROOT}/i18n/cli/*.yml"] I18n.default_locale = :en