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 hint_probability irb_flags linear_api_key linear_team_ids ].freeze
- ALLOWED_LOCAL_SETTINGS =
%w[ linear_team_ids ].freeze
- SETTINGS_WARNED =
'GEORDI_INVALID_SETTINGS_WARNED'
Instance Method Summary collapse
- #auto_update_chromedriver ⇒ Object
- #auto_update_chromedriver=(value) ⇒ Object
- #hint_probability ⇒ Object
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
-
#irb_flags ⇒ Object
Global settings.
- #linear_api_key ⇒ Object
- #linear_api_key=(value) ⇒ Object
- #linear_team_ids ⇒ Object
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
23 24 25 |
# File 'lib/geordi/settings.rb', line 23 def initialize read_settings end |
Instance Method Details
#auto_update_chromedriver ⇒ Object
48 49 50 |
# File 'lib/geordi/settings.rb', line 48 def auto_update_chromedriver @global_settings["auto_update_chromedriver"] || false end |
#auto_update_chromedriver=(value) ⇒ Object
52 53 54 55 |
# File 'lib/geordi/settings.rb', line 52 def auto_update_chromedriver=(value) @global_settings['auto_update_chromedriver'] = value save_global_settings end |
#hint_probability ⇒ Object
44 45 46 |
# File 'lib/geordi/settings.rb', line 44 def hint_probability @global_settings['hint_probability'] end |
#irb_flags ⇒ Object
Global settings
28 29 30 |
# File 'lib/geordi/settings.rb', line 28 def irb_flags @global_settings['irb_flags'] end |
#linear_api_key ⇒ Object
32 33 34 35 36 37 |
# File 'lib/geordi/settings.rb', line 32 def linear_api_key @global_settings['linear_api_key'] || begin Interaction.warn 'Linear API key not found' inquire_linear_api_key end end |
#linear_api_key=(value) ⇒ Object
39 40 41 42 |
# File 'lib/geordi/settings.rb', line 39 def linear_api_key=(value) @global_settings['linear_api_key'] = value save_global_settings end |
#linear_team_ids ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/geordi/settings.rb', line 57 def linear_team_ids local_team_ids = normalize_team_ids(@local_settings['linear_team_ids']) global_team_ids = normalize_team_ids(@global_settings['linear_team_ids']) team_ids = local_team_ids | global_team_ids if team_ids.empty? Geordi::Interaction.warn 'No team id found.' puts 'Please open a team in Linear, open the command menu with CTRL + K and choose' puts "\"Copy model UUID\". Store that team id in #{LOCAL_SETTINGS_FILE_NAME}:" puts 'linear_team_ids: abc-123-123-abc, def-456-456-def' exit 1 end team_ids end |