Class: Octopolo::Scripts::Issue

Inherits:
Object
  • Object
show all
Includes:
CLIWrapper, ConfigWrapper, GitWrapper
Defined in:
lib/octopolo/scripts/issue.rb

Direct Known Subclasses

PullRequest

Instance Attribute Summary collapse

Attributes included from GitWrapper

#git

Attributes included from ConfigWrapper

#config

Attributes included from CLIWrapper

#cli

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Issue

Returns a new instance of Issue.



27
28
29
# File 'lib/octopolo/scripts/issue.rb', line 27

def initialize(options={})
  @options = options
end

Instance Attribute Details

#issueObject

Returns the value of attribute issue.



17
18
19
# File 'lib/octopolo/scripts/issue.rb', line 17

def issue
  @issue
end

#jira_idsObject

Returns the value of attribute jira_ids.



19
20
21
# File 'lib/octopolo/scripts/issue.rb', line 19

def jira_ids
  @jira_ids
end

#labelsObject

Returns the value of attribute labels.



20
21
22
# File 'lib/octopolo/scripts/issue.rb', line 20

def labels
  @labels
end

#optionsObject

Returns the value of attribute options.



21
22
23
# File 'lib/octopolo/scripts/issue.rb', line 21

def options
  @options
end

#pivotal_idsObject

Returns the value of attribute pivotal_ids.



18
19
20
# File 'lib/octopolo/scripts/issue.rb', line 18

def pivotal_ids
  @pivotal_ids
end

#titleObject

Returns the value of attribute title.



16
17
18
# File 'lib/octopolo/scripts/issue.rb', line 16

def title
  @title
end

Class Method Details

.execute(options = {}) ⇒ Object



23
24
25
# File 'lib/octopolo/scripts/issue.rb', line 23

def self.execute(options={})
  new(options).execute
end

Instance Method Details

#ask_jira_idsObject

Protected: Ask for a Jira Tracker story IDs



87
88
89
90
# File 'lib/octopolo/scripts/issue.rb', line 87

def ask_jira_ids
  response = Octopolo::Question.new(prompt: "Jira story ID(s):").prompt
  self.jira_ids = response.split(/[\s,]+/)
end

#executeObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/octopolo/scripts/issue.rb', line 31

def execute
  GitHub.connect do
    ask_questionaire
    create_issue
    update_pivotal
    update_jira
    update_labels
    open_in_browser
  end
end

#generate_generic_label_choicesObject



135
136
137
# File 'lib/octopolo/scripts/issue.rb', line 135

def generate_generic_label_choices
  Octopolo::GitHub::Label.get_names(label_choices).concat(["None"])
end

#label_choicesObject



139
140
141
# File 'lib/octopolo/scripts/issue.rb', line 139

def label_choices
  Octopolo::GitHub::Label.all
end

#label_hashObject



143
144
145
# File 'lib/octopolo/scripts/issue.rb', line 143

def label_hash
  Hash[label_choices.map{ |l| [l.name, l] }]
end

#label_promptObject



131
132
133
# File 'lib/octopolo/scripts/issue.rb', line 131

def label_prompt
  "Label:"
end

#label_questionsObject



121
122
123
124
125
126
127
128
129
# File 'lib/octopolo/scripts/issue.rb', line 121

def label_questions
  [
    Octopolo::Question.new(
      prompt: label_prompt,
      type: :ask,
      choices: generate_generic_label_choices
    )
  ]
end