miso 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. data/Rakefile +1 -1
  2. data/TODO +6 -2
  3. data/VERSION +1 -1
  4. data/lib/miso.rb +9 -0
  5. data/lib/miso/image.rb +8 -0
  6. data/lib/miso/processor.rb +10 -3
  7. data/lib/miso/processor/core_image.rb +83 -8
  8. data/miso.gemspec +11 -26
  9. data/spec/api/factory_spec.rb +1 -1
  10. data/spec/api/image_spec.rb +19 -9
  11. data/spec/api/processor/core_image_spec.rb +29 -0
  12. data/spec/api/processor_spec.rb +10 -2
  13. data/spec/functional/processor/core_image_spec.rb +43 -0
  14. data/spec/functional/processor_spec.rb +14 -0
  15. data/spec/start.rb +12 -0
  16. metadata +8 -24
  17. data/html/classes/Miso.html +0 -133
  18. data/html/classes/Miso/Factory.html +0 -278
  19. data/html/classes/Miso/Image.html +0 -394
  20. data/html/classes/Miso/Processor.html +0 -379
  21. data/html/classes/Miso/Processor/CoreImage.html +0 -246
  22. data/html/classes/Miso/Processor/ImageMagick.html +0 -345
  23. data/html/classes/Miso/Processor/NotImplementedError.html +0 -111
  24. data/html/created.rid +0 -1
  25. data/html/files/LICENSE.html +0 -133
  26. data/html/files/README.html +0 -156
  27. data/html/files/lib/miso/factory_rb.html +0 -101
  28. data/html/files/lib/miso/image_rb.html +0 -101
  29. data/html/files/lib/miso/processor/core_image_rb.html +0 -108
  30. data/html/files/lib/miso/processor/image_magick_rb.html +0 -110
  31. data/html/files/lib/miso/processor_rb.html +0 -101
  32. data/html/files/lib/miso_rb.html +0 -101
  33. data/html/fr_class_index.html +0 -33
  34. data/html/fr_file_index.html +0 -34
  35. data/html/fr_method_index.html +0 -62
  36. data/html/index.html +0 -24
  37. data/html/rdoc-style.css +0 -208
  38. data/pkg/miso-0.1.0.gem +0 -0
data/spec/start.rb CHANGED
@@ -27,4 +27,16 @@ class Test::Unit::TestCase
27
27
  def temp_file(filename)
28
28
  File.join(TMP_DIR, filename)
29
29
  end
30
+
31
+ def with_load_path(*load_path)
32
+ before = $:.dup
33
+ $:.replace load_path
34
+ yield
35
+ ensure
36
+ $:.replace before
37
+ end
38
+
39
+ def file_info(path)
40
+ `/usr/bin/env file '#{path}'`.split(':').last.strip
41
+ end
30
42
  end
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.1.1
4
+ version: 0.2.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-10-20 00:00:00 +02:00
13
+ date: 2009-10-21 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -40,27 +40,6 @@ files:
40
40
  - Rakefile
41
41
  - TODO
42
42
  - VERSION
43
- - html/classes/Miso.html
44
- - html/classes/Miso/Factory.html
45
- - html/classes/Miso/Image.html
46
- - html/classes/Miso/Processor.html
47
- - html/classes/Miso/Processor/CoreImage.html
48
- - html/classes/Miso/Processor/ImageMagick.html
49
- - html/classes/Miso/Processor/NotImplementedError.html
50
- - html/created.rid
51
- - html/files/LICENSE.html
52
- - html/files/README.html
53
- - html/files/lib/miso/factory_rb.html
54
- - html/files/lib/miso/image_rb.html
55
- - html/files/lib/miso/processor/core_image_rb.html
56
- - html/files/lib/miso/processor/image_magick_rb.html
57
- - html/files/lib/miso/processor_rb.html
58
- - html/files/lib/miso_rb.html
59
- - html/fr_class_index.html
60
- - html/fr_file_index.html
61
- - html/fr_method_index.html
62
- - html/index.html
63
- - html/rdoc-style.css
64
43
  - lib/miso.rb
65
44
  - lib/miso/factory.rb
66
45
  - lib/miso/image.rb
@@ -68,12 +47,14 @@ files:
68
47
  - lib/miso/processor/core_image.rb
69
48
  - lib/miso/processor/image_magick.rb
70
49
  - miso.gemspec
71
- - pkg/miso-0.1.0.gem
72
50
  - spec/api/factory_spec.rb
73
51
  - spec/api/image_spec.rb
52
+ - spec/api/processor/core_image_spec.rb
74
53
  - spec/api/processor/image_magick_spec.rb
75
54
  - spec/api/processor_spec.rb
76
55
  - spec/fixtures/120x100.png
56
+ - spec/functional/processor/core_image_spec.rb
57
+ - spec/functional/processor_spec.rb
77
58
  - spec/start.rb
78
59
  has_rdoc: true
79
60
  homepage: http://github.com/Fingertips/miso
@@ -106,6 +87,9 @@ summary: Miso is a unified API for simple image operations commonly used on the
106
87
  test_files:
107
88
  - spec/api/factory_spec.rb
108
89
  - spec/api/image_spec.rb
90
+ - spec/api/processor/core_image_spec.rb
109
91
  - spec/api/processor/image_magick_spec.rb
110
92
  - spec/api/processor_spec.rb
93
+ - spec/functional/processor/core_image_spec.rb
94
+ - spec/functional/processor_spec.rb
111
95
  - spec/start.rb
@@ -1,133 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Module: Miso</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Module</strong></td>
53
- <td class="class-name-in-header">Miso</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../files/lib/miso/factory_rb.html">
59
- lib/miso/factory.rb
60
- </a>
61
- <br />
62
- <a href="../files/lib/miso/image_rb.html">
63
- lib/miso/image.rb
64
- </a>
65
- <br />
66
- <a href="../files/lib/miso/processor/core_image_rb.html">
67
- lib/miso/processor/core_image.rb
68
- </a>
69
- <br />
70
- <a href="../files/lib/miso/processor/image_magick_rb.html">
71
- lib/miso/processor/image_magick.rb
72
- </a>
73
- <br />
74
- <a href="../files/lib/miso/processor_rb.html">
75
- lib/miso/processor.rb
76
- </a>
77
- <br />
78
- <a href="../files/lib/miso_rb.html">
79
- lib/miso.rb
80
- </a>
81
- <br />
82
- </td>
83
- </tr>
84
-
85
- </table>
86
- </div>
87
- <!-- banner header -->
88
-
89
- <div id="bodyContent">
90
-
91
-
92
-
93
- <div id="contextContent">
94
-
95
-
96
-
97
- </div>
98
-
99
-
100
- </div>
101
-
102
-
103
- <!-- if includes -->
104
-
105
- <div id="section">
106
-
107
- <div id="class-list">
108
- <h3 class="section-bar">Classes and Modules</h3>
109
-
110
- Class <a href="Miso/Factory.html" class="link">Miso::Factory</a><br />
111
- Class <a href="Miso/Image.html" class="link">Miso::Image</a><br />
112
- Class <a href="Miso/Processor.html" class="link">Miso::Processor</a><br />
113
-
114
- </div>
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
- <!-- if method_list -->
123
-
124
-
125
- </div>
126
-
127
-
128
- <div id="validator-badges">
129
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
130
- </div>
131
-
132
- </body>
133
- </html>
@@ -1,278 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: Miso::Factory</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">Miso::Factory</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/miso/factory_rb.html">
59
- lib/miso/factory.rb
60
- </a>
61
- <br />
62
- </td>
63
- </tr>
64
-
65
- <tr class="top-aligned-row">
66
- <td><strong>Parent:</strong></td>
67
- <td>
68
- Object
69
- </td>
70
- </tr>
71
- </table>
72
- </div>
73
- <!-- banner header -->
74
-
75
- <div id="bodyContent">
76
-
77
-
78
-
79
- <div id="contextContent">
80
-
81
- <div id="description">
82
- <p>
83
- A <a href="Factory.html">Miso::Image::Factory</a> can be used to define
84
- multiple operations which are to be applied to an image.
85
- </p>
86
- <p>
87
- A typical use case would be:
88
- </p>
89
- <pre>
90
- class Member &lt; ActiveRecord::Base
91
- has_variant :avatar, :processor =&gt; Miso::Image.factory.crop(123, 456).watermark(WATERMARK, :southwest, 10, 10)
92
- end
93
- </pre>
94
- <p>
95
- In this example, the resulting <a href="Factory.html">Miso::Factory</a>
96
- instance would be used by the attachment library to <a
97
- href="Factory.html#M000026">apply</a> the operations. Eg:
98
- </p>
99
- <pre>
100
- module HasVariant
101
- def process_variant(name)
102
- variant = self.class.variants[name]
103
- variant.processor.apply(upload_file, output_file)
104
- end
105
- end
106
- </pre>
107
-
108
- </div>
109
-
110
-
111
- </div>
112
-
113
- <div id="method-list">
114
- <h3 class="section-bar">Methods</h3>
115
-
116
- <div class="name-list">
117
- <a href="#M000026">apply</a>&nbsp;&nbsp;
118
- <a href="#M000023">crop</a>&nbsp;&nbsp;
119
- <a href="#M000025">crop_fitting</a>&nbsp;&nbsp;
120
- <a href="#M000024">fit</a>&nbsp;&nbsp;
121
- <a href="#M000022">new</a>&nbsp;&nbsp;
122
- </div>
123
- </div>
124
-
125
- </div>
126
-
127
-
128
- <!-- if includes -->
129
-
130
- <div id="section">
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
- <!-- if method_list -->
140
- <div id="methods">
141
- <h3 class="section-bar">Public Class methods</h3>
142
-
143
- <div id="method-M000022" class="method-detail">
144
- <a name="M000022"></a>
145
-
146
- <div class="method-heading">
147
- <a href="#M000022" class="method-signature">
148
- <span class="method-name">new</span><span class="method-args">(processor_class = Processor.processor_class)</span>
149
- </a>
150
- </div>
151
-
152
- <div class="method-description">
153
- <p><a class="source-toggle" href="#"
154
- onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
155
- <div class="method-source-code" id="M000022-source">
156
- <pre>
157
- <span class="ruby-comment cmt"># File lib/miso/factory.rb, line 27</span>
158
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">processor_class</span> = <span class="ruby-constant">Processor</span>.<span class="ruby-identifier">processor_class</span>)
159
- <span class="ruby-ivar">@processor_class</span> = <span class="ruby-identifier">processor_class</span>
160
- <span class="ruby-ivar">@operations</span> = []
161
- <span class="ruby-keyword kw">end</span>
162
- </pre>
163
- </div>
164
- </div>
165
- </div>
166
-
167
- <h3 class="section-bar">Public Instance methods</h3>
168
-
169
- <div id="method-M000026" class="method-detail">
170
- <a name="M000026"></a>
171
-
172
- <div class="method-heading">
173
- <a href="#M000026" class="method-signature">
174
- <span class="method-name">apply</span><span class="method-args">(input_file, output_file)</span>
175
- </a>
176
- </div>
177
-
178
- <div class="method-description">
179
- <p><a class="source-toggle" href="#"
180
- onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
181
- <div class="method-source-code" id="M000026-source">
182
- <pre>
183
- <span class="ruby-comment cmt"># File lib/miso/factory.rb, line 47</span>
184
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply</span>(<span class="ruby-identifier">input_file</span>, <span class="ruby-identifier">output_file</span>)
185
- <span class="ruby-identifier">image</span> = <span class="ruby-constant">Image</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">input_file</span>, <span class="ruby-ivar">@processor_class</span>)
186
- <span class="ruby-ivar">@operations</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">method</span>, <span class="ruby-identifier">args</span><span class="ruby-operator">|</span> <span class="ruby-identifier">image</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">method</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) }
187
- <span class="ruby-identifier">image</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">output_file</span>)
188
- <span class="ruby-keyword kw">end</span>
189
- </pre>
190
- </div>
191
- </div>
192
- </div>
193
-
194
- <div id="method-M000023" class="method-detail">
195
- <a name="M000023"></a>
196
-
197
- <div class="method-heading">
198
- <a href="#M000023" class="method-signature">
199
- <span class="method-name">crop</span><span class="method-args">(width, height)</span>
200
- </a>
201
- </div>
202
-
203
- <div class="method-description">
204
- <p><a class="source-toggle" href="#"
205
- onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
206
- <div class="method-source-code" id="M000023-source">
207
- <pre>
208
- <span class="ruby-comment cmt"># File lib/miso/factory.rb, line 32</span>
209
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crop</span>(<span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>)
210
- <span class="ruby-ivar">@operations</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">:crop</span>, [<span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>]]
211
- <span class="ruby-keyword kw">self</span>
212
- <span class="ruby-keyword kw">end</span>
213
- </pre>
214
- </div>
215
- </div>
216
- </div>
217
-
218
- <div id="method-M000025" class="method-detail">
219
- <a name="M000025"></a>
220
-
221
- <div class="method-heading">
222
- <a href="#M000025" class="method-signature">
223
- <span class="method-name">crop_fitting</span><span class="method-args">(width, heigth)</span>
224
- </a>
225
- </div>
226
-
227
- <div class="method-description">
228
- <p><a class="source-toggle" href="#"
229
- onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
230
- <div class="method-source-code" id="M000025-source">
231
- <pre>
232
- <span class="ruby-comment cmt"># File lib/miso/factory.rb, line 42</span>
233
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crop_fitting</span>(<span class="ruby-identifier">width</span>, <span class="ruby-identifier">heigth</span>)
234
- <span class="ruby-ivar">@operations</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">:crop_fitting</span>, [<span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>]]
235
- <span class="ruby-keyword kw">self</span>
236
- <span class="ruby-keyword kw">end</span>
237
- </pre>
238
- </div>
239
- </div>
240
- </div>
241
-
242
- <div id="method-M000024" class="method-detail">
243
- <a name="M000024"></a>
244
-
245
- <div class="method-heading">
246
- <a href="#M000024" class="method-signature">
247
- <span class="method-name">fit</span><span class="method-args">(width, height)</span>
248
- </a>
249
- </div>
250
-
251
- <div class="method-description">
252
- <p><a class="source-toggle" href="#"
253
- onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
254
- <div class="method-source-code" id="M000024-source">
255
- <pre>
256
- <span class="ruby-comment cmt"># File lib/miso/factory.rb, line 37</span>
257
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fit</span>(<span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>)
258
- <span class="ruby-ivar">@operations</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">:fit</span>, [<span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>]]
259
- <span class="ruby-keyword kw">self</span>
260
- <span class="ruby-keyword kw">end</span>
261
- </pre>
262
- </div>
263
- </div>
264
- </div>
265
-
266
-
267
- </div>
268
-
269
-
270
- </div>
271
-
272
-
273
- <div id="validator-badges">
274
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
275
- </div>
276
-
277
- </body>
278
- </html>