jira-cli 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -28
  3. data/bin/jira +3 -1
  4. data/lib/jira.rb +12 -6
  5. data/lib/jira/api.rb +10 -5
  6. data/lib/jira/auth_api.rb +11 -0
  7. data/lib/jira/command.rb +21 -1
  8. data/lib/jira/commands/all.rb +2 -2
  9. data/lib/jira/commands/assign.rb +2 -2
  10. data/lib/jira/commands/comment.rb +8 -98
  11. data/lib/jira/commands/comment/add.rb +46 -0
  12. data/lib/jira/commands/comment/delete.rb +80 -0
  13. data/lib/jira/commands/comment/list.rb +69 -0
  14. data/lib/jira/commands/comment/update.rb +88 -0
  15. data/lib/jira/commands/delete.rb +0 -2
  16. data/lib/jira/commands/describe.rb +0 -2
  17. data/lib/jira/commands/install.rb +39 -17
  18. data/lib/jira/commands/link.rb +4 -3
  19. data/lib/jira/commands/log.rb +7 -72
  20. data/lib/jira/commands/log/add.rb +50 -0
  21. data/lib/jira/commands/log/delete.rb +80 -0
  22. data/lib/jira/commands/log/list.rb +69 -0
  23. data/lib/jira/commands/log/update.rb +89 -0
  24. data/lib/jira/commands/new.rb +4 -6
  25. data/lib/jira/commands/rename.rb +0 -2
  26. data/lib/jira/commands/sprint.rb +3 -3
  27. data/lib/jira/commands/tickets.rb +0 -2
  28. data/lib/jira/commands/transition.rb +0 -2
  29. data/lib/jira/commands/vote.rb +5 -107
  30. data/lib/jira/commands/vote/add.rb +43 -0
  31. data/lib/jira/commands/vote/delete.rb +46 -0
  32. data/lib/jira/commands/vote/list.rb +59 -0
  33. data/lib/jira/commands/watch.rb +5 -108
  34. data/lib/jira/commands/watch/add.rb +43 -0
  35. data/lib/jira/commands/watch/delete.rb +46 -0
  36. data/lib/jira/commands/watch/list.rb +59 -0
  37. data/lib/jira/constants.rb +1 -1
  38. data/lib/jira/core.rb +9 -1
  39. data/lib/jira/sprint_api.rb +2 -18
  40. metadata +17 -5
  41. data/lib/jira/commands/commit.rb +0 -14
  42. data/lib/jira/legacy_api.rb +0 -102
  43. data/lib/jira/mixins.rb +0 -56
data/lib/jira/mixins.rb DELETED
@@ -1,56 +0,0 @@
1
- module Jira
2
- class CLI < Thor
3
-
4
- require 'json'
5
- require 'inifile'
6
- require 'tty-prompt'
7
- include Thor::Actions
8
-
9
- protected
10
-
11
- def io
12
- @io ||= TTY::Prompt.new
13
- end
14
-
15
- #
16
- # @param [Symbol]
17
- #
18
- # @return [Jira::API] Jira API class
19
- #
20
- def api(type=:rest)
21
- key = "@api_#{type}"
22
- klass = self.instance_variable_get(key)
23
- if klass.nil?
24
- klass = Jira::LegacyAPI.new(type)
25
- self.instance_variable_set(key, klass)
26
- end
27
- return klass
28
- end
29
-
30
- #
31
- # Prompts the user for a type of index, then returns the
32
- # it; failure is < 0
33
- #
34
- # @return index [Integer] asked type of index
35
- #
36
- def get_type_of_index(command, description)
37
- response = self.io.ask("Index for #{command} to #{description}:").strip
38
- return -1 if response.empty?
39
- index = response.to_i
40
- return -1 if index < 0
41
- index
42
- end
43
- end
44
- end
45
-
46
- class String
47
-
48
- def from_json
49
- JSON.parse(self) rescue {}
50
- end
51
-
52
- def periodize
53
- self.strip[-1] == "." ? self : self + "."
54
- end
55
-
56
- end