Class: Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/flick/manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Manager

Returns a new instance of Manager.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/flick/manager.rb', line 5

def initialize options
  Flick::Checker.manager options[:action]
  Flick::Checker.platform options[:platform]
  self.action = options[:action]
  self.platform = options[:platform]
  case platform
  when "ios"
    self.driver = Flick::Ios.new options
  when "android"
    self.driver = Flick::Android.new options
  end
  self.udid = self.driver.udid
  self.file = options[:file]
  self.name = options[:name]
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



3
4
5
# File 'lib/flick/manager.rb', line 3

def action
  @action
end

#driverObject

Returns the value of attribute driver.



3
4
5
# File 'lib/flick/manager.rb', line 3

def driver
  @driver
end

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/flick/manager.rb', line 3

def file
  @file
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/flick/manager.rb', line 3

def name
  @name
end

#platformObject

Returns the value of attribute platform.



3
4
5
# File 'lib/flick/manager.rb', line 3

def platform
  @platform
end

#udidObject

Returns the value of attribute udid.



3
4
5
# File 'lib/flick/manager.rb', line 3

def udid
  @udid
end

Instance Method Details

#installObject



25
26
27
28
29
30
31
32
# File 'lib/flick/manager.rb', line 25

def install
  if file.nil?
    puts "Specify a file path. e.g. -f #{Dir.home}/myApp/amazing-app.apk or .app".red; abort
  else
    Flick::Checker.file_exists? file
    driver.install file
  end
end

#runObject



21
22
23
# File 'lib/flick/manager.rb', line 21

def run
  self.send(action)
end

#uninstallObject



34
35
36
37
38
39
40
# File 'lib/flick/manager.rb', line 34

def uninstall
  if name.nil?
    puts "Specify a Package Name or Bundle ID. e.g. -n ".red; abort
  else
    driver.uninstall name
  end
end