Class: Commands::Promote

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

Instance Method Summary collapse

Instance Method Details

#optionsObject

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



13
14
15
16
# File 'lib/commands/promote.rb', line 13

def options
  @options ||= {
  }
end

#register(opts, global_options) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
# File 'lib/commands/promote.rb', line 34

def register(opts, global_options)
  opts.banner = "Usage: promote"
  opts.description = "Used to promote a build to Mobile JIRA."
  
=begin
  opts.on('-c', "--config name", "Required - Name of the config we are building from.") do |v|
    options[:config] = v
  end
=end
  opts.on('-b', "--branch config branch name", "Use build config branch") do |v|
    options[:branch] = v
  end
  
  opts.on('-n', "--product-name name", "Required") do |v|
    options[:product_name] = v
  end
  opts.on('-i', "--bundle-indentifer Bundle Identitifer", "Required") do |v|
    options[:bundleid] = v
  end
  opts.on('-p', "--product-key key", "Required") do |v|
    options[:product_key] = v
  end
  opts.on('-d', "--device deviceType", "Required") do |v|
    options[:device] = v
  end
  opts.on('-k', "--wiki-key wiki key", "Required") do |v|
    options[:wiki_key] = v
  end
  opts.on('-v', "--version version", "Required") do |v|
    options[:version] = v
  end
  opts.on('-w', "--working-directory Path to source directory", "Required") do |v|
    options[:working_directory] = v
  end
  opts.on('-f', "--fix-versions version", "Required") do |v|
    options[:fix_versions] = v
  end
  opts.on('-s', "--srcdir source directory", "Required") do |v|
    options[:srcdir] = v
  end
  opts.on('-u', "--usenew", "") do |v|
    options[:usenew] = true
  end
  opts.on('-l', "--usecli", "") do |v|
    options[:usecli] = true
  end
end

#required_optionsObject

required options



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/commands/promote.rb', line 19

def required_options
  @required_options ||= Set.new [
    #:config
    :bundleid,
    :product_key,
    :product_name,
    :device,
    :wiki_key,
    :version,
    :working_directory,
    :fix_versions,
    :srcdir,
  ]
end

#run(global_options) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/commands/promote.rb', line 82

def run(global_options)
  config_branch = options[:branch]
  config_repo_url = EcbSharedLib.prepare_config_repo(config_branch)
  
=begin
  config_name = options[:config]
  info = EcbSharedLib.read_repo_config(config_repo_url, config_name)
  bundleid = info[:bundleid]
  product_key = info[:product_key]
  product_name = info[:product_name]
  device = info[:device]
  wiki_key = info[:wiki_key]
=end 

  bundleid = options[:bundleid]
  product_key = options[:product_key]
  product_name = options[:product_name]
  device = options[:device]
  wiki_key = options[:wiki_key]
  version = options[:version]
  srcdir = options[:srcdir]
  working_directory = options[:working_directory]
  fix_versions = options[:fix_versions]
  usenew = !!options[:usenew] ? "--usenew" : ""
  usecli = !!options[:usecli] ? "--usecli" : ""
  scriptsPath = EcbSharedLib.path_to_scripts(config_repo_url)
  cmd = "./masterpromote.sh   --bundleID #{bundleid} --projectKey #{product_key} \
                              --productName #{product_name} --device #{device} --wikiKey #{wiki_key} \
                              --srcdir #{srcdir} --version #{version} --wkdir #{working_directory} \
                              --fixversions #{fix_versions} #{usenew} #{usecli}"
  EcbSharedLib::CL.do_cmd(cmd, scriptsPath)
end