mokkku 0.0.3 → 0.0.5

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: 04c69427e72610fa1be06c75060a255eb0ab45c64b3e1a65a5649aa2420552f7
4
- data.tar.gz: efc88cd532cd54f28ae0dc4fb2c8cfba8fb0d3e674183494fdc47ef8adcfef15
3
+ metadata.gz: 9dd97441b73b6ba8795909cfc1115ff90ca6b63a16fe0a2e9ea00a3d75f44933
4
+ data.tar.gz: 79041506c510a3c642c8cf0e9b0db97117df43f6b8a3e09257dcd8e6ded08721
5
5
  SHA512:
6
- metadata.gz: afc7eb5280d025becdd44e0bd65412645a15bea68812ccc3c09a9179f79b2327faed3937c326c5da56f484a29cafc65e2d1f7bdf98550fff3d8a40995698f864
7
- data.tar.gz: e07d24c250a66e1550da05e37a4961c3d4ad0e389e905aa662ca514ac9b96af48c263d3c24fab1e5281884f267381c5fbe588d8c67cd1540981388e81d707e81
6
+ metadata.gz: aa603c3e83ee372173558dfeabbb0969f9eb6cd45a313c447555e71961446fa97416c9a563f54bd3f810a7e5aa984881a419d01208e163a166b59dbcacf0d186
7
+ data.tar.gz: 94d08b8ea75f384f78f473794a5862e614c53fa50388fee8b51bdc4283fdc869f81394e66d0873740fad795a007f119fb4231c6311d78c39c97e5848eee5a4ee
data/bin/mokkku CHANGED
@@ -38,4 +38,18 @@ OptionParser.new do |opts|
38
38
  end
39
39
  end.parse!
40
40
 
41
+ # Load Rails project
42
+ begin
43
+ require File.join(base_dir, 'config', 'boot')
44
+ require File.join(base_dir, 'config', 'environment')
45
+ rescue LoadError
46
+ puts "\nUh-oh! You must be in the root directory of a Rails project.\n"
47
+ raise
48
+ end
49
+
50
+ # Load Rails models
51
+ Rails.application.eager_load! if defined?(Rails)
52
+ # Rails 6 support
53
+ Zeitwerk::Loader.eager_load_all if defined?(Zeitwerk)
54
+
41
55
  Mokkku::Cli::Runner.start(options)
@@ -1,5 +1,6 @@
1
1
  require_relative 'gpt'
2
2
  require_relative 'claude'
3
+ require_relative 'gemini'
3
4
 
4
5
  module Mokkku
5
6
  module Generators
@@ -12,6 +13,8 @@ module Mokkku
12
13
  Mokkku::Generators::Gpt
13
14
  when 'claude'
14
15
  Mokkku::Generators::Claude
16
+ when 'gemini'
17
+ Mokkku::Generators::Gemini
15
18
  else
16
19
  raise UnsupportedGenerator
17
20
  end
@@ -0,0 +1,23 @@
1
+ require 'gemini-ai'
2
+
3
+ module Mokkku
4
+ module Generators
5
+ class Gemini
6
+ def self.call(api_key:, prompt:)
7
+ client = ::Gemini.new(
8
+ credentials: {
9
+ service: 'generative-language-api',
10
+ api_key: api_key
11
+ },
12
+ options: { model: 'gemini-pro', server_sent_events: false }
13
+ )
14
+
15
+ result = client.generate_content({
16
+ contents: { role: 'user', parts: { text: prompt } }
17
+ })
18
+
19
+ result['candidates'].first['content']['parts'].first['text']
20
+ end
21
+ end
22
+ end
23
+ end
@@ -3,7 +3,7 @@ module Mokkku
3
3
  module_function
4
4
 
5
5
  def to_s
6
- '0.0.3'
6
+ '0.0.5'
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.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski
@@ -72,6 +72,20 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.3.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: gemini-ai
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '4.2'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '4.2'
75
89
  description: Generate mock data that is unique for your application
76
90
  email: contact@paweldabrowski.com
77
91
  executables:
@@ -86,6 +100,7 @@ files:
86
100
  - lib/mokkku/cli/validator.rb
87
101
  - lib/mokkku/generators/builder.rb
88
102
  - lib/mokkku/generators/claude.rb
103
+ - lib/mokkku/generators/gemini.rb
89
104
  - lib/mokkku/generators/gpt.rb
90
105
  - lib/mokkku/mocked_object.rb
91
106
  - lib/mokkku/utils.rb