Class: Pomo::GithubTask

Inherits:
Task
  • Object
show all
Defined in:
lib/pomo/github_task.rb

Instance Attribute Summary collapse

Attributes inherited from Task

#complete, #description, #length, #name, #running

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

#complete?, #running?, #start

Constructor Details

#initialize(name = nil, options = {}) ⇒ GithubTask

Initialize with name and options.



41
42
43
44
# File 'lib/pomo/github_task.rb', line 41

def initialize(name = nil, options = {})
  super
  options.each { |k,v| send :"#{k}=", v }
end

Instance Attribute Details

#labelsObject

Labels array.



26
27
28
# File 'lib/pomo/github_task.rb', line 26

def labels
  @labels
end

#numberObject

Issue number.



31
32
33
# File 'lib/pomo/github_task.rb', line 31

def number
  @number
end

#projectObject

Project name.



21
22
23
# File 'lib/pomo/github_task.rb', line 21

def project
  @project
end

#urlObject

Absolute URI.



36
37
38
# File 'lib/pomo/github_task.rb', line 36

def url
  @url
end

#usernameObject

Username.



16
17
18
# File 'lib/pomo/github_task.rb', line 16

def username
  @username
end

Class Method Details

.import(user, project, number = nil) ⇒ Object

Import Github issue(s) with user, project, number as GithubTask(s).



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/pomo/github_task.rb', line 66

def self.import(user, project, number=nil)
  tasks = []

  issues = get_issues(user, project, number)

  issues.each do |issue|
    tasks << new(issue.title,
      :username => user,
      :project => project,
      :description => issue.body,
      :labels => issue.labels.map(&:name),
      :number => issue.number,
      :url => issue.html_url
    )
  end

  return tasks
end

Instance Method Details

#to_sObject

Quoted github issue name and number.



49
50
51
# File 'lib/pomo/github_task.rb', line 49

def to_s
  "#%-3s %s" % [ number, name]
end

#verbose_output(format) ⇒ Object

Output verbose task information.



56
57
58
59
60
61
# File 'lib/pomo/github_task.rb', line 56

def verbose_output(format)
  super(format)
  say format % ['labels', labels.join(', ')] if labels and not labels.empty?
  say format % ['project', [username, project].join('/')]
  say format % ['url', url ]
end