Class: Waff::Issue

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository, data) ⇒ Issue

Returns a new instance of Issue.



5
6
7
8
9
10
11
# File 'lib/waff/issue.rb', line 5

def initialize(repository, data)
  @repository = repository
  @number = data['number']
  @title = data['title']
  @body = data['body']
  parse_labels data
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/waff/issue.rb', line 3

def body
  @body
end

#labelsObject (readonly)

Returns the value of attribute labels.



3
4
5
# File 'lib/waff/issue.rb', line 3

def labels
  @labels
end

#numberObject (readonly)

Returns the value of attribute number.



3
4
5
# File 'lib/waff/issue.rb', line 3

def number
  @number
end

#repositoryObject (readonly)

Returns the value of attribute repository.



3
4
5
# File 'lib/waff/issue.rb', line 3

def repository
  @repository
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/waff/issue.rb', line 3

def title
  @title
end

Instance Method Details

#assign_to_self!Object



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

def assign_to_self!
  repository.assign_issue number
end

#create_local_branch!Object



13
14
15
16
17
# File 'lib/waff/issue.rb', line 13

def create_local_branch!
  branch_name = "#{number}-#{slug}"
  puts "Creating branch #{branch_name}"
  `git checkout -b '#{branch_name}'`
end

#mark_in_progress!Object



23
24
25
26
27
28
29
# File 'lib/waff/issue.rb', line 23

def mark_in_progress!
  labels.delete Config.ready_label
  labels << 'in progress'
  labels.uniq!

  repository.export_labels self
end

#mark_ready!Object



31
32
33
34
35
36
37
# File 'lib/waff/issue.rb', line 31

def mark_ready!
  labels << Config.ready_label
  labels.delete 'in progress'
  labels.uniq!

  repository.export_labels self
end