Class: CommitCraft::Configuration
- Inherits:
-
Object
- Object
- CommitCraft::Configuration
- Defined in:
- lib/commitcraft/configuration.rb
Constant Summary collapse
- SUPPORTED_MODELS =
%w[ gemini-2.5-flash gemini-2.5-pro gemini-2.0-flash gemini-flash-latest gemini-pro-latest gemini-2.5-flash-lite ].freeze
- COMMIT_STYLES =
%w[ conventional semantic descriptive custom ].freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#commit_style ⇒ Object
Returns the value of attribute commit_style.
-
#jira_prefix ⇒ Object
Returns the value of attribute jira_prefix.
-
#max_tokens ⇒ Object
Returns the value of attribute max_tokens.
-
#model ⇒ Object
Returns the value of attribute model.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
-
#test_mode ⇒ Object
Returns the value of attribute test_mode.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/commitcraft/configuration.rb', line 23 def initialize load_config_file @api_key ||= ENV.fetch("GEMINI_API_KEY", nil) @model ||= "gemini-2.5-flash" @max_tokens ||= 1000 @temperature ||= 0.7 @commit_style ||= "conventional" @jira_prefix ||= nil @test_mode = ENV["COMMITCRAFT_TEST_MODE"] == "true" end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def api_key @api_key end |
#commit_style ⇒ Object
Returns the value of attribute commit_style.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def commit_style @commit_style end |
#jira_prefix ⇒ Object
Returns the value of attribute jira_prefix.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def jira_prefix @jira_prefix end |
#max_tokens ⇒ Object
Returns the value of attribute max_tokens.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def max_tokens @max_tokens end |
#model ⇒ Object
Returns the value of attribute model.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def model @model end |
#temperature ⇒ Object
Returns the value of attribute temperature.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def temperature @temperature end |
#test_mode ⇒ Object
Returns the value of attribute test_mode.
5 6 7 |
# File 'lib/commitcraft/configuration.rb', line 5 def test_mode @test_mode end |
Instance Method Details
#validate! ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/commitcraft/configuration.rb', line 34 def validate! return if @test_mode raise ConfigurationError, "API key is required" if api_key.nil? || api_key.empty? raise ConfigurationError, "Invalid model: #{model}" unless SUPPORTED_MODELS.include?(model) raise ConfigurationError, "Invalid commit style: #{commit_style}" unless COMMIT_STYLES.include?(commit_style) validate_jira_prefix! if jira_prefix end |