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 +4 -4
- data/lib/mokkku/cli/runner.rb +17 -12
- data/lib/mokkku/cli/validator.rb +2 -2
- data/lib/mokkku/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a918d20e114108edde5cd017fbbb18329cac43272aba65110042e3a27fb7f77c
|
4
|
+
data.tar.gz: 2c0114ee979c6a69640f3e128d27cc56f1d2fd879fc260afbed13c35a0e476c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0029fbefa5b22bbd3001b701a051a80194389c6a585a44cb4f585542d378f505dab66ca09e40ea04e4c77b9d16c6471acbe9284537e6b9f2ce31bcb1b57fc618'
|
7
|
+
data.tar.gz: 78697aed768e3c0476be71e2cf69dbdc09e3afb1b8cc30f7cc676e689245d4b0e529e1e604b63dca182fc802a0f597d84115b2054890da5e2c7e44f7b78002c7
|
data/lib/mokkku/cli/runner.rb
CHANGED
@@ -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
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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!'
|
data/lib/mokkku/cli/validator.rb
CHANGED
@@ -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
|
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
|
data/lib/mokkku/version.rb
CHANGED
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.
|
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.
|
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
|