miso 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -7,8 +7,8 @@ to plug in your own backend.
7
7
  A unified API is helpful when you run your code on a number of different boxes
8
8
  and architectures. For instance, you could develop your web application on your
9
9
  Mac with the Core Image backend [1] and deploy to your Linux server with an
10
- ImageMagick backend. You could even have the API talk to your custom
11
- distributed image processing backend.
10
+ ImageMagick/GraphicsMagick backend. You could even have the API talk to your
11
+ custom distributed image processing backend.
12
12
 
13
13
  [1] Note how this means you will never have to install ImageMagick again (;
14
14
 
@@ -50,15 +50,20 @@ But wait, there is more! Read the API documentation for more goodies.
50
50
 
51
51
  : SUPPORTED BACKENDS
52
52
 
53
- Currently supported backends are: Core Image and ImageMagick, because those
54
- are the ones we use. If you want to contribute backends we're happy to
55
- accept patches!
53
+ Currently supported backends are: Core Image, ImageMagick, and GraphicsMagick,
54
+ because those are the ones we, and our contributors use. If you want to
55
+ contribute backends we're happy to accept patches!
56
+
57
+
58
+ : CONTRIBUTORS
59
+
60
+ ~> GraphicsMagick * Paul Vaillant (> http://github.com/pvaillant <)
56
61
 
57
62
 
58
63
  : ENDORSEMENTS
59
64
 
60
- @garyyuen: ‘miso with indian flavors. seems ok.’
61
- @Oracl: ‘@veganza I love miso! :)’
65
+ @garyyuen: ‘miso with indian flavors. seems ok.’
66
+ @Oracl: ‘@veganza I love miso! :)’
62
67
  @lehudgins: ‘ok fine. Miso totally does go kinda bad after a year.’
63
- Wikipedia: ‘High in protein and rich in vitamins and minerals, miso played an
64
- important nutritional role in feudal Japan.’
68
+ Wikipedia: ‘High in protein and rich in vitamins and minerals, miso played
69
+ an important nutritional role in feudal Japan.’
data/Rakefile CHANGED
@@ -42,7 +42,7 @@ begin
42
42
  s.authors = ["Eloy Duran", "Manfred Stienstra"]
43
43
  s.summary = s.description = "Miso is a unified API for simple image operations commonly used on the web."
44
44
  s.files -= %w{ .gitignore .kick }
45
- s.add_dependency('executioner', '>= 0.2.0')
45
+ s.add_dependency('executioner', '>= 0.3.0')
46
46
  end
47
47
  rescue LoadError
48
48
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.3.0
@@ -1,7 +1,8 @@
1
1
  module Miso
2
2
  class Processor
3
- autoload :CoreImage, 'miso/processor/core_image'
4
- autoload :ImageMagick, 'miso/processor/image_magick'
3
+ autoload :CoreImage, 'miso/processor/core_image'
4
+ autoload :GraphicsMagick, 'miso/processor/graphics_magick'
5
+ autoload :ImageMagick, 'miso/processor/image_magick'
5
6
 
6
7
  class << self
7
8
  # Sets the default processor class.
@@ -26,7 +27,7 @@ module Miso
26
27
  # When no explicit processor_class is set this list is iterated, from
27
28
  # first to last, and the first available processor on the machine is used.
28
29
  def processor_classes
29
- @processor_classes ||= [CoreImage, ImageMagick]
30
+ @processor_classes ||= [CoreImage, GraphicsMagick, ImageMagick]
30
31
  end
31
32
 
32
33
  def available?
@@ -65,4 +66,4 @@ module Miso
65
66
  dimensions.last
66
67
  end
67
68
  end
68
- end
69
+ end
@@ -0,0 +1,20 @@
1
+ module Miso
2
+ class Processor
3
+ class GraphicsMagick < ImageMagick
4
+ def self.available?
5
+ !find_executable('gm').nil?
6
+ end
7
+
8
+ executable :gm
9
+
10
+ def identify(input_file)
11
+ gm "identify '#{input_file}'"
12
+ end
13
+
14
+ def convert(source_path, output_path, options)
15
+ ensure_output_directory(output_path)
16
+ gm "convert '#{source_path}' #{options} '#{output_path}'"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,6 +1,6 @@
1
1
  begin
2
2
  require 'rubygems'
3
- gem 'executioner', '>= 0.2'
3
+ gem 'executioner', '>= 0.3'
4
4
  rescue LoadError
5
5
  end
6
6
  require 'executioner'
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{miso}
8
- s.version = "0.2.4"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eloy Duran", "Manfred Stienstra"]
12
- s.date = %q{2009-12-10}
12
+ s.date = %q{2009-12-29}
13
13
  s.description = %q{Miso is a unified API for simple image operations commonly used on the web.}
14
14
  s.email = ["eloy@fngtps.com", "manfred@fngtps.com"]
15
15
  s.extra_rdoc_files = [
@@ -27,15 +27,16 @@ Gem::Specification.new do |s|
27
27
  "lib/miso/image.rb",
28
28
  "lib/miso/processor.rb",
29
29
  "lib/miso/processor/core_image.rb",
30
+ "lib/miso/processor/graphics_magick.rb",
30
31
  "lib/miso/processor/image_magick.rb",
31
32
  "miso.gemspec",
32
33
  "spec/api/factory_spec.rb",
33
34
  "spec/api/image_spec.rb",
34
- "spec/api/processor/core_image_spec.rb",
35
- "spec/api/processor/image_magick_spec.rb",
36
35
  "spec/api/processor_spec.rb",
36
+ "spec/api/processors_spec.rb",
37
37
  "spec/fixtures/120x100.png",
38
38
  "spec/functional/processor/core_image_spec.rb",
39
+ "spec/functional/processor/graphics_magick_spec.rb",
39
40
  "spec/functional/processor/image_magick_spec.rb",
40
41
  "spec/functional/processor_spec.rb",
41
42
  "spec/start.rb"
@@ -48,10 +49,10 @@ Gem::Specification.new do |s|
48
49
  s.test_files = [
49
50
  "spec/api/factory_spec.rb",
50
51
  "spec/api/image_spec.rb",
51
- "spec/api/processor/core_image_spec.rb",
52
- "spec/api/processor/image_magick_spec.rb",
53
52
  "spec/api/processor_spec.rb",
53
+ "spec/api/processors_spec.rb",
54
54
  "spec/functional/processor/core_image_spec.rb",
55
+ "spec/functional/processor/graphics_magick_spec.rb",
55
56
  "spec/functional/processor/image_magick_spec.rb",
56
57
  "spec/functional/processor_spec.rb",
57
58
  "spec/start.rb"
@@ -70,4 +71,3 @@ Gem::Specification.new do |s|
70
71
  s.add_dependency(%q<executioner>, [">= 0.2.0"])
71
72
  end
72
73
  end
73
-
@@ -0,0 +1,28 @@
1
+ require File.expand_path('../../start', __FILE__)
2
+
3
+ Miso::Processor.processor_classes.each do |processor|
4
+ if processor.available?
5
+ describe "An instance of #{processor.name}" do
6
+ before do
7
+ @image_120_x_100 = Miso::Image.new(fixture_file('120x100.png'), processor)
8
+ @output_file = temp_file('temp.png')
9
+ end
10
+
11
+ it "should crop to specified dimensions" do
12
+ @image_120_x_100.crop(40, 30).write(@output_file).dimensions.should == [40, 30]
13
+ @image_120_x_100.crop(40, 33).write(@output_file).dimensions.should == [40, 33]
14
+ end
15
+
16
+ it "should fit to specified dimensions, conserving the original aspect ratio" do
17
+ @image_120_x_100.fit(40, 30).write(@output_file).dimensions.should == [36, 30]
18
+ @image_120_x_100.fit(40, 34).write(@output_file).dimensions.should == [40, 33]
19
+ end
20
+
21
+ it "should return its dimensions" do
22
+ @image_120_x_100.dimensions.should == [120, 100]
23
+ end
24
+ end
25
+ else
26
+ warn "[!] Skipping #{processor.name} api spec."
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ require File.expand_path('../../../start', __FILE__)
2
+
3
+ if Executioner::ClassMethods.find_executable('gm')
4
+ describe "Miso::Processor::GraphicsMagick" do
5
+ it "should check the load paths to see if GraphicsMagick is available" do
6
+ Miso::Processor::GraphicsMagick.should.be.available
7
+
8
+ Miso::Processor::GraphicsMagick.stubs(:find_executable).returns(nil)
9
+ Miso::Processor::GraphicsMagick.should.not.be.available
10
+ end
11
+ end
12
+
13
+ else
14
+ warn "[!] Skipping Miso::Processor::GraphicsMagick functional spec."
15
+ end
@@ -10,6 +10,7 @@ require 'miso'
10
10
  require 'miso/processor'
11
11
  require 'miso/processor/core_image'
12
12
  require 'miso/processor/image_magick'
13
+ require 'miso/processor/graphics_magick'
13
14
 
14
15
  class Test::Unit::TestCase
15
16
  TMP_DIR = File.expand_path('../tmp', __FILE__)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-10 00:00:00 +01:00
13
+ date: 2009-12-29 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -45,15 +45,16 @@ files:
45
45
  - lib/miso/image.rb
46
46
  - lib/miso/processor.rb
47
47
  - lib/miso/processor/core_image.rb
48
+ - lib/miso/processor/graphics_magick.rb
48
49
  - lib/miso/processor/image_magick.rb
49
50
  - miso.gemspec
50
51
  - spec/api/factory_spec.rb
51
52
  - spec/api/image_spec.rb
52
- - spec/api/processor/core_image_spec.rb
53
- - spec/api/processor/image_magick_spec.rb
54
53
  - spec/api/processor_spec.rb
54
+ - spec/api/processors_spec.rb
55
55
  - spec/fixtures/120x100.png
56
56
  - spec/functional/processor/core_image_spec.rb
57
+ - spec/functional/processor/graphics_magick_spec.rb
57
58
  - spec/functional/processor/image_magick_spec.rb
58
59
  - spec/functional/processor_spec.rb
59
60
  - spec/start.rb
@@ -88,10 +89,10 @@ summary: Miso is a unified API for simple image operations commonly used on the
88
89
  test_files:
89
90
  - spec/api/factory_spec.rb
90
91
  - spec/api/image_spec.rb
91
- - spec/api/processor/core_image_spec.rb
92
- - spec/api/processor/image_magick_spec.rb
93
92
  - spec/api/processor_spec.rb
93
+ - spec/api/processors_spec.rb
94
94
  - spec/functional/processor/core_image_spec.rb
95
+ - spec/functional/processor/graphics_magick_spec.rb
95
96
  - spec/functional/processor/image_magick_spec.rb
96
97
  - spec/functional/processor_spec.rb
97
98
  - spec/start.rb
@@ -1,29 +0,0 @@
1
- require File.expand_path('../../../start', __FILE__)
2
-
3
- begin
4
- require 'osx/cocoa'
5
-
6
- describe "An instance of Miso::Processor::CoreImage" do
7
- before do
8
- @image_120_x_100 = Miso::Image.new(fixture_file('120x100.png'), Miso::Processor::CoreImage)
9
- @output_file = temp_file('temp.png')
10
- end
11
-
12
- it "should crop to specified dimensions" do
13
- @image_120_x_100.crop(40, 30).write(@output_file).dimensions.should == [40, 30]
14
- @image_120_x_100.crop(40, 33).write(@output_file).dimensions.should == [40, 33]
15
- end
16
-
17
- it "should fit to specified dimensions, conserving the original aspect ratio" do
18
- @image_120_x_100.fit(40, 30).write(@output_file).dimensions.should == [36, 30]
19
- @image_120_x_100.fit(40, 34).write(@output_file).dimensions.should == [40, 33]
20
- end
21
-
22
- it "should return its dimensions" do
23
- @image_120_x_100.dimensions.should == [120, 100]
24
- end
25
- end
26
-
27
- rescue LoadError
28
- warn "[!] Skipping Miso::Processor::CoreImage API spec."
29
- end
@@ -1,22 +0,0 @@
1
- require File.expand_path('../../../start', __FILE__)
2
-
3
- describe "An instance of Miso::Processor::ImageMagick" do
4
- before do
5
- @image_120_x_100 = Miso::Image.new(fixture_file('120x100.png'), Miso::Processor::ImageMagick)
6
- @output_file = temp_file('temp.png')
7
- end
8
-
9
- it "should crop to specified dimensions" do
10
- @image_120_x_100.crop(40, 30).write(@output_file).dimensions.should == [40, 30]
11
- @image_120_x_100.crop(40, 33).write(@output_file).dimensions.should == [40, 33]
12
- end
13
-
14
- it "should fit to specified dimensions, conserving the original aspect ratio" do
15
- @image_120_x_100.fit(40, 30).write(@output_file).dimensions.should == [36, 30]
16
- @image_120_x_100.fit(40, 34).write(@output_file).dimensions.should == [40, 33]
17
- end
18
-
19
- it "should return its dimensions" do
20
- @image_120_x_100.dimensions.should == [120, 100]
21
- end
22
- end