solidus_cloudinary 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/app/models/cloudinary_uploader.rb +30 -0
- data/app/models/spree/image_decorator.rb +14 -0
- data/lib/solidus_cloudinary/engine.rb +14 -0
- data/lib/solidus_cloudinary/version.rb +3 -0
- data/lib/spree_cloudinary.rb +5 -0
- data/solidus_cloudinary.gemspec +29 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a1db4f11bdc8b70384067ae6607a3ba31a8ba189
|
4
|
+
data.tar.gz: 796188d2bd02cbf0a3ddb78fc698a6d93a8deb97
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5bd4092c9d528a73df2578e3952ea0ae314a61e7dec3ee1b2865c5892b31c589415ffb688f2c715682c7011e62523396ea2a57f99fc37e335f2c95931eb33bea
|
7
|
+
data.tar.gz: 764b66b45f98a9eb7e9866020ddb30beabcc0fab45177ba7bc0ca73e172b46a7280fcada94c6dec0481b073ba54ae0b95ad5a57a9d91d5c48d0b0103462869a8
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
spree_cloudinary
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.2
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Thach Chau
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Spree Cloudinary
|
2
|
+
|
3
|
+
This is a Spree extension that uploads images to
|
4
|
+
[Cloudinary](https://cloudinary.com) via [CarrierWave](https://github.com/jnicklas/carrierwave) instead of
|
5
|
+
the default [Paperclip](https://github.com/thoughtbot/paperclip).
|
6
|
+
|
7
|
+
## Why I made such this gem?
|
8
|
+
|
9
|
+
Providing an alternative free solution for cloud image storing
|
10
|
+
|
11
|
+
# Setup
|
12
|
+
|
13
|
+
Add `spree_cloudinary` to your Gemfile and `bundle`.
|
14
|
+
|
15
|
+
# Configuration
|
16
|
+
|
17
|
+
Create an initializer file for Cloudinary (`config/initializers/spree_cloudinary.rb`):
|
18
|
+
|
19
|
+
# See the section titled 'Ruby On Rails integration' at http://cloudinary.com/documentation/rails_integration
|
20
|
+
# for full options.
|
21
|
+
|
22
|
+
Cloudinary.config do |config|
|
23
|
+
config.cloud_name = 'sample'
|
24
|
+
config.api_key = '874837483274837'
|
25
|
+
config.api_secret = 'a676b67565c6767a6767d6767f676fe1'
|
26
|
+
config.cdn_subdomain = true
|
27
|
+
end
|
28
|
+
|
29
|
+
# Override default size
|
30
|
+
# Create a model file named 'cloudinary_uploader_decorator.rb'
|
31
|
+
|
32
|
+
CloudinaryUploader.class_eval do
|
33
|
+
version :your_custom_type do
|
34
|
+
process :resize_to_fit => [your_custom_size, your_custom_size]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Copyright (c) 2013 ThachChau, released under the MIT License
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CloudinaryUploader < CarrierWave::Uploader::Base
|
2
|
+
include CarrierWave::Compatibility::Paperclip
|
3
|
+
include Cloudinary::CarrierWave
|
4
|
+
|
5
|
+
process :convert => 'png'
|
6
|
+
# Spree looks in attachment#errors, so just delegate to model#errors
|
7
|
+
delegate :errors, :to => :model
|
8
|
+
|
9
|
+
# Match the path defined in Spree::Image
|
10
|
+
def paperclip_path
|
11
|
+
"assets/products/:id/:style/:basename.:extension"
|
12
|
+
end
|
13
|
+
|
14
|
+
# These are the versions defined in Spree::Image
|
15
|
+
version :mini do
|
16
|
+
process :resize_to_fit => [48, 48]
|
17
|
+
end
|
18
|
+
|
19
|
+
version :small do
|
20
|
+
process :resize_to_fit => [100, 100]
|
21
|
+
end
|
22
|
+
|
23
|
+
version :product do
|
24
|
+
process :resize_to_fit => [240, 240]
|
25
|
+
end
|
26
|
+
|
27
|
+
version :large do
|
28
|
+
process :resize_to_fit => [600, 600]
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Spree::Image.class_eval do
|
2
|
+
mount_uploader :attachment, CloudinaryUploader, :mount_on => :attachment_file_name
|
3
|
+
|
4
|
+
# Get rid of the paperclip callbacks
|
5
|
+
def save_attached_files; end
|
6
|
+
def prepare_for_destroy; end
|
7
|
+
def destroy_attached_files; end
|
8
|
+
|
9
|
+
private
|
10
|
+
# Get rid of Paperclip validation
|
11
|
+
def attachment_file_name
|
12
|
+
"not_blank"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module SolidusCloudinary
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
engine_name 'solidus_cloudinary'
|
4
|
+
|
5
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
6
|
+
|
7
|
+
def self.activate
|
8
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
|
9
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
config.to_prepare &method(:activate).to_proc
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'solidus_cloudinary/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'solidus_cloudinary'
|
8
|
+
spec.version = SolidusCloudinary::VERSION
|
9
|
+
spec.authors = ['Thach Chau']
|
10
|
+
spec.email = ['rog.kane@gmail.com']
|
11
|
+
spec.description = %q{Spree extension to use carrierwave/cloudinary instead of paperclip.}
|
12
|
+
spec.summary = %q{Most code is taken from https://github.com/genuitytech/spree-carrierwave}
|
13
|
+
spec.homepage = 'https://github.com/chautoni'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
spec.required_ruby_version = '>= 1.9.2'
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 2.13.0'
|
24
|
+
spec.add_development_dependency 'debugger', '~> 1.5.0'
|
25
|
+
|
26
|
+
spec.add_dependency 'solidus_core', '>= 1.2.2'
|
27
|
+
spec.add_dependency 'carrierwave', '~> 0.11.0'
|
28
|
+
spec.add_dependency 'cloudinary', '~> 1.1.5'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solidus_cloudinary
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thach Chau
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 10.0.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 10.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.13.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.13.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: debugger
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: solidus_core
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.2.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.2.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: carrierwave
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.11.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.11.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: cloudinary
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.1.5
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.1.5
|
111
|
+
description: Spree extension to use carrierwave/cloudinary instead of paperclip.
|
112
|
+
email:
|
113
|
+
- rog.kane@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- ".ruby-gemset"
|
120
|
+
- ".ruby-version"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- app/models/cloudinary_uploader.rb
|
126
|
+
- app/models/spree/image_decorator.rb
|
127
|
+
- lib/solidus_cloudinary/engine.rb
|
128
|
+
- lib/solidus_cloudinary/version.rb
|
129
|
+
- lib/spree_cloudinary.rb
|
130
|
+
- solidus_cloudinary.gemspec
|
131
|
+
homepage: https://github.com/chautoni
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
metadata: {}
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 1.9.2
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.5.0
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: Most code is taken from https://github.com/genuitytech/spree-carrierwave
|
155
|
+
test_files: []
|