module SipoMailer::Installer
Constants
- CONFIG_FILE
- DEFAULT_DIR
Public Class Methods
book_example()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 37 def book_example example_path = Gem.bin_path('sipo_mailer', 'mailer').split('/')[0..-3] [example_path, 'config', 'adresar.csv.example'].join('/') end
config()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 42 def config [config_dir, CONFIG_FILE].join('/') end
config_dir()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 46 def config_dir case os when :windows [ENV['HOME'], DEFAULT_DIR].join('/') else [ENV['USERPROFILE'], DEFAULT_DIR].join('/') end end
config_example()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 32 def config_example example_path = Gem.bin_path('sipo_mailer', 'mailer').split('/')[0..-3] [example_path, 'config', "#{CONFIG_FILE}.example"].join('/') end
copy_file(src, dest)
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 22 def copy_file(src, dest) return false if File.exist? dest File.open("#{config_dir}/#{dest}", 'w') do |file| source = File.open(src) file.write(source.readlines.join('')) source.close end true end
copy_files()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 17 def copy_files copy_file(config_example, CONFIG_FILE) copy_file(book_example, 'adresar.csv') end
create_dir()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 12 def create_dir result = Dir.mkdir(config_dir) unless Dir.exist?(config_dir) result == 0 end
install()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 7 def install create_dir copy_files end
os()
click to toggle source
# File lib/sipo_mailer/utils/installer.rb, line 55 def os host_os = RbConfig::CONFIG['host_os'] case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :macosx when /linux/ :linux when /solaris|bsd/ :unix else raise Error::WebDriverError, "unknown os: #{host_os.inspect}" end end