Class: Jira::Core
- Inherits:
-
Object
- Object
- Jira::Core
- Defined in:
- lib/jira/core.rb
Class Method Summary collapse
-
.cli_path ⇒ String
Path to .jira-cli file.
- .config ⇒ Object
-
.cookie ⇒ Hash
JIRA cookie.
-
.password ⇒ String
JIRA password.
-
.rescue_cookie_path ⇒ String
Path to .jira-rescue-cookie file.
-
.ticket?(ticket, verbose = true) ⇒ Boolean
Determines whether or not the input ticket matches the expected JIRA ticketing syntax.
-
.token ⇒ String
JIRA token.
-
.url ⇒ String
JIRA project endpoint.
-
.username ⇒ String
JIRA username.
Class Method Details
.cli_path ⇒ String
Returns path to .jira-cli file.
64 65 66 |
# File 'lib/jira/core.rb', line 64 def cli_path @cli_path ||= "#{Dir.home}/.jira-cli" end |
.config ⇒ Object
75 76 77 78 79 80 |
# File 'lib/jira/core.rb', line 75 def config @config ||= ( raise InstallationException unless File.exist?(cli_path) IniFile.load(cli_path, comment: '#', encoding: 'UTF-8') ) end |
.cookie ⇒ Hash
Returns JIRA cookie.
36 37 38 39 |
# File 'lib/jira/core.rb', line 36 def return {} if config[:cookie].nil? || config[:cookie].empty? { name: config[:cookie]['name'], value: config[:cookie]['value'] } end |
.password ⇒ String
Returns JIRA password.
22 23 24 |
# File 'lib/jira/core.rb', line 22 def password @password ||= ENV['JIRA_PASSWORD'] || config[:global]['password'] end |
.rescue_cookie_path ⇒ String
Returns path to .jira-rescue-cookie file.
71 72 73 |
# File 'lib/jira/core.rb', line 71 def @rescue_cookie_path ||= "#{Dir.home}/.jira-rescue-cookie" end |
.ticket?(ticket, verbose = true) ⇒ Boolean
Determines whether or not the input ticket matches the expected JIRA ticketing syntax. Outputs a warning that the input ticket isn’t a valid ticket.
51 52 53 54 55 56 57 |
# File 'lib/jira/core.rb', line 51 def ticket?(ticket, verbose=true) !!ticket.to_s[/^[a-zA-Z]+-[0-9]+$/] and return true if verbose puts "#{Jira::Format.ticket(ticket)} is not a valid JIRA ticket." end false end |
.token ⇒ String
Returns JIRA token.
29 30 31 |
# File 'lib/jira/core.rb', line 29 def token @token ||= ENV['JIRA_TOKEN'] || config[:global]['token'] end |
.url ⇒ String
Returns JIRA project endpoint.
8 9 10 |
# File 'lib/jira/core.rb', line 8 def url @url ||= ENV['JIRA_URL'] || config[:global]['url'] end |
.username ⇒ String
Returns JIRA username.
15 16 17 |
# File 'lib/jira/core.rb', line 15 def username @username ||= ENV['JIRA_USERNAME'] || config[:global]['username'] end |