spree_cloudinary 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 36c520d6dc3fa56ca6107d816ed3fb9a8b66c3e4
4
+ data.tar.gz: 9f1d3c148d62db26bd2898213b33ea2f977089ef
5
+ SHA512:
6
+ metadata.gz: 35e9e546c866e4fb2baf85d1f313157a418b331a894a8c2a94d18f9ed91f77efa36bf67ffc51bc50b1c754fa31e23823637ba775d51fc8e4db5e2d1954e8a2f6
7
+ data.tar.gz: d7c480cb56f4b0f056b67c4828591ef925bba2a6572d4837d49d603c261c91b47d5342cc0cf40e20c816c2659fb2a425ca2cb0d1051bd2fc2e1c088a4e7149da
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ spree_cloudinary
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in spree_cloudinary.gemspec
4
+ gemspec
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,29 @@
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
+ Copyright (c) 2013 ThachChau, released under the MIT License
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,45 @@
1
+ Spree::Image.class_eval do
2
+ class Uploader < CarrierWave::Uploader::Base
3
+ include CarrierWave::Compatibility::Paperclip
4
+ include Cloudinary::CarrierWave
5
+
6
+ process :convert => 'png'
7
+ # Spree looks in attachment#errors, so just delegate to model#errors
8
+ delegate :errors, :to => :model
9
+
10
+ # Match the path defined in Spree::Image
11
+ def paperclip_path
12
+ "assets/products/:id/:style/:basename.:extension"
13
+ end
14
+
15
+ # These are the versions defined in Spree::Image
16
+ version :mini do
17
+ process :resize_to_fit => [48, 48]
18
+ end
19
+
20
+ version :small do
21
+ process :resize_to_fit => [100, 100]
22
+ end
23
+
24
+ version :product do
25
+ process :resize_to_fit => [240, 240]
26
+ end
27
+
28
+ version :large do
29
+ process :resize_to_fit => [600, 600]
30
+ end
31
+ end
32
+
33
+ mount_uploader :attachment, Uploader, :mount_on => :attachment_file_name
34
+
35
+ # Get rid of the paperclip callbacks
36
+ def save_attached_files; end
37
+ def prepare_for_destroy; end
38
+ def destroy_attached_files; end
39
+
40
+ private
41
+ # Get rid of Paperclip validation
42
+ def attachment_file_name
43
+ "not_blank"
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module SpreeCloudinary
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "spree_cloudinary/version"
2
+
3
+ module SpreeCloudinary
4
+ 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 'spree_cloudinary/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'spree_cloudinary'
8
+ spec.version = SpreeCloudinary::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 'spree_core', '~> 1.3.0'
27
+ spec.add_dependency 'carrierwave', '~> 0.8.0'
28
+ spec.add_dependency 'cloudinary', '~> 1.0.0'
29
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_cloudinary
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Thach Chau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-27 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: spree_core
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 1.3.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.0
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.8.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.8.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.0.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.0
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/spree/image_decorator.rb
126
+ - lib/spree_cloudinary.rb
127
+ - lib/spree_cloudinary/version.rb
128
+ - spree_cloudinary.gemspec
129
+ homepage: https://github.com/chautoni
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 1.9.2
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.0.3
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Most code is taken from https://github.com/genuitytech/spree-carrierwave
153
+ test_files: []