rmagick 2.13.3 → 2.13.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rmagick might be problematic. Click here for more details.

Files changed (54) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +21 -0
  3. data/.travis.yml +57 -0
  4. data/CONTRIBUTING.md +22 -0
  5. data/ChangeLog +47 -4
  6. data/Gemfile +7 -0
  7. data/{README.rc → README.textile} +34 -104
  8. data/Rakefile +160 -24
  9. data/before_install_linux.sh +12 -0
  10. data/before_install_osx.sh +2 -0
  11. data/doc/.cvsignore +1 -0
  12. data/doc/ex/images/image_with_profile.jpg +0 -0
  13. data/doc/ex/mask.rb +1 -1
  14. data/examples/identify.rb +1 -1
  15. data/ext/RMagick/extconf.rb +60 -23
  16. data/ext/RMagick/rmagick.c +15 -15
  17. data/ext/RMagick/rmagick.h +9 -7
  18. data/ext/RMagick/rmdraw.c +12 -12
  19. data/ext/RMagick/rmenum.c +2 -2
  20. data/ext/RMagick/rmfill.c +25 -25
  21. data/ext/RMagick/rmilist.c +121 -104
  22. data/ext/RMagick/rmimage.c +737 -546
  23. data/ext/RMagick/rminfo.c +15 -15
  24. data/ext/RMagick/rmmain.c +27 -3
  25. data/ext/RMagick/rmpixel.c +25 -27
  26. data/ext/RMagick/rmstruct.c +1 -1
  27. data/ext/RMagick/rmutil.c +18 -18
  28. data/lib/RMagick.rb +1 -1962
  29. data/lib/rmagick.rb +1 -0
  30. data/lib/rmagick/version.rb +3 -1
  31. data/lib/rmagick_internal.rb +1964 -0
  32. data/rmagick.gemspec +14 -5
  33. data/test/Image2.rb +7 -3
  34. data/test/Image3.rb +54 -23
  35. data/test/ImageList2.rb +1 -1
  36. data/test/Image_attributes.rb +27 -10
  37. data/test/Import_Export.rb +11 -1
  38. data/test/Info.rb +4 -4
  39. data/test/Magick.rb +14 -54
  40. data/test/Pixel.rb +3 -4
  41. data/test/{all_basic.rb → test_all_basic.rb} +9 -17
  42. data/test/tmpnam_test.rb +50 -0
  43. metadata +50 -21
  44. data/README +0 -15
  45. data/README-Mac-OSX.txt +0 -1
  46. data/build_tarball.rake +0 -215
  47. data/lib/rvg/to_c.rb +0 -103
  48. data/metaconfig +0 -7
  49. data/pkg/rmagick-2.13.3.rc1.gem +0 -0
  50. data/post-clean.rb +0 -12
  51. data/post-install.rb +0 -50
  52. data/post-setup.rb +0 -254
  53. data/setup.rb +0 -1585
  54. data/uninstall.rb +0 -76
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- N2ZlZjIzODVkZjk2YzI4NTE2ZjFlNjgzZTA2YTBjZGJiNTlkZDZlMw==
5
- data.tar.gz: !binary |-
6
- MzdiMTk3ODVjYzM3NTc2N2FhNTlmZjhkOWIzMDMyN2EwNzdhZDUwNA==
2
+ SHA1:
3
+ metadata.gz: 508f276e9009e084323676549e393518a5d4bb86
4
+ data.tar.gz: 25255ce344cfe6c13ad3e8c86196af8c4acfc1df
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZDcyZTAyMzUxMTVjOTA1NTdhMzI2ZjRmMWViNDQ3Yjg5Nzk1MzFlZTRiNmM2
10
- OTE3OTRkNDQ4MTc5YmVlNzc1ZDljMzVmYjdjMzA1MjRjOGI0ZmVmMjhkYmJi
11
- YjVlODgwNGQwNjE3NjhhNjY4M2Y5NDFjMTk5NmI0NGZmYzY3MGU=
12
- data.tar.gz: !binary |-
13
- NTI1MjgwZmYyN2FiMDlkZmI0MDlmZmNiM2M1NTA3ODEzNjU1YmQwOTA0ZTNk
14
- MWM4ZWEwMmM5MjEwYmJhZGQyMmU4NTc2NmI2YjRmZDBiNjQ4NmU5YjY5NTU4
15
- YWI5NDc2MTIzN2I4MjQ3NGM1Mjc5NTQzNjVkZmY0OWMyYTc2ZmI=
6
+ metadata.gz: d6c520465ccb71d40bc6930e5c21d857c13f6f5d48d38d9ebce852ed6a7a96db4e840ddf9c959b9692de0d495ba74c122272592cf76de690c02c272273338310
7
+ data.tar.gz: 224f1cc16579906b338ee8e5bd6052b08e736d4b22cb314984abff9600a2dabb13a8f287fa2c9adeada88673ca5a6d51f0b87ac8567a07675e458e577965b1aa
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ *.bundle
18
+ *.so
19
+ *.o
20
+ *.a
21
+ mkmf.log
@@ -0,0 +1,57 @@
1
+ language: ruby
2
+
3
+ os:
4
+ - linux
5
+ #- osx
6
+
7
+ env:
8
+ # Currently successful release
9
+ - IMAGEMAGICK_VERSION=6.6.9-10
10
+ # Ubuntu's current stable release
11
+ - IMAGEMAGICK_VERSION=6.7.7-10
12
+ # Latest 6.7 release
13
+ - IMAGEMAGICK_VERSION=6.7.9-10
14
+ # Latest 6.8 release
15
+ - IMAGEMAGICK_VERSION=6.8.9-6
16
+ # Try with HDRI support, we don't mind if this fails currently.
17
+ - IMAGEMAGICK_VERSION=6.8.9-6 CONFIGURE_OPTIONS=--enable-hdri
18
+
19
+ before_install:
20
+ - source before_install_$TRAVIS_OS_NAME.sh
21
+
22
+ rvm:
23
+ - 1.9
24
+ - 2.0
25
+ - 2.1
26
+
27
+ matrix:
28
+ exclude:
29
+ # - rvm: 1.9
30
+ # env: IMAGEMAGICK_VERSION=6.7.7-10
31
+ - rvm: 1.9
32
+ env: IMAGEMAGICK_VERSION=6.7.9-10
33
+ # - rvm: 1.9
34
+ # env: IMAGEMAGICK_VERSION=6.8.9-6
35
+ - rvm: 1.9
36
+ env: IMAGEMAGICK_VERSION=6.8.9-6 CONFIGURE_OPTIONS=--enable-hdri
37
+ - rvm: 2.0
38
+ env: IMAGEMAGICK_VERSION=6.7.7-10
39
+ - rvm: 2.0
40
+ env: IMAGEMAGICK_VERSION=6.7.9-10
41
+ - rvm: 2.0
42
+ env: IMAGEMAGICK_VERSION=6.8.9-6
43
+ - rvm: 2.0
44
+ env: IMAGEMAGICK_VERSION=6.8.9-6 CONFIGURE_OPTIONS=--enable-hdri
45
+ allow_failures:
46
+ - env: IMAGEMAGICK_VERSION=6.7.7-10
47
+ - env: IMAGEMAGICK_VERSION=6.7.9-10
48
+ #- env: IMAGEMAGICK_VERSION=6.8.9-6
49
+ - env: IMAGEMAGICK_VERSION=6.8.9-6 CONFIGURE_OPTIONS=--enable-hdri
50
+
51
+ notifications:
52
+ webhooks:
53
+ urls:
54
+ - https://webhooks.gitter.im/e/a98c1112f5d60f97a532
55
+ on_success: change # options: [always|never|change] default: always
56
+ on_failure: always # options: [always|never|change] default: always
57
+ on_start: false # default: false
@@ -0,0 +1,22 @@
1
+ RMagick Contributor's Guide
2
+ ===========================
3
+
4
+ Welcome
5
+ -------
6
+
7
+ Thank you for considering contributing to RMagick. Your contribution is always welcome!
8
+
9
+
10
+ Background
11
+ ----------
12
+
13
+ RMagick is a Ruby gem with a C extension. The extension wraps the ImageMagick C library. Therefore, the following document may be helpful to you:
14
+
15
+ [Running C in Ruby](http://silverhammermba.github.io/emberb/extend/)
16
+
17
+
18
+ Priorities
19
+ ----------
20
+
21
+ 9. Green build of the gem on all operating systems. You can see the current build state on [the project page at Travis CI](https://travis-ci.org/gemhome/rmagick). You are welcome to improve it.
22
+ 9. [Open issues](https://github.com/gemhome/rmagick/issues). You are welcome to reproduce them, report current state, suggest solutions, open pull requests with fixes.
data/ChangeLog CHANGED
@@ -1,7 +1,50 @@
1
+ HEAD
2
+ RMagick 2.13.4
3
+ #129 from @theschoolmaster
4
+ proof of concept for using pkg-config in place of Magick-config on debian based systems
5
+
6
+ #127 from @u338steven
7
+ Changed Image#resample to calling ResampleImage (related #29, #45)
8
+
9
+ #124 from @u338steven
10
+ Fixed #122: lib/RMagick.rb is overwritten by lib/rmagick.rb on case-insensitive systems
11
+
12
+ #123 from @prijutme4ty
13
+ New class SolidFill in order to fill image with monochromatic background
14
+
15
+ #121 from @markotom
16
+ Quotes for correct path of font file
17
+
18
+ #120 from @chulkilee
19
+ Allow MagickCore6 from Magick-config
20
+
21
+ #112 from @u338steven/
22
+ Fixed: build error with ImageMagick 6.8.9 (when deprecated functions are excluded)
23
+
24
+ #102 from @u338steven
25
+ Fixed: related x_resolution, y_resolution
26
+
27
+ from @u338steven
28
+ Lots of test fixes
29
+
30
+ #95 from @ioquatix
31
+ Fix pixel hash test
32
+
33
+ #94 from @u338steven
34
+ Fixed: build error on Windows Ruby x64 (with ImageMagick 6.8.0-10 or Ima...
35
+
36
+ #91 from @vassilevsky
37
+ Do not test machine and OS-specific integers
38
+ Fix initial memory limit test
39
+
40
+ RMagick 2.13.3
41
+ #90 from @bricef
42
+ Fix installation error on systems with HRDI enabled RMagick
43
+
1
44
  RMagick 2.13.2
2
45
  o Fixed issues preventing RMagick from working with version 6.8 or higher
3
- o Fixed issues preventing RMagick from working with ruby 1.9.3
4
-
46
+ o Fixed issues preventing RMagick from working with ruby 1.9.3
47
+
5
48
  RMagick 2.13.1
6
49
  o Fixed bug preventing RMagick from working with version 6.5.9 or higher
7
50
 
@@ -9,10 +52,10 @@ RMagick 2.13.0
9
52
  o Added Doxygen documentation, for automatic documentation
10
53
  o Fixed bug #27467, get RMagick to compile witH ImageMagick 6.5.7
11
54
  o Fixed bug #27607, switch Pixel#from_hsla and Pixel#to_hsla to use ranges
12
- 0-255 instead of 0-100 for saturation and lightness (range used by
55
+ 0-255 instead of 0-100 for saturation and lightness (range used by
13
56
  ImageMagick 6.5.6-5 and higher). Also added ability to specify all
14
57
  arguments to these functions as percentages (bug report by Arthur Chan).
15
-
58
+
16
59
 
17
60
  RMagick 2.12.2
18
61
  o Add feature tests for SinusoidFunction and PolynomialFunction enum
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rmagick.gemspec
4
+ gemspec
5
+
6
+ # Used by README.textile
7
+ # gem "RedCloth"
@@ -1,21 +1,22 @@
1
- h1. RMagick 0.0.0$ README
1
+ h1. RMagick
2
2
 
3
- h2. YY/MM/DD
3
+ !https://img.shields.io/gem/v/rmagick.svg?style=flat(RubyGems)!:http://rubygems.org/gems/rmagick !https://img.shields.io/gem/dt/rmagick.svg?style=flat! !https://www.versioneye.com/ruby/rmagick/reference_badge.svg?style=flat(VersionEye)!:https://www.versioneye.com/ruby/rmagick/references !https://img.shields.io/travis/gemhome/rmagick.svg?style=flat(Travis CI)!:https://travis-ci.org/gemhome/rmagick !https://img.shields.io/codeclimate/github/gemhome/rmagick.svg?style=flat(Code Climate)!:https://codeclimate.com/github/gemhome/rmagick !https://badges.gitter.im/Join%20Chat.svg(Gitter)!:https://gitter.im/gemhome/rmagick?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
4
+
5
+ This is the official fork of RMagick. The decision to create a fork "originated here":https://github.com/rmagick/rmagick/issues/18#issuecomment-50022523, where you can read more about why it happened.
4
6
 
5
7
  h3. Table of Contents
6
8
 
7
9
  * "Introduction":#intro
8
10
  * "Prerequisites":#prereq
9
11
  * "Installing RMagick":#install
10
- * "Configuration Options":#config
11
12
  * "Things that can go wrong":#wrong
12
13
  * "Upgrading":#upgrade
13
- * "Uninstalling":#uninstall
14
14
  * "More samples":#samples
15
15
  * "Reporting Bugs":#bugs
16
16
  * "Contact Information":#contact
17
17
  * "Credits":#credits
18
18
  * "License":#license
19
+ * "Releasing":#releasing
19
20
 
20
21
  h2(#intro). Introduction
21
22
 
@@ -26,88 +27,38 @@ h2(#prereq). Prerequisites
26
27
 
27
28
  *O/S* Linux, *BSD, OS X, Windows 2000, XP, Vista, other *nix-like systems.
28
29
 
29
- *Ruby* Version 1.8.2 or later. You can get Ruby from "www.ruby-lang.org":http://www.ruby-lang.org.
30
- The use of versions of Ruby older than 1.8.4 with RMagick is deprecated. Support will be
31
- removed in a future release.
32
-
33
- *ImageMagick* Version 6.3.0 or later. You can get ImageMagick from "www.imagemagick.org":http://www.imagemagick.org.
34
-
35
- h2(#install). Installing RMagick
36
-
37
- First install ImageMagick. Complete and up-to-date instructions for installing
38
- ImageMagick on Linux, *BSD, and other *nix-type O/S's are available
39
- "here":http://rmagick.rubyforge.org/install-linux.html. Use steps 0, 1, and 2.
40
- Similarly, instructions for installing ImageMagick using MacPorts on OS X
41
- are available "here":http://rmagick.rubyforge.org/install-osx.html. Use steps
42
- 1 and 2.
30
+ *Ruby* Version 1.8.5 or later. You can get Ruby from "www.ruby-lang.org":http://www.ruby-lang.org.
43
31
 
44
- This release of RMagick uses Minero Aoki's setup.rb script for installation.
45
- See the next section for configuration options. Usually you do not need to
46
- specify any of these options. You can get more information about setup.rb from
47
- his "web site":<http://i.loveruby.net.
32
+ Ruby must be able to build C-Extensions (e.g. MRI, Rubinius, not JRuby)
48
33
 
49
- I assume you've already decompressed the tarball, or you wouldn't be reading
50
- this. If you have not decompressed the tarball, do so with one of these commands,
51
- depending on which tarball you have:
34
+ *ImageMagick* Version 6.4.9 or later. You can get ImageMagick from "www.imagemagick.org":http://www.imagemagick.org.
52
35
 
53
- <pre>
54
- tar xvzf RMagick-0.0.0$-tar.gz (gzipped tarball)
55
- tar xvjf RMagick-0.0.0$-tar.bz2 (bzipped tarball)
56
- 7z e RMagick-x.y.z.tar.lzma -so | tar xv (7zipped tarball)
57
- </pre>
58
-
59
- Change to the RMagick-0.0.0 directory. If you are not using any
60
- configuration options (usually you don't need to) enter the command
61
-
62
- <pre>
63
- ruby setup.rb
64
- </pre>
36
+ h2(#install). Installing RMagick
65
37
 
66
- Note that setup.rb executes all the example programs, so this can take
67
- some time. This process both builds the example images used in the
68
- documentation and validates your RMagick installation.
38
+ h4. Installing via Bundler
69
39
 
70
- After this command completes, make sure you have root privileges (that
71
- is, login as root or use su or sudo) and enter the command
40
+ Add to your `Gemfile`:
72
41
 
73
- <pre>
74
- ruby setup.rb install
75
- </pre>
42
+ bc. gem 'rmagick'
76
43
 
77
- h2(#config). Configuration options
44
+ Then run:
78
45
 
79
- Type @ruby setup.rb --help@ to see a list of configuration options. In
80
- addition to the regular options, there are a few RMagick-specific options:
46
+ bc. bundle install
81
47
 
82
- h4. --doc-dir=directory
48
+ h4. Installing via RubyGems
83
49
 
84
- Specify the directory to install the RMagick documentation.
85
- By default this is $prefix/share/RMagick, where $prefix is the
86
- prefix specified by --prefix. For example, to install the
87
- documentation in /Users/me/RMagick, specify:
50
+ Run:
88
51
 
89
- <pre>
90
- ruby setup.rb --doc-dir=/Users/me/RMagick
91
- </pre>
92
-
93
- h4. --allow-example-errors
52
+ bc. gem install rmagick
94
53
 
95
- Normally the documentation installation terminates if 5 examples fail.
96
- If you use this option, the installation does not check for failing
97
- examples and will always complete. This option is useful if you're
98
- having trouble installing RMagick and you want to see all the failing examples.
54
+ Require RMagick in your project as follows:
99
55
 
100
- h4. -- disable-htmldoc
101
-
102
- By default the install process runs all the RMagick example programs and
103
- generates HTML versions of all the examples. This option causes the
104
- install process to skip this step. No install verification will take
105
- place and no documentation will be installed.
56
+ bc. require 'rmagick'
106
57
 
107
58
  h2(#wrong). Things that can go wrong
108
59
 
109
- The "RMagick installation FAQ":http://rmagick.rubyforge.org/install-faq.html
110
- has answers to the most commonly reported problems.
60
+ The "RMagick installation FAQ":https://web.archive.org/web/20140512193354/http://rmagick.rubyforge.org/install-faq.html
61
+ has answers to the most commonly reported problems, though may be out of date.
111
62
 
112
63
  h4. Can't install RMagick. Can't find libMagick or one of the dependent libraries. Check the mkmf.log file for more detailed information.
113
64
 
@@ -115,7 +66,7 @@ Typically this message means that one or more of the libraries that ImageMagick
115
66
  depends on hasn't been installed. Examine the mkmf.log file in the ext/RMagick
116
67
  subdirectory of the installation directory for any error messages. These messages
117
68
  typically contain enough additional information for you to be able to diagnose
118
- the problem. Also see "this FAQ":http://rmagick.rubyforge.org/install-faq.html#libmagick.
69
+ the problem. Also see "this FAQ":https://web.archive.org/web/20140512193354/http://rmagick.rubyforge.org/install-faq.html#libmagick.
119
70
 
120
71
  h4. Cannot open shared object file
121
72
 
@@ -141,22 +92,6 @@ LD_LIBRARY_PATH variable like this:
141
92
  On Linux, see @ld(1)@ and @ld.so(8)@ for more information. On other operating
142
93
  systems, see the documentation for the dynamic loading facility.
143
94
 
144
- h4. No such file or directory - "/tmp/rmagick6872.6"
145
-
146
- When setup.rb is running the examples, if you get a message like this:
147
-
148
- <pre>
149
- hook /home/me/src/RMagick-0.0.0/./post-setup.rb failed:
150
- No such file or directory - "/tmp/rmagick6872.6"
151
- </pre>
152
-
153
- you probably do not have a temporary directory environment variable set. Set
154
- the TMPDIR environment variable to your temporary directory. For example:
155
-
156
- <pre>
157
- export TMPDIR=/home/me/tmp
158
- </pre>
159
-
160
95
 
161
96
  h2(#upgrade). Upgrading
162
97
 
@@ -164,15 +99,6 @@ If you upgrade to a newer release of ImageMagick, make sure you're using a
164
99
  release of RMagick that supports that release. It's safe to install a new
165
100
  release of RMagick over an earlier release.
166
101
 
167
- h2(#uninstall). Uninstalling
168
-
169
- The uninstall.rb script will uninstall RMagick completely. Make sure you
170
- have administrator priviledges. Then run this command:
171
-
172
- <pre>
173
- ruby uninstall.rb
174
- </pre>
175
-
176
102
  h2(#samples). More samples
177
103
 
178
104
  You can find more sample RMagick programs in the /example directory.
@@ -181,7 +107,8 @@ These programs are not installed in the RMagick documentation tree.
181
107
  h2(#bugs). Reporting bugs
182
108
 
183
109
  Please report bugs in RMagick, its documentation, or its installation
184
- programs to me via the bug tracker on the "RMagick project page":http://rubyforge.org/projects/rmagick.
110
+ programs to me via the bug tracker on the "RMagick issues page":https://github.com/gemhome
111
+
185
112
  However, I can't help with Ruby installation and configuration or ImageMagick
186
113
  installation and configuration. Information about reporting problems and
187
114
  getting help for ImageMagick is available at the "ImageMagick web site":http://www.imagemagick.org
@@ -191,16 +118,12 @@ h2(#contact). Contact Information
191
118
 
192
119
  *Author:* Tim Hunter, Omer Bar-or, Benjamin Thomas
193
120
 
194
- *Email:* "rmagick@rubyforge.org":mailto:rmagick@rubyforge.org
195
-
196
- *Web site:* "http://rmagick.rubyforge.org":http://rmagick.rubyforge.org
197
-
198
121
  h2(#credits). Credits
199
122
 
200
123
  Thanks to "ImageMagick Studio LLC":http://www.imagemagick.org for ImageMagick
201
124
  and for hosting the RMagick documentation.
202
125
 
203
- h2(#license). License
126
+ h2(#license). MIT License
204
127
 
205
128
  <pre>
206
129
  Copyright &copy; 2002-2009 by Timothy P. Hunter
@@ -227,5 +150,12 @@ DEALINGS IN THE SOFTWARE.
227
150
  </pre>
228
151
 
229
152
  <hr>
230
- This file is marked up using "Textile":http://hobix.com/textile/ and converted
231
- to HTML with "RedCloth":http://whytheluckystiff.net/ruby/redcloth/.
153
+
154
+ h2(#releasing). Releasing
155
+
156
+ See https://github.com/rmagick/rmagick/wiki/Release-Process
157
+
158
+ # Update ChangeLog
159
+ # Edit lib/rmagick/version.rb
160
+ # Are the tests passing? Run `rake` again just to be sure.
161
+ # `rake release`
data/Rakefile CHANGED
@@ -1,40 +1,176 @@
1
- # note, there are other, legacy tasks in build_tarball.rake
2
- # thate currently are run by e.g.
3
- # rake -f build_tarball.rake clean release=RMagick_2-13-1
4
- # rake -f build_tarball.rake release=RMagick_2-13-1
5
1
  require './lib/rmagick/version'
6
2
  require 'fileutils'
7
- desc "build and push gem, tag and push repo"
8
- task "release" do
3
+ task :config do
4
+ def version
5
+ Magick::VERSION
6
+ end
7
+ # e.g. 2.13.3 becomes RMagick_2-13-3
8
+ def version_tag
9
+ "RMagick_#{version.gsub(".","-")}"
10
+ end
11
+ # e.g. 2.13.3 becomes rmagick-2.13.3.gem
12
+ def gem_name
13
+ "rmagick-#{version}.gem"
14
+ end
15
+ def base
16
+ File.expand_path('..', __FILE__)
17
+ end
18
+ end
19
+
20
+ desc "abort when repo nto clean or has uncommited code"
21
+ task :assert_clean_repo do
9
22
  sh("git diff --exit-code")
10
23
  abort "Git repo not clean" unless $?.success?
11
24
  sh("git diff-index --quiet --cached HEAD")
12
25
  abort "Git repo not commited" unless $?.success?
13
- version = Magick::VERSION
14
- # e.g. 2.13.3 becomes RMagick_2-13-3
15
- version_tag = "RMagick_#{version.gsub(".","-")}"
16
- # e.g. 2.13.3 becomes rmagick-2.13.3.gem
17
- gem_name = "rmagick-#{version}.gem"
26
+ end
18
27
 
19
- # build gem
28
+ desc "build gem"
29
+ task :build => [:config] do
20
30
  sh "gem build -V rmagick.gemspec"
21
31
  if $?.success?
22
- base = File.expand_path('..', __FILE__)
23
32
  FileUtils.mkdir_p(File.join(base, 'pkg'))
24
33
  FileUtils.mv(File.join(base, gem_name), 'pkg')
25
- # push gem
26
- sh "gem push #{File.join(base, 'pkg', gem_name)}"
27
- if $?.success?
28
- sh "git tag -a -m \"Version #{version}\" #{version_tag}"
29
- STDOUT.puts "Tagged #{version_tag}."
30
- sh "git push"
31
- sh "git push --tags"
32
- else
33
- abort "tagging abd pushing gem failed"
34
- end
35
-
36
34
  else
37
35
  STDERR.puts "Could not build gem"
38
36
  exit $?.exitstatus
39
37
  end
40
38
  end
39
+
40
+ task :push_and_tag => [:build] do
41
+ sh "gem push #{File.join(base, 'pkg', gem_name)}"
42
+ if $?.success?
43
+ sh "git tag -a -m \"Version #{version}\" #{version_tag}"
44
+ STDOUT.puts "Tagged #{version_tag}."
45
+ sh "git push"
46
+ sh "git push --tags"
47
+ else
48
+ abort "tagging aborted pushing gem failed"
49
+ end
50
+ end
51
+
52
+ desc "Release"
53
+ task :release => [:assert_clean_repo, :push_and_tag]
54
+
55
+ desc "Release and build the legacy way"
56
+ task :legacy_release=> ["legacy:README.html", "legacy:extconf", "legacy:doc", "legacy:manifest", "release"]
57
+
58
+ namespace :legacy do
59
+ require 'find'
60
+
61
+ task :redcloth do
62
+ require 'redcloth'
63
+ end
64
+
65
+ README = "README.html"
66
+ MANIFEST = "ext/RMagick/MANIFEST"
67
+
68
+ # Change the version number placeholders in a file.
69
+ # Returns an array of lines from the file.
70
+ def reversion(name)
71
+ now = Time.new
72
+ now = now.strftime("%m/%d/%y")
73
+
74
+ lines = File.readlines name
75
+ lines.each do |line|
76
+ line.gsub!(%r{0\.0\.0}, Magick::VERSION)
77
+ line.gsub!(%r{YY/MM/DD}, now)
78
+ end
79
+ lines
80
+ end
81
+
82
+ # Rewrite a file containing embedded version number placeholders.
83
+ def reversion_file(name)
84
+ lines = reversion(name)
85
+ tmp_name = name + "_tmp"
86
+ mv name, tmp_name
87
+ begin
88
+ File.open(name, "w") { |f| lines.each { |line| f.write line } }
89
+ rescue
90
+ mv tmp_name, name
91
+ ensure
92
+ rm tmp_name
93
+ end
94
+ end
95
+
96
+ desc "Update version in extconf"
97
+ task :extconf do
98
+ reversion_file "ext/RMagick/extconf.rb"
99
+ end
100
+
101
+ desc "Build README.txt from README.textile using RedCloth"
102
+ task "README.txt" => [:redcloth] do
103
+ reversion_file "README.textile"
104
+ body = File.readlines "README.textile"
105
+ body = RedCloth.new(body.join).to_html + "\n"
106
+ File.open("README.txt", "w") { |f| f.write body }
107
+ end
108
+
109
+ desc "Build README.html from README.txt"
110
+ task README => "README.txt" do
111
+ puts "writing #{README}"
112
+ File.open(README, "w") do |html|
113
+ html.write <<END_HTML_HEAD
114
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
115
+ <html>
116
+ <head>
117
+ <title>RMagick #{Magick::VERSION} README</title>
118
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
119
+ <meta name="GENERATOR" content="RedCloth">
120
+ </head>
121
+ <body>
122
+ END_HTML_HEAD
123
+ html.write File.readlines("README.txt")
124
+ html.write <<END_HTML_TAIL
125
+ </body>
126
+ </html>
127
+ END_HTML_TAIL
128
+ end
129
+ end
130
+
131
+ desc "Update versions in html files"
132
+ task :doc do
133
+ Dir.chdir("doc") do
134
+ FileList["*.html"].each { |d| reversion_file(d) }
135
+ end
136
+ end
137
+
138
+ # Remove files we don't want in the tarball.
139
+ # Ensure files are not executable. (ref: bug #10080)
140
+ desc "Remove files we don't want in the .gem; ensure files are not executable"
141
+ task :fix_files do
142
+ rm "README.txt", :verbose => true
143
+ chmod 0644, FileList["doc/*.html", "doc/ex/*.rb", "doc/ex/images/*", "examples/*.rb"]
144
+ end
145
+
146
+ desc "Build manifest"
147
+ task :manifest do
148
+ now = Time.new
149
+ now = now.strftime("%H:%M:%S %m/%d/%y")
150
+ puts "generating #{MANIFEST}"
151
+
152
+ File.open(MANIFEST, "w") do |f|
153
+ f.puts "MANIFEST for #{Magick::VERSION} - #{now}\n\n"
154
+ Find.find('.') do |name|
155
+ next if File.directory? name
156
+ f.puts name[2..-1] # remove leading "./"
157
+ end
158
+ end
159
+ end
160
+
161
+ end
162
+
163
+ require 'rake/extensiontask'
164
+ require 'rake/testtask'
165
+
166
+ Rake::ExtensionTask.new('RMagick2') do |ext|
167
+ ext.ext_dir = 'ext/RMagick'
168
+ end
169
+
170
+ Rake::TestTask.new(:test) do |t|
171
+ t.libs << 'test'
172
+ end
173
+
174
+ task :test => :compile
175
+
176
+ task :default => :test