Class: IssueBeaver::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/issue_beaver/runner.rb

Constant Summary collapse

COMMANDS =
%w(find status diff commit help)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(*args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/issue_beaver/runner.rb', line 9

def self.run(*args)
  command = args[0]
  runner = self.new
  command = args[0]
  command = "unknown" unless COMMANDS.include? command
  runner.send(command, *args)
end

Instance Method Details

#commit(*args) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/issue_beaver/runner.rb', line 51

def commit(*args)
  config['dir'] = dir(args[1]) if args[1]
  issues = merger(github_issues.all, todo_comments.all).changed
  issues.each do |issue|
    issue.save
  end
end

#diff(*args) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/issue_beaver/runner.rb', line 40

def diff(*args)
  config['dir'] = dir(args[1]) if args[1]
  issues = merger(github_issues.all, todo_comments.all).changed
  if issues.any?
    _list_diff(issues)
  else
    puts "Nothing new"
  end
end

#find(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/issue_beaver/runner.rb', line 18

def find(*args)
  config['dir'] = dir(args[1]) if args[1]

  if todo_comments.all.any?
    _list_status(todo_comments.all)
  else
    puts "Nothing found"
  end
end

#helpObject



60
61
62
# File 'lib/issue_beaver/runner.rb', line 60

def help
  puts "Available commands: #{COMMANDS.join(", ")}"
end

#status(*args) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/issue_beaver/runner.rb', line 29

def status(*args)
  config['dir'] = dir(args[1]) if args[1]
  issues = merger(github_issues.all, todo_comments.all).changed
  if issues.any?
    _list_status(issues)
  else
    puts "Nothing new"
  end
end