shrine-fog 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -1
- data/lib/shrine/storage/fog.rb +8 -8
- data/shrine-fog.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65601c8ed748677e7f07ca0b2f6248e94e191b45
|
4
|
+
data.tar.gz: 9c928b369117d538fb1d1db48da03dcc0db59d4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05ce2e98a190526fda189b3af8d265044f81a96b16322dcd8a289480c1f59b5f57cc14e2f3157e8fb204966263fba5248cf23dd55917b7c48a21b707fdf4e2d
|
7
|
+
data.tar.gz: d0bf5d9d15b1b399ef9348ba095835b3b03f84790a3dfbbe42af203859d8c01b3033be2944db47872c3ebc8e2de50f306ba663f61c3612e810ce4b2ba5db91fe
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
# Shrine::Fog
|
1
|
+
# Shrine::Storage::Fog
|
2
2
|
|
3
3
|
Provides [Fog] storage for [Shrine].
|
4
4
|
|
5
|
+
Fog is an abstraction over a variety of cloud storages (e.g. Google Cloud and
|
6
|
+
Dropbox).
|
7
|
+
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
```ruby
|
@@ -93,6 +96,10 @@ Afterwards you can run the tests:
|
|
93
96
|
$ bundle exec rake test
|
94
97
|
```
|
95
98
|
|
99
|
+
## Inspiration
|
100
|
+
|
101
|
+
This gem was inspired by [refile-fog].
|
102
|
+
|
96
103
|
## License
|
97
104
|
|
98
105
|
[MIT](http://opensource.org/licenses/MIT)
|
@@ -101,3 +108,4 @@ $ bundle exec rake test
|
|
101
108
|
[Shrine]: https://github.com/janko-m/shrine
|
102
109
|
[fog-aws]: https://github.com/fog/fog-aws
|
103
110
|
[fog-local]: https://github.com/fog/fog-local
|
111
|
+
[refile-fog]: https://github.com/refile/refile-fog
|
data/lib/shrine/storage/fog.rb
CHANGED
@@ -15,11 +15,11 @@ class Shrine
|
|
15
15
|
@expires = expires
|
16
16
|
end
|
17
17
|
|
18
|
-
def upload(io, id,
|
18
|
+
def upload(io, id, **upload_options)
|
19
19
|
if copyable?(io)
|
20
|
-
copy(io, id,
|
20
|
+
copy(io, id, **upload_options)
|
21
21
|
else
|
22
|
-
put(io, id,
|
22
|
+
put(io, id, **upload_options)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -60,8 +60,7 @@ class Shrine
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
def clear!
|
64
|
-
raise Shrine::Confirm unless confirm == :confirm
|
63
|
+
def clear!
|
65
64
|
list.each(&:destroy)
|
66
65
|
end
|
67
66
|
|
@@ -93,14 +92,15 @@ class Shrine
|
|
93
92
|
[*prefix, id].join("/")
|
94
93
|
end
|
95
94
|
|
96
|
-
def put(io, id,
|
95
|
+
def put(io, id, shrine_metadata: {}, **upload_options)
|
97
96
|
options = {key: path(id), body: io, public: @public}
|
98
|
-
options[:content_type] =
|
97
|
+
options[:content_type] = shrine_metadata["mime_type"]
|
98
|
+
options.update(upload_options)
|
99
99
|
|
100
100
|
directory.files.create(options)
|
101
101
|
end
|
102
102
|
|
103
|
-
def copy(io, id,
|
103
|
+
def copy(io, id, **upload_options)
|
104
104
|
io.storage.head(io.id).copy(directory.key, path(id))
|
105
105
|
end
|
106
106
|
|
data/shrine-fog.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "shrine-fog"
|
3
|
-
gem.version = "0.
|
3
|
+
gem.version = "0.3.0"
|
4
4
|
|
5
5
|
gem.required_ruby_version = ">= 2.1"
|
6
6
|
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "shrine-fog.gemspec"]
|
15
15
|
gem.require_path = "lib"
|
16
16
|
|
17
|
-
gem.add_dependency "shrine", "~>
|
17
|
+
gem.add_dependency "shrine", "~> 2.0"
|
18
18
|
gem.add_dependency "down", ">= 1.0.5"
|
19
19
|
|
20
20
|
gem.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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-
|
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: '
|
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: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: down
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|