Class: Geordi::Settings
- Inherits:
-
Object
- Object
- Geordi::Settings
- Defined in:
- lib/geordi/settings.rb
Constant Summary collapse
- GLOBAL_SETTINGS_FILE_NAME =
Util.testing? ? './tmp/global_settings.yml'.freeze : File.join(ENV['HOME'], '.config/geordi/global.yml').freeze
- LOCAL_SETTINGS_FILE_NAME =
Util.testing? ? './tmp/local_settings.yml'.freeze : './.geordi.yml'.freeze
- ALLOWED_GLOBAL_SETTINGS =
%w[ auto_update_chromedriver git_initials hint_probability irb_flags pivotal_tracker_api_key pivotal_tracker_project_ids ].freeze
- ALLOWED_LOCAL_SETTINGS =
%w[ pivotal_tracker_project_ids ].freeze
- SETTINGS_WARNED =
'GEORDI_INVALID_SETTINGS_WARNED'
Instance Method Summary collapse
- #auto_update_chromedriver ⇒ Object
- #auto_update_chromedriver=(value) ⇒ Object
- #git_initials ⇒ Object
- #git_initials=(value) ⇒ Object
- #hint_probability ⇒ Object
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
-
#irb_flags ⇒ Object
Global settings.
- #pivotal_tracker_api_key ⇒ Object
- #pivotal_tracker_api_key=(value) ⇒ Object
- #pivotal_tracker_project_ids ⇒ Object
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
24 25 26 |
# File 'lib/geordi/settings.rb', line 24 def initialize read_settings end |
Instance Method Details
#auto_update_chromedriver ⇒ Object
55 56 57 |
# File 'lib/geordi/settings.rb', line 55 def auto_update_chromedriver @global_settings["auto_update_chromedriver"] || false end |
#auto_update_chromedriver=(value) ⇒ Object
59 60 61 62 |
# File 'lib/geordi/settings.rb', line 59 def auto_update_chromedriver=(value) @global_settings['auto_update_chromedriver'] = value save_global_settings end |
#git_initials ⇒ Object
46 47 48 |
# File 'lib/geordi/settings.rb', line 46 def git_initials @global_settings['git_initials'] end |
#git_initials=(value) ⇒ Object
50 51 52 53 |
# File 'lib/geordi/settings.rb', line 50 def git_initials=(value) @global_settings['git_initials'] = value save_global_settings end |
#hint_probability ⇒ Object
42 43 44 |
# File 'lib/geordi/settings.rb', line 42 def hint_probability @global_settings['hint_probability'] end |
#irb_flags ⇒ Object
Global settings
29 30 31 |
# File 'lib/geordi/settings.rb', line 29 def irb_flags @global_settings['irb_flags'] end |
#pivotal_tracker_api_key ⇒ Object
33 34 35 |
# File 'lib/geordi/settings.rb', line 33 def pivotal_tracker_api_key @global_settings['pivotal_tracker_api_key'] || gitpt_api_key_old || inquire_pt_api_key end |
#pivotal_tracker_api_key=(value) ⇒ Object
37 38 39 40 |
# File 'lib/geordi/settings.rb', line 37 def pivotal_tracker_api_key=(value) @global_settings['pivotal_tracker_api_key'] = value save_global_settings end |
#pivotal_tracker_project_ids ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/geordi/settings.rb', line 64 def pivotal_tracker_project_ids local_project_ids = @local_settings['pivotal_tracker_project_ids'] || pt_project_ids_old global_project_ids = @global_settings['pivotal_tracker_project_ids'] local_project_ids = array_wrap_project_ids(local_project_ids) global_project_ids = array_wrap_project_ids(global_project_ids) project_ids = local_project_ids | global_project_ids if project_ids.empty? puts Geordi::Interaction.warn "Sorry, I could not find a project ID in .geordi.yml :(" puts puts "Please put at least one Pivotal Tracker project id into the .geordi.yml file in this directory, e.g." puts puts "pivotal_tracker_project_ids:" puts "- 123456" puts puts 'You may add multiple IDs.' exit 1 end project_ids end |