Class: Git::Whistles::Jira
- Inherits:
-
Object
- Object
- Git::Whistles::Jira
- Defined in:
- lib/git-whistles/jira.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #get_client(opts = {}) ⇒ Object
- #get_config ⇒ Object
-
#initialize ⇒ Jira
constructor
A new instance of Jira.
Constructor Details
#initialize ⇒ Jira
Returns a new instance of Jira.
6 7 8 |
# File 'lib/git-whistles/jira.rb', line 6 def initialize get_config end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/git-whistles/jira.rb', line 4 def password @password end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
4 5 6 |
# File 'lib/git-whistles/jira.rb', line 4 def site @site end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
4 5 6 |
# File 'lib/git-whistles/jira.rb', line 4 def username @username end |
Instance Method Details
#get_client(opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/git-whistles/jira.rb', line 10 def get_client(opts = {}) = { username: @username, password: @password, site: @site, context_path: '', auth_type: :basic, read_timeout: 120 } .merge!(opts) JIRA::Client.new() end |
#get_config ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/git-whistles/jira.rb', line 25 def get_config @username = `git config jira.username`.strip if username.empty? puts Term::ANSIColor.yellow %Q{ Your branch appears to have a issue ID, but I don't know your JIRA username! Please set it with: $ git config [--global] jira.username <username> } raise "Aborting." end @password = `git config jira.password`.strip if password.empty? puts Term::ANSIColor.yellow %Q{ Your branch appears to have a issue ID, but I don't know your JIRA password! Please set it with: $ git config [--global] jira.password <password> } raise "Aborting." end @site = `git config jira.site`.strip if site.empty? puts Term::ANSIColor.yellow %Q{ Your branch appears to have a issue ID, but I don't know your JIRA site! Please set it with: $ git config [--global] jira.site <https://mydomain.atlassian.net> } raise "Aborting." end end |