Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
ruby: ["3.0", "3.1", "3.2", "3.3", "3.4"]
ruby: ["3.2", "3.3", "3.4", "4.0"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
*.sublime-project
*.sublime-workspace
*.gem
/benchmark/results/
46 changes: 46 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# RQRCode Development Guide for AI Agents

## Build/Test/Lint Commands
- `bundle install` - Install dependencies
- `rake` - Run all specs and auto-fix linting (default task)
- `rake spec` - Run all specs
- `bundle exec rspec spec/path/to/file_spec.rb` - Run a single test file
- `bundle exec rspec spec/path/to/file_spec.rb:42` - Run single test at line 42
- `rake standard` - Check code style
- `rake standard:fix` - Auto-fix code style issues
- `./bin/console` - Launch interactive console

## Code Style (Standard RB)
- Follow [Standard Ruby](https://github.com/testdouble/standard) style guide (enforced via `standard` gem)
- Ruby version: >= 3.0.0
- Always use `# frozen_string_literal: true` at the top of all Ruby files
- Use double quotes for strings
- Use snake_case for variables/methods, SCREAMING_SNAKE_CASE for constants
- 2-space indentation
- No trailing whitespace
- Module structure: `lib/rqrcode/` for implementation, `spec/rqrcode/` for tests

## File Structure & Naming
- Implementation: `lib/rqrcode/<feature>.rb` or `lib/rqrcode/<namespace>/<feature>.rb`
- Tests: `spec/rqrcode/<feature>_spec.rb` (must end with `_spec.rb`)
- Export modules live in `lib/rqrcode/export/` (e.g., `svg.rb`, `png.rb`, `ansi.rb`)

## Testing
- Use RSpec for all tests
- Test files require `spec_helper` at the top
- Use `describe` blocks for grouping related tests
- Use `it` blocks for individual test cases
- Tests should verify behavior, not implementation details

## Dependencies
- Core QR generation: `rqrcode_core` gem (do not modify, separate project)
- PNG rendering: `chunky_png` gem
- This gem focuses on rendering QR codes from `rqrcode_core` data structures

## Commit Messages

Use the Semantic Commit Message style:

- **type**: The type of change (see below)
- **scope**: Optional, the area of the codebase affected (e.g., `auth`, `api`, `ui`)
- **subject**: A brief description in imperative mood, lowercase, no full stop
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ source "https://rubygems.org"

# Specify your gem's dependencies in rqrcode-base.gemspec
gemspec

# gem "rqrcode_core", path: "../rqrcode_core"
113 changes: 79 additions & 34 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,75 +8,120 @@ PATH
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
ast (2.4.3)
benchmark-ips (2.14.0)
chunky_png (1.4.0)
diff-lcs (1.5.1)
json (2.7.2)
language_server-protocol (3.17.0.3)
diff-lcs (1.6.2)
json (2.18.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
parallel (1.26.3)
parser (3.3.5.0)
memory_profiler (1.1.0)
parallel (1.27.0)
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prism (1.7.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
rqrcode_core (2.0.1)
rspec (3.13.0)
rake (13.3.1)
regexp_parser (2.11.3)
rqrcode_core (2.1.0)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.1)
rubocop (1.66.1)
rspec-support (3.13.6)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-performance (1.26.1)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (1.13.0)
standard (1.41.0)
stackprof (0.2.27)
standard (1.52.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.66.0)
rubocop (~> 1.81.7)
standard-custom (~> 1.0.0)
standard-performance (~> 1.5)
standard-performance (~> 1.8)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.5.0)
standard-performance (1.9.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.22.0)
unicode-display_width (2.6.0)
rubocop-performance (~> 1.26.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)

PLATFORMS
aarch64-linux
arm64-darwin-24
ruby
x86_64-linux

DEPENDENCIES
bundler (~> 2.0)
benchmark-ips (~> 2.0)
bundler (~> 4.0)
memory_profiler (~> 1.0)
rake (~> 13.0)
rqrcode!
rspec (~> 3.5)
stackprof (~> 0.2)
standard (~> 1.41)

CHECKSUMS
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
benchmark-ips (2.14.0) sha256=b72bc8a65d525d5906f8cd94270dccf73452ee3257a32b89fbd6684d3e8a9b1d
chunky_png (1.4.0) sha256=89d5b31b55c0cf4da3cf89a2b4ebc3178d8abe8cbaf116a1dba95668502fdcfe
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
memory_profiler (1.1.0) sha256=79a17df7980a140c83c469785905409d3027ca614c42c086089d128b805aa8f8
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
parser (3.3.10.0) sha256=ce3587fa5cc55a88c4ba5b2b37621b3329aadf5728f9eafa36bbd121462aabd6
prism (1.7.0) sha256=10062f734bf7985c8424c44fac382ac04a58124ea3d220ec3ba9fe4f2da65103
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
rqrcode (3.1.1)
rqrcode_core (2.1.0) sha256=f303b85df89c1b8fc5ee8dc19808c9dc4330e6329b660d99d4a8cbb36ca13051
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
rspec-support (3.13.6) sha256=2e8de3702427eab064c9352fe74488cc12a1bfae887ad8b91cba480ec9f8afb2
rubocop (1.81.7) sha256=6fb5cc298c731691e2a414fe0041a13eb1beed7bab23aec131da1bcc527af094
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
stackprof (0.2.27) sha256=aff6d28656c852e74cf632cc2046f849033dc1dedffe7cb8c030d61b5745e80c
standard (1.52.0) sha256=ec050e63228e31fabe40da3ef96da7edda476f7acdf3e7c2ad47b6e153f6a076
standard-custom (1.0.2) sha256=424adc84179a074f1a2a309bb9cf7cd6bfdb2b6541f20c6bf9436c0ba22a652b
standard-performance (1.9.0) sha256=49483d31be448292951d80e5e67cdcb576c2502103c7b40aec6f1b6e9c88e3f2
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f

BUNDLED WITH
2.4.10
4.0.3
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[RQRCode](https://github.com/whomwah/rqrcode) is a library for creating and rendering QR codes into various formats. It has a simple interface with all the standard QR code options. It was adapted from the Javascript library by Kazuhiko Arase.

- QR code is trademarked by Denso Wave inc
- Minimum Ruby version is `>= 3.0.0`
- Minimum Ruby version is `>= 3.2.0`

## Installing

Expand Down Expand Up @@ -275,6 +275,10 @@ $ rake standard # checks
$ rake standard:fix # fixes
```

## Benchmarks

RQRCode includes comprehensive performance benchmarks for tracking export format performance over time. See the [benchmark README](benchmark/README.md) for details on running benchmarks, interpreting results, and current performance baselines.

## Contributing

I am not currently accepting any new renderers as the current `as_png`, `as_svg` and `as_ansi` work for most cases. If you need something different from what's available, the [`rqrcode_core`](https://github.com/whomwah/rqrcode_core) gem gives you access to all the QR Code information you will need so makes it simple to generate your own.
Expand Down
35 changes: 35 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,38 @@ begin
rescue LoadError
# no standard/rspec available
end

# Benchmark tasks
namespace :benchmark do
desc "Run all benchmarks"
task :all do
%w[svg png html ansi format_comparison].each do |format|
Rake::Task["benchmark:#{format}"].invoke
end
end

desc "Run SVG export benchmarks"
task :svg do
ruby "benchmark/svg_export.rb"
end

desc "Run PNG export benchmarks"
task :png do
ruby "benchmark/png_export.rb"
end

desc "Run HTML export benchmarks"
task :html do
ruby "benchmark/html_export.rb"
end

desc "Run ANSI export benchmarks"
task :ansi do
ruby "benchmark/ansi_export.rb"
end

desc "Run format comparison benchmarks"
task :format_comparison do
ruby "benchmark/format_comparison.rb"
end
end
Loading