imanip 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +20 -0
- data/History.txt +5 -5
- data/{README.txt → README.rdoc} +42 -41
- data/Rakefile +11 -3
- data/imanip.gemspec +21 -0
- data/lib/imanip.rb +2 -0
- data/lib/imanip/image.rb +4 -4
- data/lib/imanip/imanip_magick.rb +6 -7
- data/lib/imanip/version.rb +1 -7
- data/test/test_helper.rb +4 -6
- data/test/test_imanip_magick.rb +31 -27
- metadata +62 -34
- data/Manifest.txt +0 -19
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/init.rb +0 -2
- data/install.rb +0 -1
- data/uninstall.rb +0 -1
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
imanip (0.1.4)
|
5
|
+
safe_shell (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
mocha (0.9.8)
|
11
|
+
rake
|
12
|
+
rake (0.8.7)
|
13
|
+
safe_shell (1.0.0)
|
14
|
+
|
15
|
+
PLATFORMS
|
16
|
+
ruby
|
17
|
+
|
18
|
+
DEPENDENCIES
|
19
|
+
imanip!
|
20
|
+
mocha (= 0.9.8)
|
data/History.txt
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
== 0.1.4 2008-10-16
|
2
2
|
|
3
3
|
* minor enhancements
|
4
|
-
|
5
|
-
|
4
|
+
* Added Image#ratio
|
5
|
+
* Crop resize is way better based on ratios
|
6
6
|
|
7
7
|
== 0.1.2 2008-08-27
|
8
8
|
|
9
9
|
* minor enhancements
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
* Magick#convert now returns an imanip image
|
11
|
+
* Image#square?
|
12
|
+
* some inline documentation
|
13
13
|
|
14
14
|
== 0.1.1 2008-06-13
|
15
15
|
|
data/{README.txt → README.rdoc}
RENAMED
@@ -21,80 +21,81 @@ it works really well, and I'm already using it on some very high volume producti
|
|
21
21
|
|
22
22
|
|
23
23
|
First things, first, Tell me where you keep them:
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
|
25
|
+
|
26
|
+
# Rails: production|development|etc.rb
|
27
|
+
# or somewhere that gets loaded before you initialize
|
28
|
+
|
29
|
+
Imanip::Interface::Magick.execute_path = '/path/to/your/bins/' # eg /usr/local/bin/
|
30
|
+
|
31
31
|
|
32
32
|
With an image file at /dir/image.jpg
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
|
34
|
+
image = Imanip::Image.new('/dir/image.jpg')
|
35
|
+
|
36
36
|
This will run identify on the image and make sure its convert-able. If it cant read or interpret it it will raise an Imanip::NotAnImageError.
|
37
37
|
|
38
38
|
Once you have the image you can check some properties/attributes
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
|
40
|
+
image.width #=> 410 (Fixnum)
|
41
|
+
image.height #=> 100 (Fixnum)
|
42
|
+
image.format #=> JPEG (String)
|
43
43
|
|
44
44
|
There are also some helpers to do some rule based cropping.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
|
46
|
+
image.portrait? #=> false
|
47
|
+
image.landscape? #=> true
|
48
|
+
image.orientation #=> :landscape
|
49
|
+
|
50
50
|
After that you can resize and whatever
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
|
52
|
+
image.resize('outputfile.jpg', :dimensions => [200,100])
|
53
|
+
|
54
54
|
I like crop_resize better. It crops AND resizes so you get an image of the exact pixel dimensions you desire.
|
55
|
-
|
56
|
-
|
55
|
+
|
56
|
+
image.crop_resize('/file/to/output.jpg', :width => 50, :height => 50) #=> output file is an exact 50x50 image
|
57
57
|
|
58
58
|
You might also want to catch errors, because they will inevitably happen. Possible Errors
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
Imanip::Error # the root, the root, the root is on fire
|
61
|
+
Imanip::NotAnImageError # Descends from above, thrown during Imanip#Image.new
|
62
|
+
Imanip::CouldNotConvertError # Also from above, thrown if theres an issue with #resize or #crop_resize (options, etc.)
|
63
63
|
|
64
64
|
More examples coming soon.
|
65
65
|
|
66
66
|
== REQUIREMENTS:
|
67
67
|
|
68
|
-
You need ImageMagick. Really any version will do, but I am developing with ImageMagick 6.3.3.
|
68
|
+
You need ImageMagick. Really any version will do, but I am developing with ImageMagick 6.3.3.
|
69
|
+
|
70
|
+
[http://www.imagemagick.org/script/download.php]
|
69
71
|
|
70
|
-
http://www.imagemagick.org/script/download.php
|
71
|
-
|
72
72
|
|
73
73
|
== INSTALL:
|
74
74
|
|
75
75
|
First, install ImageMagick:
|
76
|
-
|
76
|
+
|
77
|
+
[http://www.imagemagick.org/script/download.php]
|
77
78
|
|
78
79
|
Make sure you get the command line tools:
|
79
|
-
|
80
|
-
|
80
|
+
|
81
|
+
$ which 'convert'
|
81
82
|
|
82
83
|
Imanip works as a gem or a plugin for Rails.
|
83
|
-
|
84
|
+
|
84
85
|
As a gem:
|
85
|
-
|
86
|
-
|
87
|
-
|
86
|
+
|
87
|
+
$ sudo gem install imanip
|
88
|
+
|
88
89
|
In Rails/environment.rb
|
89
|
-
|
90
|
+
config.gem 'imanip'
|
90
91
|
|
91
92
|
Or you can get the ABSOLUTE latest from github:
|
92
93
|
|
93
|
-
|
94
|
+
$ sudo gem install quirkey-imanip -s http://gems.github.com
|
94
95
|
|
95
96
|
To install as a plugin (you need git):
|
96
|
-
|
97
|
-
|
97
|
+
|
98
|
+
$ git clone git://github.com/quirkey/imanip.git vendor/plugins/imanip
|
98
99
|
|
99
100
|
== LICENSE:
|
100
101
|
|
data/Rakefile
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
3
|
|
4
|
-
|
4
|
+
require 'rake/testtask'
|
5
|
+
Rake::TestTask.new do |test|
|
6
|
+
test.libs << 'lib' << 'test'
|
7
|
+
test.pattern = 'test/**/test_*.rb'
|
8
|
+
test.ruby_opts = ['-rubygems']
|
9
|
+
test.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
task :default => :test
|
data/imanip.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.expand_path('../lib/imanip/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "imanip"
|
6
|
+
s.summary = "Super-quick image resizing using the ImageMagick command line tools"
|
7
|
+
s.description = "Super-quick image resizing using the ImageMagick command line tools"
|
8
|
+
s.email = "aaron@quirkey.com"
|
9
|
+
s.homepage = "http://quirkey.rubyforge.org"
|
10
|
+
s.authors = ["Aaron Quint"]
|
11
|
+
s.version = Imanip::Version
|
12
|
+
|
13
|
+
s.add_dependency 'safe_shell', '~> 1.0'
|
14
|
+
|
15
|
+
s.add_development_dependency 'mocha', '0.9.8'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/lib/imanip.rb
CHANGED
data/lib/imanip/image.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module Imanip
|
2
2
|
class Image
|
3
|
-
|
3
|
+
|
4
4
|
def initialize(path,interface = :magick)
|
5
5
|
@image_path = path
|
6
6
|
load_interface(interface)
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
private
|
10
10
|
def load_interface(interface)
|
11
11
|
@interface = Imanip::Interface.const_get("#{interface.to_s.capitalize}").new(@image_path)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def method_missing(method, *args)
|
15
15
|
@interface.send(method,*args)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
end
|
19
19
|
end
|
data/lib/imanip/imanip_magick.rb
CHANGED
@@ -13,7 +13,6 @@ module Imanip
|
|
13
13
|
@image_path = path
|
14
14
|
identify
|
15
15
|
end
|
16
|
-
|
17
16
|
|
18
17
|
alias_method :columns, :width
|
19
18
|
alias_method :rows, :height
|
@@ -22,7 +21,7 @@ module Imanip
|
|
22
21
|
def dimensions
|
23
22
|
[width,height]
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
# Returns true if the image is taller then it is long
|
27
26
|
def portrait?
|
28
27
|
width < height
|
@@ -84,7 +83,7 @@ module Imanip
|
|
84
83
|
crop_resize_string << "-resize #{to_geometry_string(:height => crop_height, :width => crop_width)}"
|
85
84
|
end
|
86
85
|
gravity = @options.delete(:gravity) || 'North'
|
87
|
-
crop_resize_string << " -gravity
|
86
|
+
crop_resize_string << " -gravity #{gravity}"
|
88
87
|
crop_resize_string << " -crop #{to_geometry_string(@geometry)}+0+0"
|
89
88
|
crop_resize_string << " #{options_to_string(@options)}"
|
90
89
|
convert(to_file,crop_resize_string)
|
@@ -123,7 +122,7 @@ module Imanip
|
|
123
122
|
@geometry = {:width => width, :height => height}
|
124
123
|
end
|
125
124
|
if @options[:dimensions]
|
126
|
-
width, height = @options.delete(:dimensions)
|
125
|
+
width, height = @options.delete(:dimensions)
|
127
126
|
@geometry = {:width => width, :height => height}
|
128
127
|
end
|
129
128
|
@geometry = {:width => @options.delete(:width), :height => @options.delete(:height) } if @options[:width] || @options[:height]
|
@@ -140,7 +139,7 @@ module Imanip
|
|
140
139
|
else
|
141
140
|
width_height.to_s
|
142
141
|
end
|
143
|
-
"
|
142
|
+
"#{geometry_string}"
|
144
143
|
end
|
145
144
|
|
146
145
|
def options_to_string(options)
|
@@ -153,13 +152,13 @@ module Imanip
|
|
153
152
|
end
|
154
153
|
|
155
154
|
def execute(command)
|
156
|
-
|
155
|
+
pieces = command.split(' ')
|
156
|
+
SafeShell.execute(pieces[0], *pieces[1..-1])
|
157
157
|
end
|
158
158
|
|
159
159
|
def execute_path
|
160
160
|
self.class.execute_path
|
161
161
|
end
|
162
162
|
end
|
163
|
-
|
164
163
|
end
|
165
164
|
end
|
data/lib/imanip/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
+
require 'mocha'
|
1
2
|
require 'test/unit'
|
2
3
|
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/imanip'))
|
3
4
|
|
4
5
|
class Test::Unit::TestCase
|
5
|
-
|
6
|
-
protected
|
7
6
|
def current_path
|
8
7
|
File.expand_path(File.dirname(__FILE__))
|
9
8
|
end
|
10
|
-
|
9
|
+
|
11
10
|
def portrait_image_path
|
12
11
|
File.join(current_path,'portrait_test.jpg')
|
13
12
|
end
|
14
|
-
|
13
|
+
|
15
14
|
def landscape_image_path
|
16
15
|
File.join(current_path,'landscape_test.jpg')
|
17
16
|
end
|
18
|
-
|
17
|
+
|
19
18
|
def new_image_path
|
20
19
|
File.join(current_path, "new_file.jpg")
|
21
20
|
end
|
22
|
-
|
23
21
|
end
|
data/test/test_imanip_magick.rb
CHANGED
@@ -6,7 +6,7 @@ class ImanipMagickTest < Test::Unit::TestCase
|
|
6
6
|
@portrait_image = new_imanip_image(portrait_image_path)
|
7
7
|
@landscape_image = new_imanip_image(landscape_image_path)
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
def teardown
|
11
11
|
File.unlink(new_image_path) if File.readable?(new_image_path)
|
12
12
|
end
|
@@ -16,54 +16,54 @@ class ImanipMagickTest < Test::Unit::TestCase
|
|
16
16
|
new_imanip_image(__FILE__)
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def test_should_return_an_imanip_image
|
21
|
-
assert @portrait_image.is_a?(Imanip::Image)
|
21
|
+
assert @portrait_image.is_a?(Imanip::Image)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def test_should_return_dimensions_as_array
|
25
25
|
dimensions = @portrait_image.dimensions
|
26
26
|
assert dimensions.is_a?(Array)
|
27
27
|
assert_equal [411,519], dimensions
|
28
|
-
|
28
|
+
|
29
29
|
dimensions = @landscape_image.dimensions
|
30
30
|
assert dimensions.is_a?(Array)
|
31
31
|
assert_equal [400,315], dimensions
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def test_portrait_should_return_true_for_portrait_image
|
35
35
|
assert @portrait_image.portrait?
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def test_portrait_should_return_false_for_landscape_image
|
39
39
|
assert !@landscape_image.portrait?
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def test_landscape_should_return_true_for_landscape_image
|
43
|
-
assert @landscape_image.landscape?
|
43
|
+
assert @landscape_image.landscape?
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def test_landscape_should_return_false_for_portrait_image
|
47
47
|
assert !@portrait_image.landscape?
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def test_ratio_should_return_width_over_height
|
51
51
|
assert_equal(@landscape_image.width.to_f / @landscape_image.height.to_f, @landscape_image.ratio)
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def test_resize_should_save_to_new_file
|
55
55
|
assert !File.readable?(new_image_path)
|
56
56
|
assert @portrait_image.resize(new_image_path, :width => 50)
|
57
57
|
assert File.readable?(new_image_path)
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def test_resize_should_resize_image_to_new_image_at_dimensions
|
61
61
|
dimensions = [100,126]
|
62
62
|
assert @portrait_image.resize(new_image_path, :dimensions => dimensions)
|
63
63
|
@new_image = new_imanip_image(new_image_path)
|
64
64
|
assert_equal dimensions, @new_image.dimensions
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
67
|
def test_resize_should_resize_image_to_new_image_at_width
|
68
68
|
width = 100
|
69
69
|
assert @portrait_image.resize(new_image_path, :width => width)
|
@@ -71,55 +71,59 @@ class ImanipMagickTest < Test::Unit::TestCase
|
|
71
71
|
assert_equal width, @new_image.width
|
72
72
|
assert_not_equal @portrait_image.height, @new_image.height
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def test_crop_resize_should_crop_and_resize_image_to_exact_dimensions
|
76
76
|
dimensions = [200,153]
|
77
77
|
assert @portrait_image.crop_resize(new_image_path, :dimensions => dimensions)
|
78
78
|
@new_image = new_imanip_image(new_image_path)
|
79
79
|
assert_equal dimensions, @new_image.dimensions
|
80
|
-
|
80
|
+
|
81
81
|
dimensions = [200,153]
|
82
82
|
assert @landscape_image.crop_resize(new_image_path, :dimensions => dimensions)
|
83
83
|
@new_image = new_imanip_image(new_image_path)
|
84
84
|
assert_equal dimensions, @new_image.dimensions
|
85
|
-
|
85
|
+
|
86
86
|
dimensions = [100,125]
|
87
87
|
assert @portrait_image.crop_resize(new_image_path, :dimensions => dimensions)
|
88
88
|
@new_image = new_imanip_image(new_image_path)
|
89
89
|
assert_equal dimensions, @new_image.dimensions
|
90
|
-
|
90
|
+
|
91
91
|
dimensions = [100,125]
|
92
92
|
assert @landscape_image.crop_resize(new_image_path, :dimensions => dimensions)
|
93
93
|
@new_image = new_imanip_image(new_image_path)
|
94
94
|
assert_equal dimensions, @new_image.dimensions
|
95
95
|
end
|
96
|
-
|
96
|
+
|
97
97
|
def test_crop_resize_should_crop_and_resize_image_to_exact_dimensions_with_square_dimensions
|
98
98
|
dimensions = [100,100]
|
99
99
|
assert @landscape_image.crop_resize(new_image_path, :dimensions => dimensions)
|
100
100
|
@new_image = new_imanip_image(new_image_path)
|
101
101
|
assert_equal dimensions, @new_image.dimensions
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
def test_crop_resize_should_return_a_imanip_image
|
105
105
|
dimensions = [100,100]
|
106
106
|
@new_image = @landscape_image.crop_resize(new_image_path, :dimensions => dimensions)
|
107
107
|
assert @new_image.is_a?(Imanip::Image)
|
108
108
|
assert_equal dimensions, @new_image.dimensions
|
109
109
|
end
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
|
113
111
|
def test_should_throw_errors_if_image_could_not_be_converted
|
114
112
|
assert_raise(Imanip::CouldNotConvertError) do
|
115
113
|
@portrait_image.resize(new_image_path, :v => "bad option")
|
116
114
|
end
|
117
115
|
end
|
118
|
-
|
119
|
-
|
116
|
+
|
117
|
+
def test_should_be_shell_safe
|
118
|
+
dimensions = [100, 100]
|
119
|
+
# exception should be thrown when identifying image
|
120
|
+
# since ; is in path trying to run a second command
|
121
|
+
assert_raises(Imanip::NotAnImageError) do
|
122
|
+
image = Imanip::Image.new("#{landscape_image_path};blah")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
120
126
|
def new_imanip_image(path,interface = :magick)
|
121
127
|
Imanip::Image.new(path,interface)
|
122
128
|
end
|
123
|
-
|
124
|
-
|
125
129
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imanip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Aaron Quint
|
@@ -9,41 +15,56 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2011-09-22 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
|
21
|
+
name: safe_shell
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 15
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
version: "1.0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: mocha
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
20
40
|
requirements:
|
21
|
-
- - "
|
41
|
+
- - "="
|
22
42
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
43
|
+
hash: 43
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 9
|
47
|
+
- 8
|
48
|
+
version: 0.9.8
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
25
51
|
description: Super-quick image resizing using the ImageMagick command line tools
|
26
|
-
email:
|
27
|
-
- aaron@quirkey.com
|
52
|
+
email: aaron@quirkey.com
|
28
53
|
executables: []
|
29
54
|
|
30
55
|
extensions: []
|
31
56
|
|
32
|
-
extra_rdoc_files:
|
33
|
-
|
34
|
-
- License.txt
|
35
|
-
- Manifest.txt
|
36
|
-
- README.txt
|
57
|
+
extra_rdoc_files: []
|
58
|
+
|
37
59
|
files:
|
60
|
+
- .gitignore
|
61
|
+
- Gemfile
|
62
|
+
- Gemfile.lock
|
38
63
|
- History.txt
|
39
64
|
- License.txt
|
40
|
-
-
|
41
|
-
- README.txt
|
65
|
+
- README.rdoc
|
42
66
|
- Rakefile
|
43
|
-
-
|
44
|
-
- config/requirements.rb
|
45
|
-
- init.rb
|
46
|
-
- install.rb
|
67
|
+
- imanip.gemspec
|
47
68
|
- lib/imanip.rb
|
48
69
|
- lib/imanip/errors.rb
|
49
70
|
- lib/imanip/image.rb
|
@@ -53,34 +74,41 @@ files:
|
|
53
74
|
- test/portrait_test.jpg
|
54
75
|
- test/test_helper.rb
|
55
76
|
- test/test_imanip_magick.rb
|
56
|
-
- uninstall.rb
|
57
|
-
has_rdoc: true
|
58
77
|
homepage: http://quirkey.rubyforge.org
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
|
63
83
|
require_paths:
|
64
84
|
- lib
|
65
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
66
87
|
requirements:
|
67
88
|
- - ">="
|
68
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
69
93
|
version: "0"
|
70
|
-
version:
|
71
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
72
96
|
requirements:
|
73
97
|
- - ">="
|
74
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
75
102
|
version: "0"
|
76
|
-
version:
|
77
103
|
requirements: []
|
78
104
|
|
79
|
-
rubyforge_project:
|
80
|
-
rubygems_version: 1.
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 1.8.9
|
81
107
|
signing_key:
|
82
|
-
specification_version:
|
108
|
+
specification_version: 3
|
83
109
|
summary: Super-quick image resizing using the ImageMagick command line tools
|
84
110
|
test_files:
|
111
|
+
- test/landscape_test.jpg
|
112
|
+
- test/portrait_test.jpg
|
85
113
|
- test/test_helper.rb
|
86
114
|
- test/test_imanip_magick.rb
|
data/Manifest.txt
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
License.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
config/hoe.rb
|
7
|
-
config/requirements.rb
|
8
|
-
init.rb
|
9
|
-
install.rb
|
10
|
-
lib/imanip.rb
|
11
|
-
lib/imanip/errors.rb
|
12
|
-
lib/imanip/image.rb
|
13
|
-
lib/imanip/imanip_magick.rb
|
14
|
-
lib/imanip/version.rb
|
15
|
-
test/landscape_test.jpg
|
16
|
-
test/portrait_test.jpg
|
17
|
-
test/test_helper.rb
|
18
|
-
test/test_imanip_magick.rb
|
19
|
-
uninstall.rb
|
data/config/hoe.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'imanip/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Aaron Quint' # can also be an array of Authors
|
4
|
-
EMAIL = 'aaron@quirkey.com'
|
5
|
-
DESCRIPTION = "Super-quick image resizing using the ImageMagick command line tools"
|
6
|
-
GEM_NAME = 'imanip' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'quirkey' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
# ['activesupport', '>= 1.3.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
|
14
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
15
|
-
@config = nil
|
16
|
-
RUBYFORGE_USERNAME = "unknown"
|
17
|
-
def rubyforge_username
|
18
|
-
unless @config
|
19
|
-
begin
|
20
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
21
|
-
rescue
|
22
|
-
puts <<-EOS
|
23
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
24
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
25
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
26
|
-
EOS
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
end
|
30
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
REV = nil
|
35
|
-
# UNCOMMENT IF REQUIRED:
|
36
|
-
# REV = YAML.load(`svn info`)['Revision']
|
37
|
-
VERS = Imanip::VERSION::STRING + (REV ? ".#{REV}" : "")
|
38
|
-
RDOC_OPTS = ['--quiet', '--title', 'imanip documentation',
|
39
|
-
"--opname", "index.html",
|
40
|
-
"--line-numbers",
|
41
|
-
"--main", "README",
|
42
|
-
"--inline-source"]
|
43
|
-
|
44
|
-
class Hoe
|
45
|
-
def extra_deps
|
46
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
47
|
-
@extra_deps
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Generate all the Rake tasks
|
52
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
53
|
-
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
54
|
-
p.developer(AUTHOR, EMAIL)
|
55
|
-
p.description = DESCRIPTION
|
56
|
-
p.summary = DESCRIPTION
|
57
|
-
p.url = HOMEPATH
|
58
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
59
|
-
p.test_globs = ["test/**/test_*.rb"]
|
60
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
61
|
-
|
62
|
-
# == Optional
|
63
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
|
-
#p.extra_deps = EXTRA_DEPENDENCIES
|
65
|
-
|
66
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
67
|
-
end
|
68
|
-
|
69
|
-
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
71
|
-
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
72
|
-
$hoe.rsync_args = '-av --delete --ignore-errors'
|
73
|
-
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/config/requirements.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/init.rb
DELETED
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|