Skip to content

Commit

Permalink
Make ready label configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
antico5 committed Aug 2, 2018
1 parent 1348892 commit 3b93b14
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/waff/commands/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module Waff
module Commands
class List < Command
def call params
ready_issues = github_repo.get_open_issues 'ready'
ready_issues += github_repo.get_open_issues 'to do'
ready_issues = github_repo.get_open_issues Config.ready_label
puts "Ready: \n\n"
ready_issues.each do |issue|
puts "##{issue.number}\t #{issue.title}"
Expand Down
12 changes: 12 additions & 0 deletions lib/waff/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,35 @@ def get_owner_and_repo
url[/:(.*)\.git/, 1] || raise(REMOTE_NOT_FOUND)
end

def ready_label
config['ready_label'] || 'to do'
end

def init_config!
return if File.exist?(CONFIG_FILE)

puts "No config file detected (#{CONFIG_FILE}). Will generate one now in current directory."

print 'Github username: '
user = $stdin.gets

print 'Github password/personal token: '
token = $stdin.gets

print 'Git remote (leave empty for "origin"): '
remote = $stdin.gets.strip
remote = remote.empty? ? 'origin' : remote

print 'Ready label (leave empty for "to do"): '
ready_label = $stdin.gets.strip
ready_label = ready_label.empty? ? 'to do' : ready_label

# Write config file
File.open(CONFIG_FILE, 'w') do |file|
file.puts "user: #{user}"
file.puts "token: #{token}"
file.puts "remote: #{remote}"
file.puts "ready_label: #{ready_label}"
end

# Write exclude file
Expand Down
6 changes: 2 additions & 4 deletions lib/waff/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ def assign_to_self!
end

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

repository.export_labels self
end

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

Expand Down

0 comments on commit 3b93b14

Please sign in to comment.