Class: Jira::Core
- Inherits:
-
Object
- Object
- Jira::Core
- Defined in:
- lib/jira/core.rb
Class Method Summary collapse
-
.auth_path ⇒ String
Path to .jira-auth file.
-
.password ⇒ String
JIRA password.
-
.root_path ⇒ String
Path of root git directory.
-
.setup ⇒ Object
Memoizes url, username, and password.
-
.ticket ⇒ String
Default ticket is the current branch.
-
.ticket?(ticket) ⇒ Boolean
Determines whether or not the input ticket matches the expected JIRA ticketing syntax.
-
.url ⇒ String
JIRA project endpoint.
-
.url_path ⇒ String
Path to .jira-url file.
-
.username ⇒ String
JIRA username.
Class Method Details
.auth_path ⇒ String
Returns path to .jira-auth file.
67 68 69 |
# File 'lib/jira/core.rb', line 67 def auth_path @auth_path ||= self.root_path + "/.jira-auth" end |
.password ⇒ String
Returns JIRA password.
32 33 34 |
# File 'lib/jira/core.rb', line 32 def password @password ||= self.auth.last end |
.root_path ⇒ String
Returns path of root git directory.
74 75 76 77 78 79 80 81 |
# File 'lib/jira/core.rb', line 74 def root_path return @root_path if !@root_path.nil? if !system('git rev-parse 2> /dev/null') puts "JIRA commands can only be run within a git repository." abort end @root_path ||= `git rev-parse --show-toplevel`.strip end |
.setup ⇒ Object
Memoizes url, username, and password
8 9 10 11 |
# File 'lib/jira/core.rb', line 8 def setup self.url self.auth end |
.ticket ⇒ String
Returns default ticket is the current branch.
39 40 41 |
# File 'lib/jira/core.rb', line 39 def ticket `git rev-parse --abbrev-ref HEAD`.strip end |
.ticket?(ticket) ⇒ Boolean
Determines whether or not the input ticket matches the expected JIRA ticketing syntax.
51 52 53 |
# File 'lib/jira/core.rb', line 51 def ticket?(ticket) !!ticket[/^[a-zA-Z]+-[0-9]+$/] end |
.url ⇒ String
Returns JIRA project endpoint.
18 19 20 |
# File 'lib/jira/core.rb', line 18 def url @url ||= self.read(self.url_path) end |
.url_path ⇒ String
Returns path to .jira-url file.
60 61 62 |
# File 'lib/jira/core.rb', line 60 def url_path @url_path ||= self.root_path + "/.jira-url" end |
.username ⇒ String
Returns JIRA username.
25 26 27 |
# File 'lib/jira/core.rb', line 25 def username @username ||= self.auth.first end |