Class: Settings

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Settings

Returns a new instance of Settings.



5
6
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
# File 'lib/settings.rb', line 5

def initialize(options)
  @name = options[:name]
  @filename = options[:filename]
  @url = options[:url]
  @url+= "/" unless @url.match(/\/$/)
  @host = options[:host]
  @path = options[:path]
  @type = options[:type]
  @remote_user = options[:remote_user]
  @is_enterprise = options[:enterprise]

  if @filename.nil? || @filename.empty?
    @filename = @name.gsub(" ", "_") 
  end
  
  @provision_file_name = "#{@filename}.mobileprovision"
  @plist_file = "#{@filename}.plist"
  @ipa_file = "#{@filename}.ipa"
  @plist_file_url = "#{@url}#{@plist_file}"
  @template_file = options[:template] || "#{COMBAT_ROOT}/templates/template.erb"
  @deployer = %x(whoami).strip
  
  if (type == 'android')
    @icon_source_path = "res/drawable-hdpi/icon.png"
#      @qrcode = "http://qrcode.kaywa.com/img.php?s=6&d=#{ERB::Util.url_encode(@url)}#{@filename}.apk"
  else
    @icon_source_path = "[email protected]"
  end
  @qrcode = "http://qrcode.kaywa.com/img.php?s=6&d=#{ERB::Util.url_encode(@url)}"
  
  @icon_path = "icon.png"
end

Instance Attribute Details

#deployed_atObject

Returns the value of attribute deployed_at.



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

def deployed_at
  @deployed_at
end

#filenameObject

Returns the value of attribute filename.



2
3
4
# File 'lib/settings.rb', line 2

def filename
  @filename
end

#hostObject

Returns the value of attribute host.



2
3
4
# File 'lib/settings.rb', line 2

def host
  @host
end

#icon_pathObject

Returns the value of attribute icon_path.



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

def icon_path
  @icon_path
end

#icon_source_pathObject

Returns the value of attribute icon_source_path.



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

def icon_source_path
  @icon_source_path
end

#ipa_fileObject

Returns the value of attribute ipa_file.



2
3
4
# File 'lib/settings.rb', line 2

def ipa_file
  @ipa_file
end

#is_enterpriseObject

Returns the value of attribute is_enterprise.



2
3
4
# File 'lib/settings.rb', line 2

def is_enterprise
  @is_enterprise
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/settings.rb', line 2

def name
  @name
end

#pathObject

Returns the value of attribute path.



2
3
4
# File 'lib/settings.rb', line 2

def path
  @path
end

#plist_fileObject

Returns the value of attribute plist_file.



2
3
4
# File 'lib/settings.rb', line 2

def plist_file
  @plist_file
end

#provision_file_nameObject

Returns the value of attribute provision_file_name.



2
3
4
# File 'lib/settings.rb', line 2

def provision_file_name
  @provision_file_name
end

#remote_userObject

Returns the value of attribute remote_user.



2
3
4
# File 'lib/settings.rb', line 2

def remote_user
  @remote_user
end

#template_fileObject

Returns the value of attribute template_file.



2
3
4
# File 'lib/settings.rb', line 2

def template_file
  @template_file
end

#typeObject

Returns the value of attribute type.



2
3
4
# File 'lib/settings.rb', line 2

def type
  @type
end

#urlObject

Returns the value of attribute url.



2
3
4
# File 'lib/settings.rb', line 2

def url
  @url
end

Instance Method Details

#get_bindingObject



42
43
44
# File 'lib/settings.rb', line 42

def get_binding
  binding
end

#user_and_hostObject



38
39
40
# File 'lib/settings.rb', line 38

def user_and_host
  "#{remote_user}@#{host}"
end

#valid?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/settings.rb', line 46

def valid?
  @name != nil && @url != nil
end