Class: WTBuildHelpers::JIRA::Parser

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

Class Method Summary collapse

Class Method Details

.parse(options) ⇒ Object



76
77
78
79
80
81
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
# File 'lib/jira.rb', line 76

def self.parse(options)
    args = Options.new()
       
    opt_parser = OptionParser.new do |opts|
        opts.banner = "Usage: jira_update_from_build [options]"
    
        opts.on("-c", "--commits COMMIT_RANGE", "Specify a commit range") do |commit_range|
            args.commit_range = commit_range
        end
        
        opts.on("-u", "--username USERNAME", "Specify the user to connecto to JIRA") do |username|
            args.username = username
        end
        
        opts.on("-p", "--password PASSWORD", "Specify the password to connect to JIRA") do |password|
            args.password = password
        end
        
        opts.on("-s", "--site SITE", "Specify the base location of the JIRA instance") do |site|
            site.slice!("http://")
            site.insert(0, "https://") if not site.start_with?("https://")
            args.site = site
        end
        
        opts.on("-b", "--build BUILD", "The build number for which this script is executing") do |build|
            args.build = build
        end
        
        opts.on_tail("-h", "--help", "Show this message") do
            puts opts
            exit
        end
    end

    opt_parser.parse!(options)
    return args   
end