hanami-shrine 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.env.travis +3 -0
- data/.gitignore +1 -0
- data/.rspec +0 -1
- data/.travis.yml +16 -1
- data/CHANGELOG.md +4 -0
- data/README.md +12 -13
- data/Rakefile +19 -0
- data/hanami-shrine.gemspec +5 -2
- data/lib/hanami/shrine/version.rb +1 -1
- data/lib/shrine/plugins/hanami.rb +6 -0
- metadata +58 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 41356c8d9d02d064b43a70b7e9191c3bac0138e3f33da8a65c58a841919fbdd6
|
4
|
+
data.tar.gz: b5f971c13ed05a258022e99b05a8098882b7186909af58942c8b1de995bce2ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cda9b682c9f43ef8d9a3c75352e20d9eb8db657066df66fad16440434e898eb80e168cdea3810c288cf60d022fb89e480f7bc353df4e4f00cf403ff15d9fb5c
|
7
|
+
data.tar.gz: 2529a59065783fcb04afa13f85aa465c3b38cffb910bf127fe3924ed202abcdbdf56880de54510a547a81b090e7465ccade45e64eeb2c70c8a1ab2378caaa67f
|
data/.env.travis
ADDED
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,4 +1,19 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- 2.3.3
|
4
|
-
before_install: gem install bundler -v
|
4
|
+
before_install: gem install bundler -v 2.0.1
|
5
|
+
|
6
|
+
services:
|
7
|
+
- postgresql
|
8
|
+
- mysql
|
9
|
+
|
10
|
+
env:
|
11
|
+
- DB=sqlite
|
12
|
+
- DB=mysql
|
13
|
+
- DB=postgres
|
14
|
+
|
15
|
+
script:
|
16
|
+
- cp .env.travis .env
|
17
|
+
- if [[ "$DB" == "mysql" ]]; then mysql -e 'CREATE DATABASE IF NOT EXISTS test;'; fi
|
18
|
+
- if [[ "$DB" == "postgres" ]]; then psql -c 'create database test;' -U postgres; fi
|
19
|
+
- bundle exec rake
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,22 +1,11 @@
|
|
1
1
|
# Hanami::Shrine
|
2
2
|
|
3
|
-
This gem aims at providing support for [Shrine](https://github.com/
|
3
|
+
This 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.
|
4
4
|
|
5
5
|
[![Build Status](https://travis-ci.org/katafrakt/hanami-shrine.svg)](https://travis-ci.org/katafrakt/hanami-shrine)
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/hanami-shrine.svg)](https://badge.fury.io/rb/hanami-shrine)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/katafrakt/hanami-shrine/badges/gpa.svg)](https://codeclimate.com/github/katafrakt/hanami-shrine)
|
8
8
|
|
9
|
-
### Current compatibility status
|
10
|
-
|
11
|
-
#### **0.1.x**
|
12
|
-
* works with Hanami 0.7.x
|
13
|
-
* works with Hanami 0.8.x without validations (which have been extracted to separate gem)
|
14
|
-
|
15
|
-
#### **0.2.x**
|
16
|
-
* works with Hanami 0.9.x and 1.0.
|
17
|
-
|
18
|
-
Future compatibility will only be provided with Hanami 1.0 and later (which will propably be compatible with 0.9 too).
|
19
|
-
|
20
9
|
## Installation
|
21
10
|
|
22
11
|
Add this line to your application's Gemfile:
|
@@ -31,7 +20,7 @@ And then execute:
|
|
31
20
|
|
32
21
|
## Usage
|
33
22
|
|
34
|
-
Setup Shrine with `hanami` plugin enabled. Check [Shrine's repository](https://github.com/
|
23
|
+
Setup Shrine with `hanami` plugin enabled. Check [Shrine's repository](https://github.com/shrinerb/shrine) for more detailed description of the process.
|
35
24
|
|
36
25
|
```ruby
|
37
26
|
class ImageAttachment < Shrine
|
@@ -66,6 +55,16 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
66
55
|
|
67
56
|
To 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).
|
68
57
|
|
58
|
+
### Testing
|
59
|
+
|
60
|
+
Testing 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:
|
61
|
+
|
62
|
+
```
|
63
|
+
DB=sqlite bundle exec rake
|
64
|
+
DB=postgres bundle exec rake
|
65
|
+
DB=mysql bundle exec rake
|
66
|
+
```
|
67
|
+
|
69
68
|
## Contributing
|
70
69
|
|
71
70
|
Bug reports and pull requests are welcome on GitHub at https://github.com/katafrakt/hanami-shrine.
|
data/Rakefile
CHANGED
@@ -4,3 +4,22 @@ require "rspec/core/rake_task"
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
6
|
task :default => :spec
|
7
|
+
|
8
|
+
namespace :spec do
|
9
|
+
task :all do
|
10
|
+
require 'dotenv'
|
11
|
+
Dotenv.load!
|
12
|
+
require_relative 'spec/database_helper'
|
13
|
+
|
14
|
+
%w(sqlite postgres mysql).each do |adapter|
|
15
|
+
ENV['DB_ADAPTER'] = adapter
|
16
|
+
ENV['DB_URL'] = DatabaseHelper.db_url
|
17
|
+
p ENV.keys
|
18
|
+
puts '########################'
|
19
|
+
puts "# Running for: #{adapter}"
|
20
|
+
puts "########################\n\n"
|
21
|
+
Rake::Task['spec'].invoke
|
22
|
+
Rake::Task['spec'].reenable
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/hanami-shrine.gemspec
CHANGED
@@ -19,12 +19,15 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'shrine', '>= 2.
|
22
|
+
spec.add_dependency 'shrine', '>= 2.16.0', '< 3.0'
|
23
23
|
spec.add_dependency 'hanami-model', '>= 1.0'
|
24
24
|
spec.add_dependency "hanami-utils", '>= 1.0'
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler", "
|
26
|
+
spec.add_development_dependency "bundler", "> 1.0"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "rspec"
|
29
29
|
spec.add_development_dependency "json"
|
30
|
+
spec.add_development_dependency "dotenv"
|
31
|
+
spec.add_development_dependency "pg"
|
32
|
+
spec.add_development_dependency "mysql2"
|
30
33
|
end
|
@@ -78,14 +78,20 @@ class Shrine
|
|
78
78
|
end
|
79
79
|
|
80
80
|
private
|
81
|
+
|
81
82
|
def _attachments
|
82
83
|
self.class._attachments
|
83
84
|
end
|
84
85
|
|
85
86
|
def save_attachments(entity)
|
87
|
+
if !entity.is_a?(::Hanami::Entity)
|
88
|
+
entity = self.class.entity.new(entity)
|
89
|
+
end
|
90
|
+
|
86
91
|
_attachments.each do |a|
|
87
92
|
entity = save_attachment(entity, a[:name], a[:class])
|
88
93
|
end
|
94
|
+
|
89
95
|
yield(entity)
|
90
96
|
end
|
91
97
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-shrine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Świątkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.16.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
29
|
+
version: 2.16.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: hanami-model
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +62,16 @@ dependencies:
|
|
56
62
|
name: bundler
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - "
|
65
|
+
- - ">"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
67
|
+
version: '1.0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - "
|
72
|
+
- - ">"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
74
|
+
version: '1.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: rake
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +114,48 @@ dependencies:
|
|
108
114
|
- - ">="
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: dotenv
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: pg
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: mysql2
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
111
159
|
description: Support for Shrine gem in Hanami framework
|
112
160
|
email:
|
113
161
|
- inquebrantable@gmail.com
|
@@ -115,6 +163,7 @@ executables: []
|
|
115
163
|
extensions: []
|
116
164
|
extra_rdoc_files: []
|
117
165
|
files:
|
166
|
+
- ".env.travis"
|
118
167
|
- ".gitignore"
|
119
168
|
- ".rspec"
|
120
169
|
- ".travis.yml"
|
@@ -148,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
197
|
- !ruby/object:Gem::Version
|
149
198
|
version: '0'
|
150
199
|
requirements: []
|
151
|
-
|
152
|
-
rubygems_version: 2.5.1
|
200
|
+
rubygems_version: 3.0.3
|
153
201
|
signing_key:
|
154
202
|
specification_version: 4
|
155
203
|
summary: Support for Shrine gem in Hanami framework
|