{"id":13778115,"url":"https://github.com/katafrakt/hanami-shrine","last_synced_at":"2025-07-11T21:30:30.714Z","repository":{"id":56875787,"uuid":"45364571","full_name":"katafrakt/hanami-shrine","owner":"katafrakt","description":"Upload solution for Hanami 1 using Shrine library (does not work with Hanami 2)","archived":false,"fork":false,"pushed_at":"2021-04-13T08:00:45.000Z","size":270,"stargazers_count":28,"open_issues_count":2,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-02T00:32:22.608Z","etag":null,"topics":["attachment","hanami","shrine","upload"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katafrakt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-02T01:03:37.000Z","updated_at":"2023-10-06T20:29:13.000Z","dependencies_parsed_at":"2022-08-20T13:10:26.482Z","dependency_job_id":null,"html_url":"https://github.com/katafrakt/hanami-shrine","commit_stats":null,"previous_names":["katafrakt/lotus-shrine"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/katafrakt/hanami-shrine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fhanami-shrine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fhanami-shrine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fhanami-shrine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fhanami-shrine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katafrakt","download_url":"https://codeload.github.com/katafrakt/hanami-shrine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katafrakt%2Fhanami-shrine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264901929,"owners_count":23680956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["attachment","hanami","shrine","upload"],"created_at":"2024-08-03T18:00:51.318Z","updated_at":"2025-07-11T21:30:30.314Z","avatar_url":"https://github.com/katafrakt.png","language":"Ruby","funding_links":[],"categories":["Hanami Gem List"],"sub_categories":["File Uploading"],"readme":"# Hanami::Shrine\n\n**Current status**: this gem's development is currently on hold, waiting for Hanami 2 to be released (which will probably make it obsolete anyway).\n\nThis gem aims at providing support for [Shrine](https://github.com/shrinerb/shrine) uploader in Hanami applications. It also tries to be as simple as possible, without polluting the world around.\n\n[![Build Status](https://travis-ci.org/katafrakt/hanami-shrine.svg)](https://travis-ci.org/katafrakt/hanami-shrine)\n[![Gem Version](https://badge.fury.io/rb/hanami-shrine.svg)](https://badge.fury.io/rb/hanami-shrine)\n[![Code Climate](https://codeclimate.com/github/katafrakt/hanami-shrine/badges/gpa.svg)](https://codeclimate.com/github/katafrakt/hanami-shrine)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hanami-shrine'\n```\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\nSetup Shrine with `hanami` plugin enabled. Check [Shrine's repository](https://github.com/shrinerb/shrine) for more detailed description of the process.\n\n```ruby\nclass ImageAttachment \u003c Shrine\n  plugin :hanami\nend\n```\n\nThen, in your repository add (assuming your attachment is `avatar`):\n\n```ruby\nprepend ImageAttachment.repository(:avatar)\n```\n\nAnd in your entity:\n\n```ruby\ninclude ImageAttachment[:avatar]\n```\n\nFor inspiration read a [blog post](http://katafrakt.me/2016/02/04/shrine-hanami-uploads/), look at [the specs](https://github.com/katafrakt/hanami-shrine/tree/master/spec/hanami) or [example repo](https://github.com/katafrakt/hanami-shrine-example).\n\n## Important changes since 0.1 version\n\nAs Hanami has been upgraded to 0.9, it started to use new engine for the entities in `hanami-model`. It required heavy changes in `hanami-shrine` to accomodate to new paradigm. Unfortunately, some of them are breaking. Here's a summary list:\n* Validations are gone (for now, hopefully)\n* You need to use `prepend` instead of `extend` in your repository\n* Entities are now read-only. You need to initialize them with the attachment, not add it later: `MyEntity.new(avatar: File.open('my_avatar.png')`. This is a Hanami change, but it's worth mentioning here as well.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n### Testing\n\nTesting is done against 3 major database engines: PostgreSQL, MySQL and sqlite3. It is steered by environment variable `DB`. To run locally, first `cp .env.travis .env`, then put values matching your local configuration there. After that, you can test all three versions:\n\n```\nDB=sqlite bundle exec rake\nDB=postgres bundle exec rake\nDB=mysql bundle exec rake\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/katafrakt/hanami-shrine.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\nCat images (used in tests) are public domain taken from [Wikimedia Commons](http://commons.wikimedia.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatafrakt%2Fhanami-shrine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatafrakt%2Fhanami-shrine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatafrakt%2Fhanami-shrine/lists"}