carrierwave-webp 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: cd58ae509a9b837e06aea5d994b10dc51a3a4256
4
+ data.tar.gz: c499221fcd0e8c972bf70c95da885aa63bf37ed9
5
+ SHA512:
6
+ metadata.gz: 496ee3e3b4a7f487e4249fb3a6e527e107d91a8d452a0a96f6679fa92ddf380f4ef925a6ef055f4ad1a9d21b7be6800ff775a99d5e456e8a5742ccf13fa6f34b
7
+ data.tar.gz: 65a0fea435eb1b23b151f9849b4165b6848fc4de33691661d16fc87d3c3455e4bc48cc05d7a1ce61dd406d8b3495c191647b4c1f7d37ea329113bc5baa072431
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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in carrierwave-webp.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Max Riveiro
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,39 @@
1
+ # Carrierwave::WebP
2
+
3
+ This gem provides an ugly, but working solution for converting uploads to the WebP format.
4
+
5
+ I created it as an expirement, so gem's API can change in the future. I you're warned!
6
+
7
+ ## Installation
8
+
9
+ Just add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'carrierwave-webp'
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ Here is an example of usage:
18
+
19
+ ```ruby
20
+ # This is some basic image uploader
21
+ class ImageUploader < ::CarrierWave::Uploader::Base
22
+ include CarrierWave::MiniMagick
23
+ include CarrierWave::WebP::Converter
24
+
25
+ version :show do
26
+ process resize_to_fill: [100, 100]
27
+ process convert: :png
28
+ process :convert_to_webp # Add this to enable WebP Conversion
29
+ end
30
+ end
31
+ ```
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'carrierwave/webp/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'carrierwave-webp'
9
+ spec.version = Carrierwave::Webp::VERSION
10
+ spec.authors = ['Max Riveiro']
11
+ spec.email = ['kavu13@gmail.com']
12
+ spec.description = %q{CarrierWave module for processing your uploads into WebP format}
13
+ spec.summary = %q{CarrierWave module for processing your uploads into WebP format}
14
+ spec.homepage = 'https://github.com/kavu/carrierwave-webp'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.test_files = spec.files.grep(%r{^(test|spec)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'webp-ffi', '~> 0.1.7'
22
+ spec.add_dependency 'carrierwave', '~> 0.8'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ end
@@ -0,0 +1,2 @@
1
+ require 'carrierwave/webp/version'
2
+ require 'carrierwave/webp/converter'
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'webp-ffi'
4
+
5
+ module CarrierWave
6
+ module WebP
7
+ module Converter
8
+ def convert_to_webp(options = {})
9
+ manipulate! do |img|
10
+ img = yield(img) if block_given?
11
+ webp_path = "#{img.path}.webp"
12
+ old_filename = filename
13
+
14
+ ::WebP.encode(img.path, webp_path, options)
15
+
16
+ # XXX: Hacks ahead!
17
+ # I can't find any other way to store an alomost exact copy
18
+ # of file for any particular version
19
+ instance_variable_set('@filename', "#{filename}.webp")
20
+
21
+ storage.store! SanitizedFile.new({
22
+ tempfile: webp_path, filename: webp_path,
23
+ content_type: 'image/webp'
24
+ })
25
+
26
+ instance_variable_set('@filename', old_filename)
27
+
28
+ img
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ module Carrierwave
4
+ module Webp
5
+ VERSION = '0.0.1'
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: carrierwave-webp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Max Riveiro
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: webp-ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: carrierwave
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: CarrierWave module for processing your uploads into WebP format
70
+ email:
71
+ - kavu13@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - carrierwave-webp.gemspec
82
+ - lib/carrierwave-webp.rb
83
+ - lib/carrierwave/webp/converter.rb
84
+ - lib/carrierwave/webp/version.rb
85
+ homepage: https://github.com/kavu/carrierwave-webp
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.0.3
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: CarrierWave module for processing your uploads into WebP format
109
+ test_files: []