asset-image-opt 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,16 +1,22 @@
1
1
  # Asset-Image-Opt
2
2
 
3
- Local assets optimizer for Rails apps
3
+ Local assets optimizer for Rails apps. It will use lossless compression on every jpeg/jpg and png files in app/assets/images directory and subdirecotires.
4
+
5
+ Compression efficiency is 5-15% for free and without quality loss.
4
6
 
5
7
  ## Installation
6
8
 
7
- This gem requires two image optimization utilities: **optipng** and
8
- **jpegoptim**.
9
- You can install them by following the instructions on each authors'
10
- page:
9
+ This gem requires image processing utilities
10
+
11
+ ### Debian/Ubuntu
12
+
13
+ sudo apt-get install -y advancecomp gifsicle jpegoptim libjpeg-progs optipng pngcrush
14
+
15
+ ### OSX
11
16
 
12
- * Installation for [optipng](http://optipng.sourceforge.net/)
13
- * Installation for [jpegoptim](http://freecode.com/projects/jpegoptim)
17
+ brew install advancecomp gifsicle jpegoptim jpeg optipng pngcrush
18
+
19
+ ### Rails
14
20
 
15
21
  Add this line to your application's Gemfile:
16
22
 
@@ -24,8 +30,12 @@ And then execute:
24
30
  Execute:
25
31
 
26
32
  bundle exec optimize_images
27
-
28
- It will optimize all images in app/assets/images
33
+
34
+ It will optimize all images in app/assets/images and subdirs.
35
+
36
+ ## TODO
37
+ * Check if **optipng** and **jpegoptim** is present in the system, show instructions otherwise
38
+ * Remove test_images from rspec and gem source
29
39
 
30
40
  ## Contributing
31
41
 
@@ -16,6 +16,6 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
- gem.add_dependency 'piet'
19
+ gem.add_dependency 'image_optim'
20
20
  gem.add_development_dependency 'rspec'
21
21
  end
@@ -1,9 +1,9 @@
1
1
  require "asset-image-opt/version"
2
- require 'piet'
2
+ require 'image_optim'
3
3
  require 'thread'
4
4
 
5
5
  class AssetImageOpt
6
- EXTENSIONS = %w{png jpeg jpg}
6
+ EXTENSIONS = %w{png jpeg jpg gif}
7
7
  WORKING_DIR = "app/assets/images"
8
8
 
9
9
  attr_accessor :files, :initial_size, :optimized_size
@@ -11,6 +11,7 @@ class AssetImageOpt
11
11
  def initialize
12
12
  @files = AssetImageOpt.get_files
13
13
  @initial_size = get_files_size
14
+ @optimizer = ImageOptim.new(:pngout => false)
14
15
  end
15
16
 
16
17
  def threads_count
@@ -71,7 +72,7 @@ class AssetImageOpt
71
72
  end
72
73
 
73
74
  def optimize_file(file)
74
- Piet.optimize(file)
75
+ @optimizer.optimize_image!(file)
75
76
  print '.'
76
77
  end
77
78
 
@@ -1,7 +1,7 @@
1
1
  module Asset
2
2
  module Image
3
3
  module Opt
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset-image-opt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-22 00:00:00.000000000 Z
12
+ date: 2013-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: piet
15
+ name: image_optim
16
16
  prerelease: false
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements: