Class: Jirify::Config
- Inherits:
-
Object
- Object
- Jirify::Config
- Defined in:
- lib/jirify/config.rb
Class Method Summary collapse
- .always_verbose ⇒ Object
- .atlassian_url ⇒ Object
- .client_options ⇒ Object
- .config_file ⇒ Object
- .initialized? ⇒ Boolean
- .issue_browse_url ⇒ Object
- .options ⇒ Object
- .statuses ⇒ Object
- .transitions ⇒ Object
- .username ⇒ Object
- .verbose(value) ⇒ Object
- .write(config) ⇒ Object
Class Method Details
.always_verbose ⇒ Object
41 42 43 |
# File 'lib/jirify/config.rb', line 41 def always_verbose ['verbose'] end |
.atlassian_url ⇒ Object
45 46 47 |
# File 'lib/jirify/config.rb', line 45 def atlassian_url ['site'] end |
.client_options ⇒ Object
80 81 82 83 84 85 86 87 88 |
# File 'lib/jirify/config.rb', line 80 def { username: ['username'], password: ['token'], site: atlassian_url, context_path: '', auth_type: :basic } end |
.config_file ⇒ Object
28 29 30 |
# File 'lib/jirify/config.rb', line 28 def config_file @config_file ||= "#{Dir.home}/.jirify" end |
.initialized? ⇒ Boolean
6 7 8 |
# File 'lib/jirify/config.rb', line 6 def initialized? File.exist? config_file end |
.issue_browse_url ⇒ Object
53 54 55 |
# File 'lib/jirify/config.rb', line 53 def issue_browse_url "#{atlassian_url}/browse/" end |
.options ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/jirify/config.rb', line 32 def unless initialized? puts 'ERROR: You must initialize Jirify first!'.red exit(0) end @options ||= YAML.load_file(config_file)['options'] end |
.statuses ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/jirify/config.rb', line 57 def statuses ['statuses'] || { 'blocked' => 'Blocked', 'todo' => 'To Do', 'in_progress' => 'In Progress', 'in_review' => 'In Review', 'done' => 'Closed' } end |
.transitions ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/jirify/config.rb', line 67 def transitions ['transitions'] || { 'block' => 'Blocked', 'unblock' => 'Unblock', 'start' => 'Start Progress', 'stop' => 'Stop Progress', 'start_review' => 'Code Review', 'stop_review' => 'Back to In Progress', 'close' => 'Close', 'reopen' => 'Reopen' } end |
.username ⇒ Object
49 50 51 |
# File 'lib/jirify/config.rb', line 49 def username ['username'] end |
.verbose(value) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jirify/config.rb', line 17 def verbose(value) unless initialized? puts 'ERROR: You must initialize Jirify first!'.red exit(0) end config = YAML.load_file(config_file) config['options']['verbose'] = value write(config) end |
.write(config) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/jirify/config.rb', line 10 def write(config) puts 'Writing config:' puts config.to_yaml File.write(config_file, config.to_yaml) end |