Class: Zmeygo::Command
- Inherits:
-
Object
- Object
- Zmeygo::Command
- Defined in:
- lib/zmeygo/command.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(options) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zmeygo/command.rb', line 7 def initialize() if [:init] src_file = File.join(File.dirname(__FILE__),'../..','templates','zmeygo.yml.template') dest_dir = File.( File.dirname(Constant::DEFAULT_CONFIG_FILE) ) dest_file = File.(Constant::DEFAULT_CONFIG_FILE) unless File.exists?(dest_dir) FileUtils.mkdir_p dest_dir end unless File.exists?(dest_file) puts "Creating config file #{dest_file}..." system "cp #{src_file} #{dest_file}" puts "Done." exit else puts "config file #{Constant::DEFAULT_CONFIG_FILE} already exists. Nothing to do." end end Zmeygo.configure self. = self.client = Zmeygo::Client.new() [:push,:pull,:list, :ping].each do |command| ret = client.send(command) if [command] if ret.present? puts ret end end end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/zmeygo/command.rb', line 5 def client @client end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/zmeygo/command.rb', line 5 def @options end |