class Exportation::Export

Attributes

filename[RW]
name[RW]
password[RW]
path[RW]

Public Class Methods

new(options) click to toggle source
# File lib/exportation.rb, line 23
def initialize(options)
  @path = options[:path]
  @filename = options[:filename]
  @name = options[:name]
  @password = options[:password]

  @path = './' if Exportation.is_empty?(@path)
  @filename = 'exported' if Exportation.is_empty?(@filename)
  @password = '' if Exportation.is_empty?(@password)
end

Public Instance Methods

run() click to toggle source
# File lib/exportation.rb, line 34
def run
  bash = run_command
  puts "Running: #{bash}"
  `#{bash}`
end
run_command() click to toggle source
# File lib/exportation.rb, line 40
def run_command
  raise "name is required" if Exportation.is_empty?(@name)

  abs_path = File.expand_path path
  abs_path += '/' unless abs_path.end_with? '/'

  bash = "osascript #{Exportation.applescript_path} " +
    "\"#{abs_path}\" " +
    "\"#{filename}\" " +
    "\"#{name}\" " +
    "\"#{password}\""
end