leoandruby 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d19d9b1848f02ee9c67d02130d06a6b1b166a53b100e8aa2ebd5ece0750c5c9
4
- data.tar.gz: f80c554b11679c96b91fb2575317d59f96e6475821962d28ad30466f27afe637
3
+ metadata.gz: f1367cd52f309343a6083ed35dceace0d85491460b0a4e89c61c013bc39b2cf5
4
+ data.tar.gz: 4424b97d4adf3b674eaa76f23d7c8047f2b4973c317835935dc2f520bf650c66
5
5
  SHA512:
6
- metadata.gz: a987e45d257e84d092ccab648184a00989894af51d33ba1511b0eb93558befb2f606b19652111232988acc33a825205885d3200cc3ec9995657c6a9f669a14a7
7
- data.tar.gz: cdd4ba1062881a3acd501eb14b7b418b4ebbe77948e72bf504ef82e222ab5063ffe9deba0340c97f6aad94bc7038501948856cf950c0e34066a8c269a2b21d92
6
+ metadata.gz: '09ba19275cccfcc57783db80e855e1a4284b54f67f02ba88872541ffeb160a92fc6cce69e176c8e1f7c860c47e4224b4ac306da5bc88c0d95451eea8ab017b5b'
7
+ data.tar.gz: 20a7213cc2b2308918569b1d7c02922dcb1d7194409c25c3554bfc1a2aa54a70bd992813c9877b565a9f8aea9edbacd603e1e6384d3360d9c44215d3dea8772d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
-
2
1
  # Changelog
2
+ ## [0.4.5] - 2025-04-28
3
+ ### Added
4
+ - _Describe new features here._
5
+
6
+ ### Changed
7
+ - _Describe changes here._
8
+
9
+ ### Fixed
10
+ - _Describe fixes here._
11
+
12
+
13
+ ## [0.4.4] - 2024-11-26
14
+
15
+ ### Added
16
+ - **Enhanced Image Generation**: Added support for additional Leonardo.ai API parameters:
17
+ - `alchemy`: Enable/disable Alchemy feature
18
+ - `photoReal`: Enable/disable PhotoReal feature
19
+ - `photoRealStrength`: Control PhotoReal effect strength (0.0 to 1.0)
20
+ - `presetStyle`: Apply preset styles (e.g., "CINEMATIC")
21
+
22
+ ### Improved
23
+ - Made new parameters optional to maintain backward compatibility
24
+ - Enhanced request body construction to only include provided parameters
3
25
 
4
26
  ## [0.4.3] - 2024-11-26
5
27
 
data/Rakefile CHANGED
@@ -2,5 +2,106 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "standard/rake"
5
+ require "fileutils"
5
6
 
7
+ desc "Run code formatting checks (StandardRB)"
6
8
  task default: :standard
9
+
10
+ # Clean up old built gem files
11
+ desc "Clean up old built gem files"
12
+ task :clean do
13
+ rm_f Dir["leoandruby-*.gem"]
14
+ end
15
+
16
+ # Full release: bump version, commit, tag, push, build, release
17
+ desc "Full release: bump, commit, tag, push, build and release gem"
18
+ task :full_release, [:bump] => [:standard, :clean] do |t, args|
19
+ bump_type = args[:bump] || "patch" # default to patch bump
20
+
21
+ puts "🔧 Bumping #{bump_type} version..."
22
+ bump_version(bump_type)
23
+
24
+ version = current_version
25
+ puts "🔖 New version: #{version}"
26
+
27
+ puts "✅ Committing version bump..."
28
+ sh "git add lib/leoandruby/version.rb CHANGELOG.md"
29
+ sh "git commit -m 'Bump version to #{version}'"
30
+
31
+ puts "🏷️ Tagging release..."
32
+ sh "git tag v#{version}"
33
+
34
+ puts "📤 Pushing to GitHub..."
35
+ sh "git push"
36
+ sh "git push --tags"
37
+
38
+ puts "📦 Building gem..."
39
+ sh "gem build leoandruby.gemspec"
40
+
41
+ puts "🚀 Pushing gem to RubyGems..."
42
+ sh "gem push leoandruby-#{version}.gem"
43
+
44
+ puts "🎉 Release v#{version} complete!"
45
+ end
46
+
47
+ # Helpers
48
+
49
+ def current_version
50
+ File.read("lib/leoandruby/version.rb")[/VERSION\s*=\s*["'](.+)["']/, 1]
51
+ end
52
+
53
+ def bump_version(bump_type)
54
+ file = "lib/leoandruby/version.rb"
55
+ content = File.read(file)
56
+
57
+ major, minor, patch = current_version.split(".").map(&:to_i)
58
+
59
+ case bump_type
60
+ when "major"
61
+ major += 1
62
+ minor = 0
63
+ patch = 0
64
+ when "minor"
65
+ minor += 1
66
+ patch = 0
67
+ when "patch"
68
+ patch += 1
69
+ else
70
+ raise "Unknown bump type: #{bump_type}. Use major, minor, or patch."
71
+ end
72
+
73
+ new_version = "#{major}.#{minor}.#{patch}"
74
+
75
+ new_content = content.gsub(/VERSION\s*=\s*["'](.+)["']/, "VERSION = \"#{new_version}\"")
76
+ File.write(file, new_content)
77
+
78
+ # Also automatically update CHANGELOG.md
79
+ update_changelog(new_version)
80
+ end
81
+
82
+ def update_changelog(new_version)
83
+ changelog = "CHANGELOG.md"
84
+ timestamp = Time.now.strftime("%Y-%m-%d")
85
+
86
+ entry = <<~MARKDOWN
87
+
88
+ ## [#{new_version}] - #{timestamp}
89
+ ### Added
90
+ - _Describe new features here._
91
+
92
+ ### Changed
93
+ - _Describe changes here._
94
+
95
+ ### Fixed
96
+ - _Describe fixes here._
97
+ MARKDOWN
98
+
99
+ if File.exist?(changelog)
100
+ content = File.read(changelog)
101
+ updated_content = content.sub(/^# Changelog/, "# Changelog\n#{entry.strip}\n")
102
+ File.write(changelog, updated_content)
103
+ puts "📝 Updated CHANGELOG.md"
104
+ else
105
+ puts "⚠️ CHANGELOG.md not found. Skipping changelog update."
106
+ end
107
+ end
@@ -10,20 +10,26 @@ module LeoAndRuby
10
10
  @api_key = api_key
11
11
  end
12
12
 
13
- def generate_image(prompt:, model_id:, width:, height:, num_images: 1)
13
+ def generate_image(prompt:, model_id:, width:, height:, num_images: 1, alchemy: nil, photo_real: nil, photo_real_strength: nil, preset_style: nil)
14
14
  uri = URI("#{API_BASE_URL}/generations")
15
15
  request = Net::HTTP::Post.new(uri)
16
16
  request["Accept"] = "application/json"
17
17
  request["Authorization"] = "Bearer #{@api_key}"
18
18
  request["Content-Type"] = "application/json"
19
19
 
20
- request.body = {
20
+ body = {
21
21
  prompt: prompt,
22
22
  modelId: model_id,
23
23
  width: width,
24
24
  height: height,
25
25
  num_images: num_images
26
- }.to_json
26
+ }
27
+ body[:alchemy] = alchemy unless alchemy.nil?
28
+ body[:photoReal] = photo_real unless photo_real.nil?
29
+ body[:photoRealStrength] = photo_real_strength unless photo_real_strength.nil?
30
+ body[:presetStyle] = preset_style unless preset_style.nil?
31
+
32
+ request.body = body.to_json
27
33
 
28
34
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
29
35
  http.request(request)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Leoandruby
4
- VERSION = "0.4.3"
3
+ module LeoAndRuby
4
+ VERSION = "0.4.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leoandruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard HW Baldwin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-25 00:00:00.000000000 Z
11
+ date: 2025-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails