Class: IssueBeaver::Runner
- Inherits:
-
Object
- Object
- IssueBeaver::Runner
- 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
- #commit(*args) ⇒ Object
- #diff(*args) ⇒ Object
- #find(*args) ⇒ Object
- #help(*args) ⇒ Object
- #status(*args) ⇒ Object
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] || "help" 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) load_config(args) 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) load_config(args) 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) load_config(args) if todo_comments.all.any? _list_status(todo_comments.all) else puts "Nothing found" end end |
#help(*args) ⇒ Object
60 61 62 63 64 |
# File 'lib/issue_beaver/runner.rb', line 60 def help(*args) puts "Issue Beaver version #{IssueBeaver::VERSION}" puts "usage: issuebeaver <command> [directory]" 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) load_config(args) issues = merger(github_issues.all, todo_comments.all).changed if issues.any? _list_status(issues) else puts "Nothing new" end end |