shrine-gridfs 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40029dc2286128d838be04dde1d227de560e22cc
4
- data.tar.gz: 5c850d492b3dc515270f91464095f66b09d51259
3
+ metadata.gz: 455d915875d2550fd43d92e4fc22b7afd7c798dc
4
+ data.tar.gz: 57fed9ee75f80bd7b54872600a49697351db8b02
5
5
  SHA512:
6
- metadata.gz: a30b8704d13c9e2cbd8dea14cee99330dfe5c29f4289a577c96516e873d0fe4a1cadc7d3aa139b955d6648295fd66aa9fe4000bfc9dc25773d50c1674b6489cd
7
- data.tar.gz: eed7f6c8f1a7a85e67dff358cf7e5baf6d78c004c41de8feccb4c6d0b6d9a3d09681de241f062b47a6d41a4297e9751bd3d5f41990ffb075e49ab8d40f93463f
6
+ metadata.gz: 364190c21872eab0f6c9ecd1cb0a0a01b4bfeef104f54c4f95bda1e903230f5260670565484b14e720aaa6f0d66c383ed01a55f63b39e4eefbbcb54b3d0429c5
7
+ data.tar.gz: 790d48f5546a0aefa6619b8eaaa58d581d36300102e9014e958981c2d1f74679ea4e39385b3afcac27726acf088e04da0a5eda0ba8d0fe31a70b96d06e902869
data/README.md CHANGED
@@ -1,7 +1,10 @@
1
- # Shrine::Gridfs
1
+ # Shrine::Storage::Gridfs
2
2
 
3
3
  Provides MongoDB's [GridFS] storage for [Shrine].
4
4
 
5
+ GridFS is a specification for storing and retrieving files in chunks, and is
6
+ convenient when MongoDB is already used in the application.
7
+
5
8
  ## Installation
6
9
 
7
10
  ```ruby
@@ -51,9 +54,14 @@ You can run the tests with Rake:
51
54
  $ bundle exec rake test
52
55
  ```
53
56
 
57
+ ## Inspiration
58
+
59
+ This gem has been inspired by [refile-gridfs].
60
+
54
61
  ## License
55
62
 
56
63
  [MIT](http://opensource.org/licenses/MIT)
57
64
 
58
65
  [GridFS]: https://docs.mongodb.org/v3.0/core/gridfs/
59
66
  [Shrine]: https://github.com/janko-m/shrine
67
+ [refile-gridfs]: https://github.com/Titinux/refile-gridfs
@@ -15,9 +15,9 @@ class Shrine
15
15
  @bucket.send(:ensure_indexes!)
16
16
  end
17
17
 
18
- def upload(io, id, metadata = {})
19
- filename = metadata["filename"] || id
20
- file = Mongo::Grid::File.new(io, filename: filename, metadata: metadata)
18
+ def upload(io, id, shrine_metadata: {}, **upload_options)
19
+ filename = shrine_metadata["filename"] || id
20
+ file = Mongo::Grid::File.new(io, filename: filename, metadata: shrine_metadata)
21
21
  result = bucket.insert_one(file)
22
22
  id.replace(result.to_s + File.extname(id))
23
23
  end
@@ -63,8 +63,7 @@ class Shrine
63
63
  def url(id, **options)
64
64
  end
65
65
 
66
- def clear!(confirm = nil)
67
- raise Shrine::Confirm unless confirm == :confirm
66
+ def clear!
68
67
  bucket.files_collection.find.delete_many
69
68
  bucket.chunks_collection.find.delete_many
70
69
  end
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "shrine-gridfs"
3
- gem.version = "0.1.3"
3
+ gem.version = "0.2.0"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.1"
6
6
 
7
- gem.summary = "Provides Mongo GridFS storage for Shrine."
7
+ gem.summary = "Provides MongoDB's GridFS storage for Shrine."
8
8
  gem.homepage = "https://github.com/janko-m/shrine-gridfs"
9
9
  gem.authors = ["Janko Marohnić"]
10
10
  gem.email = ["janko.marohnic@gmail.com"]
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "shrine-gridfs.gemspec"]
14
14
  gem.require_path = "lib"
15
15
 
16
- gem.add_dependency "shrine", "~> 1.1"
16
+ gem.add_dependency "shrine", "~> 2.0"
17
17
  gem.add_dependency "mongo", ">= 2.2.2", "< 3"
18
18
 
19
19
  gem.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-gridfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shrine
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.1'
19
+ version: '2.0'
20
20
  type: :runtime
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: '1.1'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongo
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -120,6 +120,6 @@ rubyforge_project:
120
120
  rubygems_version: 2.5.1
121
121
  signing_key:
122
122
  specification_version: 4
123
- summary: Provides Mongo GridFS storage for Shrine.
123
+ summary: Provides MongoDB's GridFS storage for Shrine.
124
124
  test_files: []
125
125
  has_rdoc: