Class: Exportation::Export
- Inherits:
-
Object
- Object
- Exportation::Export
- Defined in:
- lib/exportation.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#name ⇒ Object
Returns the value of attribute name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(options) ⇒ Export
constructor
A new instance of Export.
- #run ⇒ Object
- #run_command ⇒ Object
Constructor Details
#initialize(options) ⇒ Export
Returns a new instance of Export.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/exportation.rb', line 23 def initialize() @path = [:path] @filename = [:filename] @name = [:name] @password = [:password] @path = './' if Exportation.is_empty?(@path) @filename = 'exported' if Exportation.is_empty?(@filename) @password = '' if Exportation.is_empty?(@password) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
21 22 23 |
# File 'lib/exportation.rb', line 21 def filename @filename end |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/exportation.rb', line 21 def name @name end |
#password ⇒ Object
Returns the value of attribute password.
21 22 23 |
# File 'lib/exportation.rb', line 21 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
21 22 23 |
# File 'lib/exportation.rb', line 21 def path @path end |
Instance Method Details
#run ⇒ Object
34 35 36 37 38 |
# File 'lib/exportation.rb', line 34 def run bash = run_command puts "Running: #{bash}" `#{bash}` end |
#run_command ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/exportation.rb', line 40 def run_command raise "name is required" if Exportation.is_empty?(@name) abs_path = File. path abs_path += '/' unless abs_path.end_with? '/' bash = "osascript #{Exportation.applescript_path} " + "\"#{abs_path}\" " + "\"#{filename}\" " + "\"#{name}\" " + "\"#{password}\"" end |