mokkku 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bc74f6aa066c531790d02be4d8b461978dd586b0a8c3f4275b0e74d2d12d5c7
4
- data.tar.gz: 630c84be5245471760c79f245caacc240b733cded99c11db2761fb9655d70a12
3
+ metadata.gz: a918d20e114108edde5cd017fbbb18329cac43272aba65110042e3a27fb7f77c
4
+ data.tar.gz: 2c0114ee979c6a69640f3e128d27cc56f1d2fd879fc260afbed13c35a0e476c0
5
5
  SHA512:
6
- metadata.gz: f738b67f66cc8dac9d73104eda8f01152cd173ecba1787f8b6be2acecf9f9726552cdcf51d0ab91de36db91c925872e93e122bae5a39abecb7a0c47ebea9eabb
7
- data.tar.gz: dd6b831f50e46b375dafa703eb165f6be1f4dd6097f50201f7fdef5ab40f6b7364b30371f94acd8a088afe615891ebc37079372508828d06ffc0500c817e5097
6
+ metadata.gz: '0029fbefa5b22bbd3001b701a051a80194389c6a585a44cb4f585542d378f505dab66ca09e40ea04e4c77b9d16c6471acbe9284537e6b9f2ce31bcb1b57fc618'
7
+ data.tar.gz: 78697aed768e3c0476be71e2cf69dbdc09e3afb1b8cc30f7cc676e689245d4b0e529e1e604b63dca182fc802a0f597d84115b2054890da5e2c7e44f7b78002c7
@@ -12,20 +12,25 @@ module Mokkku
12
12
  options[:models].each do |model_name|
13
13
  columns = Object.const_get(model_name).columns
14
14
  prompt = ::Mokkku::Cli::Prompt.generate(model_name, columns, options.fetch(:mocks_count, 10), options.fetch(:language, 'english'))
15
- generator = ::Mokkku::Generators::Builder.call(
16
- generator: options[:llm_model],
17
- api_key: options[:llm_api_key],
18
- prompt: prompt
19
- )
20
15
 
21
- yaml_mock = generator.call(api_key: options[:llm_api_key], prompt: prompt)
22
- mock_file_name = model_name.to_s.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
16
+ if options.key?(:llm_model) && options.key?(:llm_api_key)
17
+ generator = ::Mokkku::Generators::Builder.call(
18
+ generator: options[:llm_model],
19
+ api_key: options[:llm_api_key],
20
+ prompt: prompt
21
+ )
23
22
 
24
- puts "Write mocks for #{model_name} model in #{mock_file_name}.yml"
25
- File.write(
26
- File.join(options.fetch(:mocks_path, './spec/mocks'), "#{mock_file_name}.yml"),
27
- ::Mokkku::YamlSanitizer.sanitize(yaml_mock)
28
- )
23
+ yaml_mock = generator.call(api_key: options[:llm_api_key], prompt: prompt)
24
+ mock_file_name = model_name.to_s.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
25
+
26
+ puts "Write mocks for #{model_name} model in #{mock_file_name}.yml"
27
+ File.write(
28
+ File.join(options.fetch(:mocks_path, './spec/mocks'), "#{mock_file_name}.yml"),
29
+ ::Mokkku::YamlSanitizer.sanitize(yaml_mock)
30
+ )
31
+ else
32
+ puts "Prompt for #{model_name} model: \n\n#{prompt}"
33
+ end
29
34
  end
30
35
 
31
36
  puts 'Done!'
@@ -7,8 +7,8 @@ module Mokkku
7
7
 
8
8
  def self.validate_options!(options)
9
9
  raise ModelsNotProvided if options.fetch(:models, []).empty?
10
- raise InvalidLlmModel unless %w[gpt gemini claude].include?(options[:llm_model].to_s.downcase)
11
- raise LlmApiKeyNotProvided if options[:llm_api_key].to_s == ''
10
+ raise InvalidLlmModel if options.key?(:llm_model) && !%w[gpt gemini claude].include?(options[:llm_model].to_s.downcase)
11
+ raise LlmApiKeyNotProvided if options[:llm_api_key].to_s == '' && options.key?(:llm_model)
12
12
  end
13
13
  end
14
14
  end
@@ -3,7 +3,7 @@ module Mokkku
3
3
  module_function
4
4
 
5
5
  def to_s
6
- '0.0.7'
6
+ '0.0.8'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mokkku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubygems_version: 3.2.32
127
+ rubygems_version: 3.4.10
128
128
  signing_key:
129
129
  specification_version: 4
130
130
  summary: Generate mock data that is unique for your application