Class: Commands::UpdatePlist

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

Instance Method Summary collapse

Instance Method Details

#optionsObject

holds the options that were passed you can set any initial defaults here



14
15
16
17
# File 'lib/commands/update_plist.rb', line 14

def options
  @options ||= {
  }
end

#register(opts, global_options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/commands/update_plist.rb', line 27

def register(opts, global_options)
  opts.banner = "Usage: update_plist"
  opts.description = "Updates the specified plist."
  opts.on('-c', "--config name", "Required - Name of the config we are building from.") do |v|
    options[:config] = v
  end
  opts.on('-n', "--build number", "Required - build number used to update plist") do |v|
    options[:build] = v
  end
  
  opts.on('-v', "--verbose", "Display passed data") do |v|
    options[:verbose] = true
  end
  
  opts.on('-b', "--branch config branch name", "Use build config branch") do |v|
    options[:branch] = v
  end
end

#required_optionsObject

required options



20
21
22
23
24
25
# File 'lib/commands/update_plist.rb', line 20

def required_options
  @required_options ||= Set.new [
    :config,
    :build,
  ]
end

#run(global_options) ⇒ Object

Getting a plist returned from a mobile provsion file: security cms -D -i eBay_Core_iPad_Enterprise.mobileprovision f=File.open(“appstore.xcconfig”, ‘w’).readlines f.write(f)



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/commands/update_plist.rb', line 53

def run(global_options)
  config_name = options[:config]
  config_branch = options[:branch]
  build = options[:build]
  byebug
  config_repo_url = EcbSharedLib.prepare_config_repo(config_branch)
  info = EcbSharedLib.read_repo_config(config_repo_url, config_name)
  info_plist = info[:info_plist]
  enterprise_info_plist = info[:enterprise_info_plist]
  verbose = options[:verbose]
  if (info_plist) then
    puts ".    Info plist....: " + info_plist if verbose
    plist_data = Plist::parse_xml(info_plist)
    if (build) then
      plist_data["BuildIdentifier"] = build
      puts ".    buildindentifer....: " + build if verbose
      plist_data.save_plist(info_plist)
    end
  end
  if (enterprise_info_plist) then
    puts ".    Info plist....: " + enterprise_info_plist if verbose
    plist_data = Plist::parse_xml(enterprise_info_plist)
    if (build) then
      plist_data["BuildIdentifier"] = build
      puts ".    buildindentifer....: " + build if verbose
      plist_data.save_plist(enterprise_info_plist)
    end
  end
end