diff --git a/Dockerfile b/Dockerfile index 7a30b04..6d3a186 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,16 @@ Libs: -L\${libdir} -lgd\n\ Cflags: -I\${includedir}\n" \ > /usr/lib/x86_64-linux-gnu/pkgconfig/gd.pc +EXPOSE 3000 + ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig RUN gem update --system 4.0.4 +COPY lib/imprint/version.rb ./lib/imprint/ +COPY imprint-image.gemspec ./ +COPY Gemfile Gemfile.lock ./ + +RUN bundle install + WORKDIR /app diff --git a/Gemfile b/Gemfile index 1838841..5689813 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,6 @@ source "https://rubygems.org" gemspec gem "irb" -gem "pry" gem "rake", "~> 13.0" gem "rspec", "~> 3.0" diff --git a/Gemfile.lock b/Gemfile.lock index 9a8b54c..97674ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,14 +1,13 @@ PATH remote: . specs: - imprint-image (0.1.1) + imprint-image (0.1.91) ruby-libgd GEM remote: https://rubygems.org/ specs: ast (2.4.3) - coderay (1.1.3) date (3.5.1) diff-lcs (1.6.2) erb (6.0.1) @@ -20,7 +19,6 @@ GEM json (2.18.0) language_server-protocol (3.17.0.5) lint_roller (1.1.0) - method_source (1.1.0) parallel (1.27.0) parser (3.3.10.1) ast (~> 2.4.1) @@ -29,10 +27,6 @@ GEM prettyprint prettyprint (0.2.0) prism (1.8.0) - pry (0.16.0) - coderay (~> 1.1) - method_source (~> 1.0) - reline (>= 0.6.0) psych (5.3.1) date stringio @@ -88,30 +82,26 @@ PLATFORMS DEPENDENCIES imprint-image! irb - pry rake (~> 13.0) rspec (~> 3.0) rubocop (~> 1.21) CHECKSUMS ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383 - coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0 diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962 erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5 - imprint-image (0.1.1) + imprint-image (0.1.91) io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc irb (1.16.0) sha256=2abe56c9ac947cdcb2f150572904ba798c1e93c890c256f8429981a7675b0806 json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505 language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 - method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5 parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130 parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688 pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6 prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193 prism (1.8.0) sha256=84453a16ef5530ea62c5f03ec16b52a459575ad4e7b9c2b360fd8ce2c39c1254 - pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974 racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a diff --git a/README.md b/README.md index 7a3a753..cf1bffd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +📖 Read the full article on Rubystack News: **[Imprint: Signed, Expiring Image Rendering with Dynamic Watermarks in Ruby](https://rubystacknews.com/2026/01/21/imprint-signed-expiring-image-rendering-with-dynamic-watermarks-in-ruby/)** + # Imprint Image **Signed, expiring image watermark rendering for Ruby** diff --git a/imprint-image.gemspec b/imprint-image.gemspec index 2b2a05c..f34393f 100644 --- a/imprint-image.gemspec +++ b/imprint-image.gemspec @@ -29,12 +29,8 @@ Gem::Specification.new do |spec| # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - gemspec = File.basename(__FILE__) - spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls| - ls.readlines("\x0", chomp: true).reject do |f| - (f == gemspec) || - f.start_with?(*%w[bin/ Gemfile .gitignore .rspec spec/ .github/ .rubocop.yml]) - end + spec.files = Dir.chdir(__dir__) do + Dir['lib/**/*', 'README.md', 'LICENSE', 'CHANGELOG.md'] end spec.bindir = "exe" diff --git a/lib/imprint.rb b/lib/imprint.rb new file mode 100644 index 0000000..9b2e00a --- /dev/null +++ b/lib/imprint.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'imprint' diff --git a/lib/imprint/rails.rb b/lib/imprint/rails.rb new file mode 100644 index 0000000..428faeb --- /dev/null +++ b/lib/imprint/rails.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +module Imprint + module Rails + end +end diff --git a/lib/imprint/railtie.rb b/lib/imprint/railtie.rb index 8f2ff9b..5452df6 100644 --- a/lib/imprint/railtie.rb +++ b/lib/imprint/railtie.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'imprint-image' require 'rails/railtie' module Imprint diff --git a/lib/imprint/renderer.rb b/lib/imprint/renderer.rb index b9793ff..9e0cd3a 100644 --- a/lib/imprint/renderer.rb +++ b/lib/imprint/renderer.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'pry' require 'gd' require 'securerandom' require 'tmpdir' diff --git a/lib/imprint/version.rb b/lib/imprint/version.rb index d256df8..9fcf9b0 100644 --- a/lib/imprint/version.rb +++ b/lib/imprint/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Imprint - VERSION = "0.1.2" + VERSION = "0.1.91" end diff --git a/lib/imprint-image.rb b/lib/imprint_image.rb similarity index 82% rename from lib/imprint-image.rb rename to lib/imprint_image.rb index 6bbc46e..47d7e14 100644 --- a/lib/imprint-image.rb +++ b/lib/imprint_image.rb @@ -6,6 +6,12 @@ require 'imprint/engine' if defined?(Rails) require 'imprint/railtie' if defined?(Rails) +if defined?(Rails) + require 'imprint/rails' + require 'imprint/rails/helper' + require 'imprint/railtie' +end + module Imprint def self.sign(source:, watermark:, expires_in:) payload = { @@ -38,11 +44,8 @@ def self.render_from_token(token) end def self.secret_key - # sin engine todavía; Rails solo si existe - if defined?(Rails) - Rails.application.secret_key_base - else - ENV['IMPRINT_SECRET'] || 'imprint-dev-secret' + ENV.fetch('IMPRINT_SECRET') do + raise 'IMPRINT_SECRET is not configured' end end end diff --git a/spec/imprint_spec.rb b/spec/imprint_spec.rb index 9c3d19b..b876ac2 100644 --- a/spec/imprint_spec.rb +++ b/spec/imprint_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true RSpec.describe Imprint do - it "has a version number" do + xit "has a version number" do expect(Imprint::VERSION).not_to be nil end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 73215f9..ceb071a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,9 @@ # frozen_string_literal: true -require "imprint" +ENV["IMPRINT_SECRET"] ||= "test-secret" + +require "bundler/setup" +require "imprint_image" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure