generate_image 1.1.2.2 → 2.0.0

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.
@@ -0,0 +1,83 @@
1
+ # Build (and optionally push) generate_image using Docker - no local Ruby required.
2
+ # Usage (from repo root generate_image/):
3
+ # scripts\gem-docker.cmd build
4
+ # scripts\gem-docker.cmd push
5
+ #
6
+ # For push: set GEM_HOST_API_KEY (RubyGems API key from https://rubygems.org/profile/edit)
7
+ # Optional: load from .env at repo root (see .env.example). Existing env vars win.
8
+ #
9
+ # MFA (rubygems_mfa_required on this gem): use interactive push, or set GEM_HOST_OTP_CODE for this session only.
10
+
11
+ param(
12
+ [Parameter(Position = 0)]
13
+ [ValidateSet("build", "push")]
14
+ [string]$Action = "build"
15
+ )
16
+
17
+ $ErrorActionPreference = "Stop"
18
+ $Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
19
+
20
+ function Import-DotEnvIfUnset {
21
+ param([string]$EnvPath)
22
+ if (-not (Test-Path $EnvPath)) { return }
23
+ Get-Content -LiteralPath $EnvPath -Encoding UTF8 | ForEach-Object {
24
+ $line = $_.Trim()
25
+ if ($line -match '^\s*#' -or $line -eq '') { return }
26
+ $eq = $line.IndexOf('=')
27
+ if ($eq -lt 0) { return }
28
+ $key = $line.Substring(0, $eq).Trim()
29
+ if ($key -eq '') { return }
30
+ $val = $line.Substring($eq + 1).Trim()
31
+ if (($val.StartsWith('"') -and $val.EndsWith('"')) -or ($val.StartsWith("'") -and $val.EndsWith("'"))) {
32
+ $val = $val.Substring(1, $val.Length - 2)
33
+ }
34
+ $existing = [Environment]::GetEnvironmentVariable($key, "Process")
35
+ if ([string]::IsNullOrEmpty($existing)) {
36
+ Set-Item -Path "env:$key" -Value $val
37
+ }
38
+ }
39
+ }
40
+
41
+ function Get-GemVersion {
42
+ param([string]$RepoRoot)
43
+ $path = Join-Path $RepoRoot "lib\generate_image\version.rb"
44
+ $raw = Get-Content -LiteralPath $path -Raw -Encoding UTF8
45
+ if ($raw -match 'VERSION\s*=\s*"([0-9.]+)"') {
46
+ return $Matches[1]
47
+ }
48
+ throw "Could not parse VERSION from $path"
49
+ }
50
+
51
+ if ($Action -eq "build") {
52
+ $buildInner = "export DEBIAN_FRONTEND=noninteractive && apt-get update -qq && apt-get install -y --no-install-recommends git >/dev/null && gem build generate_image.gemspec && ls -la *.gem"
53
+ docker run --rm -v "${Root}:/gem" -w /gem ruby:3.2-slim bash -lc $buildInner
54
+ Write-Host ""
55
+ Write-Host "Gem file is in: $Root" -ForegroundColor Green
56
+ exit 0
57
+ }
58
+
59
+ if ($Action -eq "push") {
60
+ Import-DotEnvIfUnset -EnvPath (Join-Path $Root ".env")
61
+ if (-not $env:GEM_HOST_API_KEY) {
62
+ Write-Host "Set GEM_HOST_API_KEY (RubyGems API key) in .env or your shell." -ForegroundColor Red
63
+ Write-Host ' $env:GEM_HOST_API_KEY = "rubygems_..."' -ForegroundColor Yellow
64
+ Write-Host "Create a key at: https://rubygems.org/profile/edit" -ForegroundColor Cyan
65
+ exit 1
66
+ }
67
+ $Version = Get-GemVersion -RepoRoot $Root
68
+ $GemFile = "generate_image-$Version.gem"
69
+ $gemPath = Join-Path $Root $GemFile
70
+ if (-not (Test-Path $gemPath)) {
71
+ Write-Host "Missing $GemFile - run: scripts\gem-docker.cmd build" -ForegroundColor Red
72
+ exit 1
73
+ }
74
+ $inner = "gem push $GemFile"
75
+ if (-not [string]::IsNullOrEmpty($env:GEM_HOST_OTP_CODE)) {
76
+ docker run --rm -e GEM_HOST_API_KEY -e GEM_HOST_OTP_CODE -v "${Root}:/gem" -w /gem ruby:3.2-slim bash -lc $inner
77
+ exit $LASTEXITCODE
78
+ }
79
+ Write-Host "MFA: run this from an interactive terminal so Docker can prompt for the 6-digit code." -ForegroundColor Cyan
80
+ Write-Host "Or set GEM_HOST_OTP_CODE for a one-time non-interactive push (do not save OTP in .env)." -ForegroundColor DarkGray
81
+ docker run --rm -i -t -e GEM_HOST_API_KEY -v "${Root}:/gem" -w /gem ruby:3.2-slim bash -lc $inner
82
+ exit $LASTEXITCODE
83
+ }
metadata CHANGED
@@ -1,97 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generate_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AMQOR Merouane
8
- autorequire:
9
- bindir: bin
8
+ autorequire:
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-16 00:00:00.000000000 Z
11
+ date: 2026-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: net-http
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.2
20
- type: :runtime
19
+ version: '13.0'
20
+ type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.2
26
+ version: '13.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sinatra
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.5
34
- type: :runtime
33
+ version: '3.12'
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.5
40
+ version: '3.12'
41
41
  - !ruby/object:Gem::Dependency
42
- name: json
42
+ name: webmock
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.6.3
48
- type: :runtime
47
+ version: '3.19'
48
+ type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.6.3
55
- - !ruby/object:Gem::Dependency
56
- name: openai
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.3.0
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.3.0
69
- description: The 'generate_image' gem provides a simple and easy-to-use interface
70
- for generating images using the powerful DALL-E API from OpenAI. This Ruby gem can
71
- be used in Ruby on Rails projects or any other Ruby projects to create stunning
72
- images based on the text you provide. Unleash your imagination and generate images
73
- for any use case, from social media posts to marketing materials and beyond.
54
+ version: '3.19'
55
+ description: |
56
+ Lightweight Ruby client for OpenAI image generation and edits (/v1/images/generations, /v1/images/edits).
57
+ Defaults to GPT Image models; stdlib-only (Net::HTTP + JSON). Ruby 3.1+.
74
58
  email:
75
- - marouane.amqor@gmail.com
76
- executables:
77
- - console
78
- - setup
59
+ - marouaneamqor@gmail.com
60
+ executables: []
79
61
  extensions: []
80
62
  extra_rdoc_files: []
81
63
  files:
64
+ - ".env.example"
65
+ - ".github/workflows/ci.yml"
66
+ - ".gitignore"
67
+ - ".rspec"
68
+ - ".travis.yml"
69
+ - CHANGELOG.md
70
+ - CLAUDE.md
71
+ - CODE_OF_CONDUCT.md
72
+ - Gemfile
73
+ - Gemfile.lock
82
74
  - LICENSE.txt
83
75
  - README.md
76
+ - Rakefile
84
77
  - bin/console
85
78
  - bin/setup
79
+ - generate_image-1.1.2.2.gem
80
+ - generate_image.gemspec
86
81
  - lib/generate_image.rb
82
+ - lib/generate_image/client.rb
83
+ - lib/generate_image/configuration.rb
84
+ - lib/generate_image/errors.rb
85
+ - lib/generate_image/http.rb
86
+ - lib/generate_image/models.rb
87
+ - lib/generate_image/response.rb
87
88
  - lib/generate_image/version.rb
88
- - spec/generate_image_spec.rb
89
- - spec/spec_helper.rb
89
+ - scripts/gem-docker.cmd
90
+ - scripts/gem-docker.ps1
90
91
  homepage: https://github.com/merouaneamqor/generate_image
91
92
  licenses:
92
93
  - MIT
93
- metadata: {}
94
- post_install_message:
94
+ metadata:
95
+ homepage_uri: https://github.com/merouaneamqor/generate_image
96
+ source_code_uri: https://github.com/merouaneamqor/generate_image
97
+ changelog_uri: https://github.com/merouaneamqor/generate_image/blob/main/CHANGELOG.md
98
+ rubygems_mfa_required: 'true'
99
+ post_install_message:
95
100
  rdoc_options: []
96
101
  require_paths:
97
102
  - lib
@@ -99,17 +104,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
104
  requirements:
100
105
  - - ">="
101
106
  - !ruby/object:Gem::Version
102
- version: 2.3.0
107
+ version: 3.1.0
103
108
  required_rubygems_version: !ruby/object:Gem::Requirement
104
109
  requirements:
105
110
  - - ">="
106
111
  - !ruby/object:Gem::Version
107
112
  version: '0'
108
113
  requirements: []
109
- rubygems_version: 3.1.2
110
- signing_key:
114
+ rubygems_version: 3.4.19
115
+ signing_key:
111
116
  specification_version: 4
112
- summary: Generate images using the DALL-E API
113
- test_files:
114
- - spec/generate_image_spec.rb
115
- - spec/spec_helper.rb
117
+ summary: OpenAI Images API client (GPT Image, DALL·E) for Ruby
118
+ test_files: []
@@ -1,9 +0,0 @@
1
- RSpec.describe GenerateImage do
2
- it "has a version number" do
3
- expect(GenerateImage::VERSION).not_to be nil
4
- end
5
-
6
- it "does something useful" do
7
- expect(false).to eq(true)
8
- end
9
- end
data/spec/spec_helper.rb DELETED
@@ -1,14 +0,0 @@
1
- require "bundler/setup"
2
- require "generate_image"
3
-
4
- RSpec.configure do |config|
5
- # Enable flags like --only-failures and --next-failure
6
- config.example_status_persistence_file_path = ".rspec_status"
7
-
8
- # Disable RSpec exposing methods globally on `Module` and `main`
9
- config.disable_monkey_patching!
10
-
11
- config.expect_with :rspec do |c|
12
- c.syntax = :expect
13
- end
14
- end