Class: ProjectMonitorStat::Config
- Inherits:
-
Object
- Object
- ProjectMonitorStat::Config
- Defined in:
- lib/project_monitor_stat/config.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#building_cmd ⇒ Object
Returns the value of attribute building_cmd.
-
#cookie ⇒ Object
Returns the value of attribute cookie.
-
#fail_cmd ⇒ Object
Returns the value of attribute fail_cmd.
-
#idle_cmd ⇒ Object
Returns the value of attribute idle_cmd.
-
#idle_seconds ⇒ Object
Returns the value of attribute idle_seconds.
-
#success_cmd ⇒ Object
Returns the value of attribute success_cmd.
-
#tags ⇒ Object
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def base_url @base_url end |
#building_cmd ⇒ Object
Returns the value of attribute building_cmd.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def building_cmd @building_cmd end |
#cookie ⇒ Object
Returns the value of attribute cookie.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def end |
#fail_cmd ⇒ Object
Returns the value of attribute fail_cmd.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def fail_cmd @fail_cmd end |
#idle_cmd ⇒ Object
Returns the value of attribute idle_cmd.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def idle_cmd @idle_cmd end |
#idle_seconds ⇒ Object
Returns the value of attribute idle_seconds.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def idle_seconds @idle_seconds end |
#success_cmd ⇒ Object
Returns the value of attribute success_cmd.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def success_cmd @success_cmd end |
#tags ⇒ Object
Returns the value of attribute tags.
86 87 88 |
# File 'lib/project_monitor_stat/config.rb', line 86 def end |
Class Method Details
.parse_options(argv: raise) ⇒ Object
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 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 81 82 83 84 |
# File 'lib/project_monitor_stat/config.rb', line 6 def self.(argv: raise) instance = new instance.base_url = 'http://pulse.pivotallabs.com/projects.json' instance.idle_seconds = 600 opt_parser = OptionParser.new do |opts| opts. = 'Usage: project_monitor_stat [options]' opts.on('-t tag1,tag2', '--tags tag1,tag2,tag3', Array, 'Project Monitor tags') do |t| instance. = t end opts.on('-g', '--git-author-tags', 'Use current git author username@ or pair+usernames@ for tags') do git_email_parser = GitEmailParser.new if git_email_parser..empty? Util.puts "Error: Invalid git email: '#{git_email_parser.git_email}'" Util.puts opts exit(1) end instance. = git_email_parser. end opts.on('-sCOMMAND', '--success COMMAND', 'Command after success') do |s| instance.success_cmd = s end opts.on('-iCOMMAND', '--idle COMMAND', 'Command when idle after success') do |i| instance.idle_cmd = i end opts.on('--idle-seconds SECONDS', 'Seconds after which a success build is idle') do |is| instance.idle_seconds = is.to_i end opts.on('-bCOMMAND', '--building COMMAND', 'Command when building') do |b| instance.building_cmd = b end opts.on('-fCOMMAND', '--fail COMMAND', 'Command after fail') do |s| instance.fail_cmd = s end opts.on('-uURL', '--url URL', 'Custom project monitor url ', " Default: #{instance.base_url}") do |u| instance.base_url = u end opts.on('-cCOOKIE', '--cookies COOKIE', 'Your cookie string', ' Get this from your browser cookie inspector') do |c| instance. = c end opts.on_tail('-h', '--help', 'Show this message') do Util.puts opts exit end opts.on_tail('--version', 'Show version') do Util.puts VERSION exit end end opt_parser.parse!(argv) instance end |
Instance Method Details
#url ⇒ Object
88 89 90 91 92 |
# File 'lib/project_monitor_stat/config.rb', line 88 def url uri = URI(base_url) uri.query = "tags=#{tags.join(',')}" uri end |