chunky_png 1.2.8 → 1.2.9
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.
- checksums.yaml +15 -0
- data/Rakefile +8 -1
- data/chunky_png.gemspec +10 -6
- data/lib/chunky_png.rb +1 -4
- data/lib/chunky_png/canvas/operations.rb +2 -3
- data/lib/chunky_png/version.rb +5 -0
- data/spec/chunky_png/dimension_spec.rb +1 -1
- data/spec/chunky_png/point_spec.rb +1 -1
- data/spec/png_suite_spec.rb +0 -4
- metadata +279 -15
- data/tasks/github-gem.rake +0 -367
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzUzNWM2NzJlMTZkMWE4ZTkwZDQ3ZWVmYWViYzg4YjQ0YTEyM2JiNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzljODZlMWYxMWI5ZjQ5ZDVhNmRhMDlmNjRiMDY4OThhOTVmZGZlMw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTU4ZjZhMWQ4NDU0ZTU1MDMwNzdkZDQxMjMwMWQxNWE5NDljNmI5OWQ0NDNi
|
10
|
+
MDA2NmZlODIyY2Q4NjYxYTM1NDAzODQxYmNiMzI2NzU5MzI3ZTIzZTRlMWE2
|
11
|
+
YWNlMDVjYjJiM2QwMzc3YWE5ZDZlMGZkY2Y3OGI1ZDQ0YzFmOTU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YjQyY2RhNzdhMWUyMTY2M2RiMTNiN2MwMzdkY2U2MzAxODA4ZmM3NDI4NTM2
|
14
|
+
ZTM2MDc5ZDA5NmZlNzg5ZDc3YjYyNjdiMDYxMDQ1YjJiY2IxY2JhZTVjOTFi
|
15
|
+
ZjczMWY3MjA4NDhmZThhMTNlMWEzYjNhMTUxYWRiMmU3MWFmNzI=
|
data/Rakefile
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
1
4
|
Dir['tasks/*.rake'].each { |file| load(file) }
|
2
5
|
|
3
|
-
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
+
task.pattern = "./spec/**/*_spec.rb"
|
8
|
+
task.rspec_opts = ['--color']
|
9
|
+
end
|
10
|
+
|
4
11
|
task :default => [:spec]
|
data/chunky_png.gemspec
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'chunky_png/version'
|
6
|
+
|
1
7
|
Gem::Specification.new do |s|
|
2
8
|
s.name = 'chunky_png'
|
3
9
|
|
4
10
|
# Do not change the version and date fields by hand. This will be done
|
5
11
|
# automatically by the gem release script.
|
6
|
-
s.version =
|
7
|
-
s.date = "2013-03-30"
|
12
|
+
s.version = ChunkyPNG::VERSION
|
8
13
|
|
9
14
|
s.summary = "Pure ruby library for read/write, chunk-level access to PNG files"
|
10
15
|
s.description = <<-EOT
|
@@ -29,6 +34,7 @@ Gem::Specification.new do |s|
|
|
29
34
|
s.authors = ['Willem van Bergen']
|
30
35
|
s.email = ['willem@railsdoctors.com']
|
31
36
|
s.homepage = 'http://wiki.github.com/wvanbergen/chunky_png'
|
37
|
+
s.license = 'MIT'
|
32
38
|
|
33
39
|
s.add_development_dependency('rake')
|
34
40
|
s.add_development_dependency('rspec', '~> 2.2')
|
@@ -36,8 +42,6 @@ Gem::Specification.new do |s|
|
|
36
42
|
s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
|
37
43
|
s.extra_rdoc_files = ['README.rdoc', 'BENCHMARKS.rdoc']
|
38
44
|
|
39
|
-
|
40
|
-
|
41
|
-
s.files = %w(.gitignore .travis.yml .yardopts BENCHMARKS.rdoc Gemfile LICENSE README.rdoc Rakefile benchmarks/decoding_benchmark.rb benchmarks/encoding_benchmark.rb benchmarks/filesize_benchmark.rb chunky_png.gemspec lib/chunky_png.rb lib/chunky_png/canvas.rb lib/chunky_png/canvas/adam7_interlacing.rb lib/chunky_png/canvas/data_url_exporting.rb lib/chunky_png/canvas/data_url_importing.rb lib/chunky_png/canvas/drawing.rb lib/chunky_png/canvas/masking.rb lib/chunky_png/canvas/operations.rb lib/chunky_png/canvas/png_decoding.rb lib/chunky_png/canvas/png_encoding.rb lib/chunky_png/canvas/resampling.rb lib/chunky_png/canvas/stream_exporting.rb lib/chunky_png/canvas/stream_importing.rb lib/chunky_png/chunk.rb lib/chunky_png/color.rb lib/chunky_png/compatibility.rb lib/chunky_png/datastream.rb lib/chunky_png/dimension.rb lib/chunky_png/image.rb lib/chunky_png/palette.rb lib/chunky_png/point.rb lib/chunky_png/rmagick.rb lib/chunky_png/vector.rb spec/chunky_png/canvas/adam7_interlacing_spec.rb spec/chunky_png/canvas/data_url_exporting_spec.rb spec/chunky_png/canvas/data_url_importing_spec.rb spec/chunky_png/canvas/drawing_spec.rb spec/chunky_png/canvas/masking_spec.rb spec/chunky_png/canvas/operations_spec.rb spec/chunky_png/canvas/png_decoding_spec.rb spec/chunky_png/canvas/png_encoding_spec.rb spec/chunky_png/canvas/resampling_spec.rb spec/chunky_png/canvas/stream_exporting_spec.rb spec/chunky_png/canvas/stream_importing_spec.rb spec/chunky_png/canvas_spec.rb spec/chunky_png/color_spec.rb spec/chunky_png/datastream_spec.rb spec/chunky_png/dimension_spec.rb spec/chunky_png/image_spec.rb spec/chunky_png/point_spec.rb spec/chunky_png/rmagick_spec.rb spec/chunky_png/vector_spec.rb spec/chunky_png_spec.rb spec/png_suite/background_chunks/bgai4a08.png spec/png_suite/background_chunks/bgai4a16.png spec/png_suite/background_chunks/bgan6a08.png spec/png_suite/background_chunks/bgan6a16.png spec/png_suite/background_chunks/bgbn4a08.png spec/png_suite/background_chunks/bggn4a16.png spec/png_suite/background_chunks/bgwn6a08.png spec/png_suite/background_chunks/bgyn6a16.png spec/png_suite/basic/basi0g01.png spec/png_suite/basic/basi0g01.rgba spec/png_suite/basic/basi0g02.png spec/png_suite/basic/basi0g02.rgba spec/png_suite/basic/basi0g04.png spec/png_suite/basic/basi0g04.rgba spec/png_suite/basic/basi0g08.png spec/png_suite/basic/basi0g08.rgba spec/png_suite/basic/basi0g16.png spec/png_suite/basic/basi0g16.rgba spec/png_suite/basic/basi2c08.png spec/png_suite/basic/basi2c08.rgba spec/png_suite/basic/basi2c16.png spec/png_suite/basic/basi2c16.rgba spec/png_suite/basic/basi3p01.png spec/png_suite/basic/basi3p01.rgba spec/png_suite/basic/basi3p02.png spec/png_suite/basic/basi3p02.rgba spec/png_suite/basic/basi3p04.png spec/png_suite/basic/basi3p04.rgba spec/png_suite/basic/basi3p08.png spec/png_suite/basic/basi3p08.rgba spec/png_suite/basic/basi4a08.png spec/png_suite/basic/basi4a08.rgba spec/png_suite/basic/basi4a16.png spec/png_suite/basic/basi4a16.rgba spec/png_suite/basic/basi6a08.png spec/png_suite/basic/basi6a08.rgba spec/png_suite/basic/basi6a16.png spec/png_suite/basic/basi6a16.rgba spec/png_suite/basic/basn0g01.png spec/png_suite/basic/basn0g01.rgba spec/png_suite/basic/basn0g02.png spec/png_suite/basic/basn0g02.rgba spec/png_suite/basic/basn0g04.png spec/png_suite/basic/basn0g04.rgba spec/png_suite/basic/basn0g08.png spec/png_suite/basic/basn0g08.rgba spec/png_suite/basic/basn0g16.png spec/png_suite/basic/basn0g16.rgba spec/png_suite/basic/basn2c08.png spec/png_suite/basic/basn2c08.rgba spec/png_suite/basic/basn2c16.png spec/png_suite/basic/basn2c16.rgba spec/png_suite/basic/basn3p01.png spec/png_suite/basic/basn3p01.rgba spec/png_suite/basic/basn3p02.png spec/png_suite/basic/basn3p02.rgba spec/png_suite/basic/basn3p04.png spec/png_suite/basic/basn3p04.rgba spec/png_suite/basic/basn3p08.png spec/png_suite/basic/basn3p08.rgba spec/png_suite/basic/basn4a08.png spec/png_suite/basic/basn4a08.rgba spec/png_suite/basic/basn4a16.png spec/png_suite/basic/basn4a16.rgba spec/png_suite/basic/basn6a08.png spec/png_suite/basic/basn6a08.rgba spec/png_suite/basic/basn6a16.png spec/png_suite/basic/basn6a16.rgba spec/png_suite/broken/x00n0g01.png spec/png_suite/broken/xcrn0g04.png spec/png_suite/broken/xlfn0g04.png spec/png_suite/chunk_ordering/oi1n0g16.png spec/png_suite/chunk_ordering/oi1n2c16.png spec/png_suite/chunk_ordering/oi2n0g16.png spec/png_suite/chunk_ordering/oi2n2c16.png spec/png_suite/chunk_ordering/oi4n0g16.png spec/png_suite/chunk_ordering/oi4n2c16.png spec/png_suite/chunk_ordering/oi9n0g16.png spec/png_suite/chunk_ordering/oi9n2c16.png spec/png_suite/compression_levels/z00n2c08.png spec/png_suite/compression_levels/z03n2c08.png spec/png_suite/compression_levels/z06n2c08.png spec/png_suite/compression_levels/z09n2c08.png spec/png_suite/filtering/f00n0g08.png spec/png_suite/filtering/f00n0g08.rgba spec/png_suite/filtering/f00n0g08_reference.png spec/png_suite/filtering/f00n0g08_reference.rgba spec/png_suite/filtering/f00n2c08.png spec/png_suite/filtering/f00n2c08.rgba spec/png_suite/filtering/f00n2c08_reference.png spec/png_suite/filtering/f00n2c08_reference.rgba spec/png_suite/filtering/f01n0g08.png spec/png_suite/filtering/f01n0g08.rgba spec/png_suite/filtering/f01n0g08_reference.png spec/png_suite/filtering/f01n0g08_reference.rgba spec/png_suite/filtering/f01n2c08.png spec/png_suite/filtering/f01n2c08.rgba spec/png_suite/filtering/f01n2c08_reference.png spec/png_suite/filtering/f01n2c08_reference.rgba spec/png_suite/filtering/f02n0g08.png spec/png_suite/filtering/f02n0g08.rgba spec/png_suite/filtering/f02n0g08_reference.png spec/png_suite/filtering/f02n0g08_reference.rgba spec/png_suite/filtering/f02n2c08.png spec/png_suite/filtering/f02n2c08.rgba spec/png_suite/filtering/f02n2c08_reference.png spec/png_suite/filtering/f02n2c08_reference.rgba spec/png_suite/filtering/f03n0g08.png spec/png_suite/filtering/f03n0g08.rgba spec/png_suite/filtering/f03n0g08_reference.png spec/png_suite/filtering/f03n0g08_reference.rgba spec/png_suite/filtering/f03n2c08.png spec/png_suite/filtering/f03n2c08.rgba spec/png_suite/filtering/f03n2c08_reference.png spec/png_suite/filtering/f03n2c08_reference.rgba spec/png_suite/filtering/f04n0g08.png spec/png_suite/filtering/f04n0g08.rgba spec/png_suite/filtering/f04n0g08_reference.png spec/png_suite/filtering/f04n0g08_reference.rgba spec/png_suite/filtering/f04n2c08.png spec/png_suite/filtering/f04n2c08.rgba spec/png_suite/filtering/f04n2c08_reference.png spec/png_suite/filtering/f04n2c08_reference.rgba spec/png_suite/gamma/g03n0g16.png spec/png_suite/gamma/g03n2c08.png spec/png_suite/gamma/g03n3p04.png spec/png_suite/gamma/g04n0g16.png spec/png_suite/gamma/g04n2c08.png spec/png_suite/gamma/g04n3p04.png spec/png_suite/gamma/g05n0g16.png spec/png_suite/gamma/g05n2c08.png spec/png_suite/gamma/g05n3p04.png spec/png_suite/gamma/g07n0g16.png spec/png_suite/gamma/g07n2c08.png spec/png_suite/gamma/g07n3p04.png spec/png_suite/gamma/g10n0g16.png spec/png_suite/gamma/g10n2c08.png spec/png_suite/gamma/g10n3p04.png spec/png_suite/gamma/g25n0g16.png spec/png_suite/gamma/g25n2c08.png spec/png_suite/gamma/g25n3p04.png spec/png_suite/metadata/cm0n0g04.png spec/png_suite/metadata/cm7n0g04.png spec/png_suite/metadata/cm9n0g04.png spec/png_suite/other/ccwn2c08.png spec/png_suite/other/ccwn3p08.png spec/png_suite/other/cdfn2c08.png spec/png_suite/other/cdhn2c08.png spec/png_suite/other/cdsn2c08.png spec/png_suite/other/cdun2c08.png spec/png_suite/other/ch1n3p04.png spec/png_suite/other/ch2n3p08.png spec/png_suite/other/cs3n2c16.png spec/png_suite/other/cs3n3p08.png spec/png_suite/other/cs5n2c08.png spec/png_suite/other/cs5n3p08.png spec/png_suite/other/cs8n2c08.png spec/png_suite/other/cs8n3p08.png spec/png_suite/other/ct0n0g04.png spec/png_suite/other/ct1n0g04.png spec/png_suite/other/ctzn0g04.png spec/png_suite/other/pp0n2c16.png spec/png_suite/other/pp0n6a08.png spec/png_suite/other/ps1n0g08.png spec/png_suite/other/ps1n2c16.png spec/png_suite/other/ps2n0g08.png spec/png_suite/other/ps2n2c16.png spec/png_suite/sizes/s01i3p01.png spec/png_suite/sizes/s01n3p01.png spec/png_suite/sizes/s02i3p01.png spec/png_suite/sizes/s02n3p01.png spec/png_suite/sizes/s03i3p01.png spec/png_suite/sizes/s03n3p01.png spec/png_suite/sizes/s04i3p01.png spec/png_suite/sizes/s04n3p01.png spec/png_suite/sizes/s05i3p02.png spec/png_suite/sizes/s05n3p02.png spec/png_suite/sizes/s06i3p02.png spec/png_suite/sizes/s06n3p02.png spec/png_suite/sizes/s07i3p02.png spec/png_suite/sizes/s07n3p02.png spec/png_suite/sizes/s08i3p02.png spec/png_suite/sizes/s08n3p02.png spec/png_suite/sizes/s09i3p02.png spec/png_suite/sizes/s09n3p02.png spec/png_suite/sizes/s32i3p04.png spec/png_suite/sizes/s32n3p04.png spec/png_suite/sizes/s33i3p04.png spec/png_suite/sizes/s33n3p04.png spec/png_suite/sizes/s34i3p04.png spec/png_suite/sizes/s34n3p04.png spec/png_suite/sizes/s35i3p04.png spec/png_suite/sizes/s35n3p04.png spec/png_suite/sizes/s36i3p04.png spec/png_suite/sizes/s36n3p04.png spec/png_suite/sizes/s37i3p04.png spec/png_suite/sizes/s37n3p04.png spec/png_suite/sizes/s38i3p04.png spec/png_suite/sizes/s38n3p04.png spec/png_suite/sizes/s39i3p04.png spec/png_suite/sizes/s39n3p04.png spec/png_suite/sizes/s40i3p04.png spec/png_suite/sizes/s40n3p04.png spec/png_suite/transparency/tbbn1g04.png spec/png_suite/transparency/tbbn2c16.png spec/png_suite/transparency/tbbn3p08.png spec/png_suite/transparency/tbgn2c16.png spec/png_suite/transparency/tbgn3p08.png spec/png_suite/transparency/tbrn2c08.png spec/png_suite/transparency/tbwn1g16.png spec/png_suite/transparency/tbwn3p08.png spec/png_suite/transparency/tbyn3p08.png spec/png_suite/transparency/tp0n1g08.png spec/png_suite/transparency/tp0n2c08.png spec/png_suite/transparency/tp0n3p08.png spec/png_suite/transparency/tp1n3p08.png spec/png_suite_spec.rb spec/resources/adam7.png spec/resources/bezier_five_point.png spec/resources/bezier_four_point.png spec/resources/bezier_four_point_flipped.png spec/resources/bezier_four_point_s.png spec/resources/bezier_six_point.png spec/resources/bezier_three_point.png spec/resources/bezier_three_point_flipped.png spec/resources/circles.png spec/resources/clock.png spec/resources/clock_base.png spec/resources/clock_bl_xdown_ydown.png spec/resources/clock_bl_xdown_yup.png spec/resources/clock_bl_xup_yup.png spec/resources/clock_mask.png spec/resources/clock_mask_updated.png spec/resources/clock_nn_xdown_ydown.png spec/resources/clock_nn_xdown_yup.png spec/resources/clock_nn_xup_yup.png spec/resources/clock_updated.png spec/resources/composited.png spec/resources/cropped.png spec/resources/damaged_chunk.png spec/resources/damaged_signature.png spec/resources/lines.png spec/resources/operations.png spec/resources/operations_grayscale.png spec/resources/partial_circles.png spec/resources/pixelstream.rgb spec/resources/pixelstream.rgba spec/resources/pixelstream_best_compression.png spec/resources/pixelstream_fast_rgba.png spec/resources/pixelstream_reference.png spec/resources/polygon_filled_horizontal.png spec/resources/polygon_filled_vertical.png spec/resources/polygon_triangle_filled.png spec/resources/polygon_unfilled.png spec/resources/rect.png spec/resources/replaced.png spec/resources/text_chunk.png spec/resources/ztxt_chunk.png spec/spec_helper.rb tasks/benchmarks.rake tasks/github-gem.rake)
|
42
|
-
s.test_files = %w(spec/chunky_png/canvas/adam7_interlacing_spec.rb spec/chunky_png/canvas/data_url_exporting_spec.rb spec/chunky_png/canvas/data_url_importing_spec.rb spec/chunky_png/canvas/drawing_spec.rb spec/chunky_png/canvas/masking_spec.rb spec/chunky_png/canvas/operations_spec.rb spec/chunky_png/canvas/png_decoding_spec.rb spec/chunky_png/canvas/png_encoding_spec.rb spec/chunky_png/canvas/resampling_spec.rb spec/chunky_png/canvas/stream_exporting_spec.rb spec/chunky_png/canvas/stream_importing_spec.rb spec/chunky_png/canvas_spec.rb spec/chunky_png/color_spec.rb spec/chunky_png/datastream_spec.rb spec/chunky_png/dimension_spec.rb spec/chunky_png/image_spec.rb spec/chunky_png/point_spec.rb spec/chunky_png/rmagick_spec.rb spec/chunky_png/vector_spec.rb spec/chunky_png_spec.rb spec/png_suite_spec.rb)
|
45
|
+
s.files = `git ls-files`.split($/)
|
46
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
43
47
|
end
|
data/lib/chunky_png.rb
CHANGED
@@ -23,10 +23,6 @@ require 'enumerator'
|
|
23
23
|
# @author Willem van Bergen
|
24
24
|
module ChunkyPNG
|
25
25
|
|
26
|
-
# The current version of ChunkyPNG. This value will be updated
|
27
|
-
# automatically by them <tt>gem:release</tt> rake task.
|
28
|
-
VERSION = "1.2.8"
|
29
|
-
|
30
26
|
###################################################
|
31
27
|
# PNG international standard defined constants
|
32
28
|
###################################################
|
@@ -141,6 +137,7 @@ module ChunkyPNG
|
|
141
137
|
EXTRA_BYTE = force_binary("\0").freeze
|
142
138
|
end
|
143
139
|
|
140
|
+
require 'chunky_png/version'
|
144
141
|
|
145
142
|
# Ruby 1.8 / 1.9 compatibility
|
146
143
|
require 'chunky_png/compatibility'
|
@@ -153,9 +153,8 @@ module ChunkyPNG
|
|
153
153
|
# @raise [ChunkyPNG::OutOfBounds] when the crop dimensions plus the given coordinates
|
154
154
|
# are bigger then the original image.
|
155
155
|
def crop!(x, y, crop_width, crop_height)
|
156
|
-
|
157
|
-
raise ChunkyPNG::OutOfBounds, "
|
158
|
-
raise ChunkyPNG::OutOfBounds, "Image width is too small!" if crop_height + y > height
|
156
|
+
raise ChunkyPNG::OutOfBounds, "Original image width is too small!" if crop_width + x > width
|
157
|
+
raise ChunkyPNG::OutOfBounds, "Original image height is too small!" if crop_height + y > height
|
159
158
|
|
160
159
|
new_pixels = []
|
161
160
|
for cy in 0...crop_height do
|
@@ -37,7 +37,7 @@ describe 'ChunkyPNG.Dimension' do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should create a dimension from an object that responds to width and height" do
|
40
|
-
mock_object =
|
40
|
+
mock_object = Struct.new(:width, :height).new(1, 2)
|
41
41
|
ChunkyPNG::Dimension(mock_object).should == subject
|
42
42
|
end
|
43
43
|
|
@@ -65,7 +65,7 @@ describe 'ChunkyPNG.Point' do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should create a point from an object that responds to x and y" do
|
68
|
-
mock_object =
|
68
|
+
mock_object = Struct.new(:x, :y).new(1, 2)
|
69
69
|
ChunkyPNG::Point(mock_object).should == subject
|
70
70
|
end
|
71
71
|
|
data/spec/png_suite_spec.rb
CHANGED
@@ -7,10 +7,6 @@ describe 'PNG testuite' do
|
|
7
7
|
it "should report #{File.basename(file)} as broken" do
|
8
8
|
lambda { ChunkyPNG::Image.from_file(file) }.should raise_error(ChunkyPNG::Exception)
|
9
9
|
end
|
10
|
-
|
11
|
-
it "should not report #{File.basename(file)} as unsupported" do
|
12
|
-
lambda { ChunkyPNG::Image.from_file(file) }.should_not raise_error(ChunkyPNG::NotSupported)
|
13
|
-
end
|
14
10
|
end
|
15
11
|
end
|
16
12
|
|
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chunky_png
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.9
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Willem van Bergen
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rspec
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '2.2'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.2'
|
36
41
|
description: ! " This pure Ruby library can read and write PNG images without depending
|
37
42
|
on an external \n image library, like RMagick. It tries to be memory efficient
|
38
43
|
and reasonably fast.\n \n It supports reading and writing all PNG variants
|
@@ -89,6 +94,7 @@ files:
|
|
89
94
|
- lib/chunky_png/point.rb
|
90
95
|
- lib/chunky_png/rmagick.rb
|
91
96
|
- lib/chunky_png/vector.rb
|
97
|
+
- lib/chunky_png/version.rb
|
92
98
|
- spec/chunky_png/canvas/adam7_interlacing_spec.rb
|
93
99
|
- spec/chunky_png/canvas/data_url_exporting_spec.rb
|
94
100
|
- spec/chunky_png/canvas/data_url_importing_spec.rb
|
@@ -369,9 +375,10 @@ files:
|
|
369
375
|
- spec/resources/ztxt_chunk.png
|
370
376
|
- spec/spec_helper.rb
|
371
377
|
- tasks/benchmarks.rake
|
372
|
-
- tasks/github-gem.rake
|
373
378
|
homepage: http://wiki.github.com/wvanbergen/chunky_png
|
374
|
-
licenses:
|
379
|
+
licenses:
|
380
|
+
- MIT
|
381
|
+
metadata: {}
|
375
382
|
post_install_message:
|
376
383
|
rdoc_options:
|
377
384
|
- --title
|
@@ -383,22 +390,20 @@ rdoc_options:
|
|
383
390
|
require_paths:
|
384
391
|
- lib
|
385
392
|
required_ruby_version: !ruby/object:Gem::Requirement
|
386
|
-
none: false
|
387
393
|
requirements:
|
388
394
|
- - ! '>='
|
389
395
|
- !ruby/object:Gem::Version
|
390
396
|
version: '0'
|
391
397
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
392
|
-
none: false
|
393
398
|
requirements:
|
394
399
|
- - ! '>='
|
395
400
|
- !ruby/object:Gem::Version
|
396
401
|
version: '0'
|
397
402
|
requirements: []
|
398
403
|
rubyforge_project:
|
399
|
-
rubygems_version:
|
404
|
+
rubygems_version: 2.0.7
|
400
405
|
signing_key:
|
401
|
-
specification_version:
|
406
|
+
specification_version: 4
|
402
407
|
summary: Pure ruby library for read/write, chunk-level access to PNG files
|
403
408
|
test_files:
|
404
409
|
- spec/chunky_png/canvas/adam7_interlacing_spec.rb
|
@@ -421,4 +426,263 @@ test_files:
|
|
421
426
|
- spec/chunky_png/rmagick_spec.rb
|
422
427
|
- spec/chunky_png/vector_spec.rb
|
423
428
|
- spec/chunky_png_spec.rb
|
429
|
+
- spec/png_suite/background_chunks/bgai4a08.png
|
430
|
+
- spec/png_suite/background_chunks/bgai4a16.png
|
431
|
+
- spec/png_suite/background_chunks/bgan6a08.png
|
432
|
+
- spec/png_suite/background_chunks/bgan6a16.png
|
433
|
+
- spec/png_suite/background_chunks/bgbn4a08.png
|
434
|
+
- spec/png_suite/background_chunks/bggn4a16.png
|
435
|
+
- spec/png_suite/background_chunks/bgwn6a08.png
|
436
|
+
- spec/png_suite/background_chunks/bgyn6a16.png
|
437
|
+
- spec/png_suite/basic/basi0g01.png
|
438
|
+
- spec/png_suite/basic/basi0g01.rgba
|
439
|
+
- spec/png_suite/basic/basi0g02.png
|
440
|
+
- spec/png_suite/basic/basi0g02.rgba
|
441
|
+
- spec/png_suite/basic/basi0g04.png
|
442
|
+
- spec/png_suite/basic/basi0g04.rgba
|
443
|
+
- spec/png_suite/basic/basi0g08.png
|
444
|
+
- spec/png_suite/basic/basi0g08.rgba
|
445
|
+
- spec/png_suite/basic/basi0g16.png
|
446
|
+
- spec/png_suite/basic/basi0g16.rgba
|
447
|
+
- spec/png_suite/basic/basi2c08.png
|
448
|
+
- spec/png_suite/basic/basi2c08.rgba
|
449
|
+
- spec/png_suite/basic/basi2c16.png
|
450
|
+
- spec/png_suite/basic/basi2c16.rgba
|
451
|
+
- spec/png_suite/basic/basi3p01.png
|
452
|
+
- spec/png_suite/basic/basi3p01.rgba
|
453
|
+
- spec/png_suite/basic/basi3p02.png
|
454
|
+
- spec/png_suite/basic/basi3p02.rgba
|
455
|
+
- spec/png_suite/basic/basi3p04.png
|
456
|
+
- spec/png_suite/basic/basi3p04.rgba
|
457
|
+
- spec/png_suite/basic/basi3p08.png
|
458
|
+
- spec/png_suite/basic/basi3p08.rgba
|
459
|
+
- spec/png_suite/basic/basi4a08.png
|
460
|
+
- spec/png_suite/basic/basi4a08.rgba
|
461
|
+
- spec/png_suite/basic/basi4a16.png
|
462
|
+
- spec/png_suite/basic/basi4a16.rgba
|
463
|
+
- spec/png_suite/basic/basi6a08.png
|
464
|
+
- spec/png_suite/basic/basi6a08.rgba
|
465
|
+
- spec/png_suite/basic/basi6a16.png
|
466
|
+
- spec/png_suite/basic/basi6a16.rgba
|
467
|
+
- spec/png_suite/basic/basn0g01.png
|
468
|
+
- spec/png_suite/basic/basn0g01.rgba
|
469
|
+
- spec/png_suite/basic/basn0g02.png
|
470
|
+
- spec/png_suite/basic/basn0g02.rgba
|
471
|
+
- spec/png_suite/basic/basn0g04.png
|
472
|
+
- spec/png_suite/basic/basn0g04.rgba
|
473
|
+
- spec/png_suite/basic/basn0g08.png
|
474
|
+
- spec/png_suite/basic/basn0g08.rgba
|
475
|
+
- spec/png_suite/basic/basn0g16.png
|
476
|
+
- spec/png_suite/basic/basn0g16.rgba
|
477
|
+
- spec/png_suite/basic/basn2c08.png
|
478
|
+
- spec/png_suite/basic/basn2c08.rgba
|
479
|
+
- spec/png_suite/basic/basn2c16.png
|
480
|
+
- spec/png_suite/basic/basn2c16.rgba
|
481
|
+
- spec/png_suite/basic/basn3p01.png
|
482
|
+
- spec/png_suite/basic/basn3p01.rgba
|
483
|
+
- spec/png_suite/basic/basn3p02.png
|
484
|
+
- spec/png_suite/basic/basn3p02.rgba
|
485
|
+
- spec/png_suite/basic/basn3p04.png
|
486
|
+
- spec/png_suite/basic/basn3p04.rgba
|
487
|
+
- spec/png_suite/basic/basn3p08.png
|
488
|
+
- spec/png_suite/basic/basn3p08.rgba
|
489
|
+
- spec/png_suite/basic/basn4a08.png
|
490
|
+
- spec/png_suite/basic/basn4a08.rgba
|
491
|
+
- spec/png_suite/basic/basn4a16.png
|
492
|
+
- spec/png_suite/basic/basn4a16.rgba
|
493
|
+
- spec/png_suite/basic/basn6a08.png
|
494
|
+
- spec/png_suite/basic/basn6a08.rgba
|
495
|
+
- spec/png_suite/basic/basn6a16.png
|
496
|
+
- spec/png_suite/basic/basn6a16.rgba
|
497
|
+
- spec/png_suite/broken/x00n0g01.png
|
498
|
+
- spec/png_suite/broken/xcrn0g04.png
|
499
|
+
- spec/png_suite/broken/xlfn0g04.png
|
500
|
+
- spec/png_suite/chunk_ordering/oi1n0g16.png
|
501
|
+
- spec/png_suite/chunk_ordering/oi1n2c16.png
|
502
|
+
- spec/png_suite/chunk_ordering/oi2n0g16.png
|
503
|
+
- spec/png_suite/chunk_ordering/oi2n2c16.png
|
504
|
+
- spec/png_suite/chunk_ordering/oi4n0g16.png
|
505
|
+
- spec/png_suite/chunk_ordering/oi4n2c16.png
|
506
|
+
- spec/png_suite/chunk_ordering/oi9n0g16.png
|
507
|
+
- spec/png_suite/chunk_ordering/oi9n2c16.png
|
508
|
+
- spec/png_suite/compression_levels/z00n2c08.png
|
509
|
+
- spec/png_suite/compression_levels/z03n2c08.png
|
510
|
+
- spec/png_suite/compression_levels/z06n2c08.png
|
511
|
+
- spec/png_suite/compression_levels/z09n2c08.png
|
512
|
+
- spec/png_suite/filtering/f00n0g08.png
|
513
|
+
- spec/png_suite/filtering/f00n0g08.rgba
|
514
|
+
- spec/png_suite/filtering/f00n0g08_reference.png
|
515
|
+
- spec/png_suite/filtering/f00n0g08_reference.rgba
|
516
|
+
- spec/png_suite/filtering/f00n2c08.png
|
517
|
+
- spec/png_suite/filtering/f00n2c08.rgba
|
518
|
+
- spec/png_suite/filtering/f00n2c08_reference.png
|
519
|
+
- spec/png_suite/filtering/f00n2c08_reference.rgba
|
520
|
+
- spec/png_suite/filtering/f01n0g08.png
|
521
|
+
- spec/png_suite/filtering/f01n0g08.rgba
|
522
|
+
- spec/png_suite/filtering/f01n0g08_reference.png
|
523
|
+
- spec/png_suite/filtering/f01n0g08_reference.rgba
|
524
|
+
- spec/png_suite/filtering/f01n2c08.png
|
525
|
+
- spec/png_suite/filtering/f01n2c08.rgba
|
526
|
+
- spec/png_suite/filtering/f01n2c08_reference.png
|
527
|
+
- spec/png_suite/filtering/f01n2c08_reference.rgba
|
528
|
+
- spec/png_suite/filtering/f02n0g08.png
|
529
|
+
- spec/png_suite/filtering/f02n0g08.rgba
|
530
|
+
- spec/png_suite/filtering/f02n0g08_reference.png
|
531
|
+
- spec/png_suite/filtering/f02n0g08_reference.rgba
|
532
|
+
- spec/png_suite/filtering/f02n2c08.png
|
533
|
+
- spec/png_suite/filtering/f02n2c08.rgba
|
534
|
+
- spec/png_suite/filtering/f02n2c08_reference.png
|
535
|
+
- spec/png_suite/filtering/f02n2c08_reference.rgba
|
536
|
+
- spec/png_suite/filtering/f03n0g08.png
|
537
|
+
- spec/png_suite/filtering/f03n0g08.rgba
|
538
|
+
- spec/png_suite/filtering/f03n0g08_reference.png
|
539
|
+
- spec/png_suite/filtering/f03n0g08_reference.rgba
|
540
|
+
- spec/png_suite/filtering/f03n2c08.png
|
541
|
+
- spec/png_suite/filtering/f03n2c08.rgba
|
542
|
+
- spec/png_suite/filtering/f03n2c08_reference.png
|
543
|
+
- spec/png_suite/filtering/f03n2c08_reference.rgba
|
544
|
+
- spec/png_suite/filtering/f04n0g08.png
|
545
|
+
- spec/png_suite/filtering/f04n0g08.rgba
|
546
|
+
- spec/png_suite/filtering/f04n0g08_reference.png
|
547
|
+
- spec/png_suite/filtering/f04n0g08_reference.rgba
|
548
|
+
- spec/png_suite/filtering/f04n2c08.png
|
549
|
+
- spec/png_suite/filtering/f04n2c08.rgba
|
550
|
+
- spec/png_suite/filtering/f04n2c08_reference.png
|
551
|
+
- spec/png_suite/filtering/f04n2c08_reference.rgba
|
552
|
+
- spec/png_suite/gamma/g03n0g16.png
|
553
|
+
- spec/png_suite/gamma/g03n2c08.png
|
554
|
+
- spec/png_suite/gamma/g03n3p04.png
|
555
|
+
- spec/png_suite/gamma/g04n0g16.png
|
556
|
+
- spec/png_suite/gamma/g04n2c08.png
|
557
|
+
- spec/png_suite/gamma/g04n3p04.png
|
558
|
+
- spec/png_suite/gamma/g05n0g16.png
|
559
|
+
- spec/png_suite/gamma/g05n2c08.png
|
560
|
+
- spec/png_suite/gamma/g05n3p04.png
|
561
|
+
- spec/png_suite/gamma/g07n0g16.png
|
562
|
+
- spec/png_suite/gamma/g07n2c08.png
|
563
|
+
- spec/png_suite/gamma/g07n3p04.png
|
564
|
+
- spec/png_suite/gamma/g10n0g16.png
|
565
|
+
- spec/png_suite/gamma/g10n2c08.png
|
566
|
+
- spec/png_suite/gamma/g10n3p04.png
|
567
|
+
- spec/png_suite/gamma/g25n0g16.png
|
568
|
+
- spec/png_suite/gamma/g25n2c08.png
|
569
|
+
- spec/png_suite/gamma/g25n3p04.png
|
570
|
+
- spec/png_suite/metadata/cm0n0g04.png
|
571
|
+
- spec/png_suite/metadata/cm7n0g04.png
|
572
|
+
- spec/png_suite/metadata/cm9n0g04.png
|
573
|
+
- spec/png_suite/other/ccwn2c08.png
|
574
|
+
- spec/png_suite/other/ccwn3p08.png
|
575
|
+
- spec/png_suite/other/cdfn2c08.png
|
576
|
+
- spec/png_suite/other/cdhn2c08.png
|
577
|
+
- spec/png_suite/other/cdsn2c08.png
|
578
|
+
- spec/png_suite/other/cdun2c08.png
|
579
|
+
- spec/png_suite/other/ch1n3p04.png
|
580
|
+
- spec/png_suite/other/ch2n3p08.png
|
581
|
+
- spec/png_suite/other/cs3n2c16.png
|
582
|
+
- spec/png_suite/other/cs3n3p08.png
|
583
|
+
- spec/png_suite/other/cs5n2c08.png
|
584
|
+
- spec/png_suite/other/cs5n3p08.png
|
585
|
+
- spec/png_suite/other/cs8n2c08.png
|
586
|
+
- spec/png_suite/other/cs8n3p08.png
|
587
|
+
- spec/png_suite/other/ct0n0g04.png
|
588
|
+
- spec/png_suite/other/ct1n0g04.png
|
589
|
+
- spec/png_suite/other/ctzn0g04.png
|
590
|
+
- spec/png_suite/other/pp0n2c16.png
|
591
|
+
- spec/png_suite/other/pp0n6a08.png
|
592
|
+
- spec/png_suite/other/ps1n0g08.png
|
593
|
+
- spec/png_suite/other/ps1n2c16.png
|
594
|
+
- spec/png_suite/other/ps2n0g08.png
|
595
|
+
- spec/png_suite/other/ps2n2c16.png
|
596
|
+
- spec/png_suite/sizes/s01i3p01.png
|
597
|
+
- spec/png_suite/sizes/s01n3p01.png
|
598
|
+
- spec/png_suite/sizes/s02i3p01.png
|
599
|
+
- spec/png_suite/sizes/s02n3p01.png
|
600
|
+
- spec/png_suite/sizes/s03i3p01.png
|
601
|
+
- spec/png_suite/sizes/s03n3p01.png
|
602
|
+
- spec/png_suite/sizes/s04i3p01.png
|
603
|
+
- spec/png_suite/sizes/s04n3p01.png
|
604
|
+
- spec/png_suite/sizes/s05i3p02.png
|
605
|
+
- spec/png_suite/sizes/s05n3p02.png
|
606
|
+
- spec/png_suite/sizes/s06i3p02.png
|
607
|
+
- spec/png_suite/sizes/s06n3p02.png
|
608
|
+
- spec/png_suite/sizes/s07i3p02.png
|
609
|
+
- spec/png_suite/sizes/s07n3p02.png
|
610
|
+
- spec/png_suite/sizes/s08i3p02.png
|
611
|
+
- spec/png_suite/sizes/s08n3p02.png
|
612
|
+
- spec/png_suite/sizes/s09i3p02.png
|
613
|
+
- spec/png_suite/sizes/s09n3p02.png
|
614
|
+
- spec/png_suite/sizes/s32i3p04.png
|
615
|
+
- spec/png_suite/sizes/s32n3p04.png
|
616
|
+
- spec/png_suite/sizes/s33i3p04.png
|
617
|
+
- spec/png_suite/sizes/s33n3p04.png
|
618
|
+
- spec/png_suite/sizes/s34i3p04.png
|
619
|
+
- spec/png_suite/sizes/s34n3p04.png
|
620
|
+
- spec/png_suite/sizes/s35i3p04.png
|
621
|
+
- spec/png_suite/sizes/s35n3p04.png
|
622
|
+
- spec/png_suite/sizes/s36i3p04.png
|
623
|
+
- spec/png_suite/sizes/s36n3p04.png
|
624
|
+
- spec/png_suite/sizes/s37i3p04.png
|
625
|
+
- spec/png_suite/sizes/s37n3p04.png
|
626
|
+
- spec/png_suite/sizes/s38i3p04.png
|
627
|
+
- spec/png_suite/sizes/s38n3p04.png
|
628
|
+
- spec/png_suite/sizes/s39i3p04.png
|
629
|
+
- spec/png_suite/sizes/s39n3p04.png
|
630
|
+
- spec/png_suite/sizes/s40i3p04.png
|
631
|
+
- spec/png_suite/sizes/s40n3p04.png
|
632
|
+
- spec/png_suite/transparency/tbbn1g04.png
|
633
|
+
- spec/png_suite/transparency/tbbn2c16.png
|
634
|
+
- spec/png_suite/transparency/tbbn3p08.png
|
635
|
+
- spec/png_suite/transparency/tbgn2c16.png
|
636
|
+
- spec/png_suite/transparency/tbgn3p08.png
|
637
|
+
- spec/png_suite/transparency/tbrn2c08.png
|
638
|
+
- spec/png_suite/transparency/tbwn1g16.png
|
639
|
+
- spec/png_suite/transparency/tbwn3p08.png
|
640
|
+
- spec/png_suite/transparency/tbyn3p08.png
|
641
|
+
- spec/png_suite/transparency/tp0n1g08.png
|
642
|
+
- spec/png_suite/transparency/tp0n2c08.png
|
643
|
+
- spec/png_suite/transparency/tp0n3p08.png
|
644
|
+
- spec/png_suite/transparency/tp1n3p08.png
|
424
645
|
- spec/png_suite_spec.rb
|
646
|
+
- spec/resources/adam7.png
|
647
|
+
- spec/resources/bezier_five_point.png
|
648
|
+
- spec/resources/bezier_four_point.png
|
649
|
+
- spec/resources/bezier_four_point_flipped.png
|
650
|
+
- spec/resources/bezier_four_point_s.png
|
651
|
+
- spec/resources/bezier_six_point.png
|
652
|
+
- spec/resources/bezier_three_point.png
|
653
|
+
- spec/resources/bezier_three_point_flipped.png
|
654
|
+
- spec/resources/circles.png
|
655
|
+
- spec/resources/clock.png
|
656
|
+
- spec/resources/clock_base.png
|
657
|
+
- spec/resources/clock_bl_xdown_ydown.png
|
658
|
+
- spec/resources/clock_bl_xdown_yup.png
|
659
|
+
- spec/resources/clock_bl_xup_yup.png
|
660
|
+
- spec/resources/clock_mask.png
|
661
|
+
- spec/resources/clock_mask_updated.png
|
662
|
+
- spec/resources/clock_nn_xdown_ydown.png
|
663
|
+
- spec/resources/clock_nn_xdown_yup.png
|
664
|
+
- spec/resources/clock_nn_xup_yup.png
|
665
|
+
- spec/resources/clock_updated.png
|
666
|
+
- spec/resources/composited.png
|
667
|
+
- spec/resources/cropped.png
|
668
|
+
- spec/resources/damaged_chunk.png
|
669
|
+
- spec/resources/damaged_signature.png
|
670
|
+
- spec/resources/lines.png
|
671
|
+
- spec/resources/operations.png
|
672
|
+
- spec/resources/operations_grayscale.png
|
673
|
+
- spec/resources/partial_circles.png
|
674
|
+
- spec/resources/pixelstream.rgb
|
675
|
+
- spec/resources/pixelstream.rgba
|
676
|
+
- spec/resources/pixelstream_best_compression.png
|
677
|
+
- spec/resources/pixelstream_fast_rgba.png
|
678
|
+
- spec/resources/pixelstream_reference.png
|
679
|
+
- spec/resources/polygon_filled_horizontal.png
|
680
|
+
- spec/resources/polygon_filled_vertical.png
|
681
|
+
- spec/resources/polygon_triangle_filled.png
|
682
|
+
- spec/resources/polygon_unfilled.png
|
683
|
+
- spec/resources/rect.png
|
684
|
+
- spec/resources/replaced.png
|
685
|
+
- spec/resources/text_chunk.png
|
686
|
+
- spec/resources/ztxt_chunk.png
|
687
|
+
- spec/spec_helper.rb
|
688
|
+
has_rdoc:
|
data/tasks/github-gem.rake
DELETED
@@ -1,367 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/tasklib'
|
4
|
-
require 'date'
|
5
|
-
require 'set'
|
6
|
-
|
7
|
-
module GithubGem
|
8
|
-
|
9
|
-
# Detects the gemspc file of this project using heuristics.
|
10
|
-
def self.detect_gemspec_file
|
11
|
-
FileList['*.gemspec'].first
|
12
|
-
end
|
13
|
-
|
14
|
-
# Detects the main include file of this project using heuristics
|
15
|
-
def self.detect_main_include
|
16
|
-
if File.exist?(File.expand_path("../lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb", detect_gemspec_file))
|
17
|
-
"lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb"
|
18
|
-
elsif FileList['lib/*.rb'].length == 1
|
19
|
-
FileList['lib/*.rb'].first
|
20
|
-
else
|
21
|
-
nil
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class RakeTasks
|
26
|
-
|
27
|
-
include Rake::DSL if Rake.const_defined?('DSL')
|
28
|
-
|
29
|
-
attr_reader :gemspec, :modified_files
|
30
|
-
attr_accessor :gemspec_file, :task_namespace, :main_include, :root_dir, :spec_pattern, :test_pattern, :remote, :remote_branch, :local_branch
|
31
|
-
|
32
|
-
# Initializes the settings, yields itself for configuration
|
33
|
-
# and defines the rake tasks based on the gemspec file.
|
34
|
-
def initialize(task_namespace = :gem)
|
35
|
-
@gemspec_file = GithubGem.detect_gemspec_file
|
36
|
-
@task_namespace = task_namespace
|
37
|
-
@main_include = GithubGem.detect_main_include
|
38
|
-
@modified_files = Set.new
|
39
|
-
@root_dir = Dir.pwd
|
40
|
-
@test_pattern = 'test/**/*_test.rb'
|
41
|
-
@spec_pattern = 'spec/**/*_spec.rb'
|
42
|
-
@local_branch = 'master'
|
43
|
-
@remote = 'origin'
|
44
|
-
@remote_branch = 'master'
|
45
|
-
|
46
|
-
yield(self) if block_given?
|
47
|
-
|
48
|
-
load_gemspec!
|
49
|
-
define_tasks!
|
50
|
-
end
|
51
|
-
|
52
|
-
protected
|
53
|
-
|
54
|
-
def git
|
55
|
-
@git ||= ENV['GIT'] || 'git'
|
56
|
-
end
|
57
|
-
|
58
|
-
# Define Unit test tasks
|
59
|
-
def define_test_tasks!
|
60
|
-
require 'rake/testtask'
|
61
|
-
|
62
|
-
namespace(:test) do
|
63
|
-
Rake::TestTask.new(:basic) do |t|
|
64
|
-
t.pattern = test_pattern
|
65
|
-
t.verbose = true
|
66
|
-
t.libs << 'test'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
desc "Run all unit tests for #{gemspec.name}"
|
71
|
-
task(:test => ['test:basic'])
|
72
|
-
end
|
73
|
-
|
74
|
-
# Defines RSpec tasks
|
75
|
-
def define_rspec_tasks!
|
76
|
-
require 'rspec/core/rake_task'
|
77
|
-
|
78
|
-
namespace(:spec) do
|
79
|
-
desc "Verify all RSpec examples for #{gemspec.name}"
|
80
|
-
RSpec::Core::RakeTask.new(:basic) do |t|
|
81
|
-
t.pattern = spec_pattern
|
82
|
-
end
|
83
|
-
|
84
|
-
desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
|
85
|
-
RSpec::Core::RakeTask.new(:specdoc) do |t|
|
86
|
-
t.pattern = spec_pattern
|
87
|
-
t.rspec_opts = ['--format', 'documentation', '--color']
|
88
|
-
end
|
89
|
-
|
90
|
-
desc "Run RCov on specs for #{gemspec.name}"
|
91
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
92
|
-
t.pattern = spec_pattern
|
93
|
-
t.rcov = true
|
94
|
-
t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
|
99
|
-
task(:spec => ['spec:specdoc'])
|
100
|
-
end
|
101
|
-
|
102
|
-
# Defines the rake tasks
|
103
|
-
def define_tasks!
|
104
|
-
|
105
|
-
define_test_tasks! if has_tests?
|
106
|
-
define_rspec_tasks! if has_specs?
|
107
|
-
|
108
|
-
namespace(@task_namespace) do
|
109
|
-
desc "Updates the filelist in the gemspec file"
|
110
|
-
task(:manifest) { manifest_task }
|
111
|
-
|
112
|
-
desc "Builds the .gem package"
|
113
|
-
task(:build => :manifest) { build_task }
|
114
|
-
|
115
|
-
desc "Sets the version of the gem in the gemspec"
|
116
|
-
task(:set_version => [:check_version, :check_current_branch]) { version_task }
|
117
|
-
task(:check_version => :fetch_origin) { check_version_task }
|
118
|
-
|
119
|
-
task(:fetch_origin) { fetch_origin_task }
|
120
|
-
task(:check_current_branch) { check_current_branch_task }
|
121
|
-
task(:check_clean_status) { check_clean_status_task }
|
122
|
-
task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }
|
123
|
-
|
124
|
-
checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
|
125
|
-
checks.unshift('spec:basic') if has_specs?
|
126
|
-
checks.unshift('test:basic') if has_tests?
|
127
|
-
# checks.push << [:check_rubyforge] if gemspec.rubyforge_project
|
128
|
-
|
129
|
-
desc "Perform all checks that would occur before a release"
|
130
|
-
task(:release_checks => checks)
|
131
|
-
|
132
|
-
release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]
|
133
|
-
# release_tasks << [:rubyforge_release] if gemspec.rubyforge_project
|
134
|
-
|
135
|
-
desc "Release a new version of the gem using the VERSION environment variable"
|
136
|
-
task(:release => release_tasks) { release_task }
|
137
|
-
|
138
|
-
namespace(:release) do
|
139
|
-
desc "Release the next version of the gem, by incrementing the last version segment by 1"
|
140
|
-
task(:next => [:next_version] + release_tasks) { release_task }
|
141
|
-
|
142
|
-
desc "Release the next version of the gem, using a patch increment (0.0.1)"
|
143
|
-
task(:patch => [:next_patch_version] + release_tasks) { release_task }
|
144
|
-
|
145
|
-
desc "Release the next version of the gem, using a minor increment (0.1.0)"
|
146
|
-
task(:minor => [:next_minor_version] + release_tasks) { release_task }
|
147
|
-
|
148
|
-
desc "Release the next version of the gem, using a major increment (1.0.0)"
|
149
|
-
task(:major => [:next_major_version] + release_tasks) { release_task }
|
150
|
-
end
|
151
|
-
|
152
|
-
# task(:check_rubyforge) { check_rubyforge_task }
|
153
|
-
# task(:rubyforge_release) { rubyforge_release_task }
|
154
|
-
task(:gemcutter_release) { gemcutter_release_task }
|
155
|
-
task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }
|
156
|
-
task(:tag_version) { tag_version_task }
|
157
|
-
task(:commit_modified_files) { commit_modified_files_task }
|
158
|
-
|
159
|
-
task(:next_version) { next_version_task }
|
160
|
-
task(:next_patch_version) { next_version_task(:patch) }
|
161
|
-
task(:next_minor_version) { next_version_task(:minor) }
|
162
|
-
task(:next_major_version) { next_version_task(:major) }
|
163
|
-
|
164
|
-
desc "Updates the gem release tasks with the latest version on Github"
|
165
|
-
task(:update_tasks) { update_tasks_task }
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# Updates the files list and test_files list in the gemspec file using the list of files
|
170
|
-
# in the repository and the spec/test file pattern.
|
171
|
-
def manifest_task
|
172
|
-
# Load all the gem's files using "git ls-files"
|
173
|
-
repository_files = `#{git} ls-files`.split("\n")
|
174
|
-
test_files = Dir[test_pattern] + Dir[spec_pattern]
|
175
|
-
|
176
|
-
update_gemspec(:files, repository_files)
|
177
|
-
update_gemspec(:test_files, repository_files & test_files)
|
178
|
-
end
|
179
|
-
|
180
|
-
# Builds the gem
|
181
|
-
def build_task
|
182
|
-
sh "gem build -q #{gemspec_file}"
|
183
|
-
Dir.mkdir('pkg') unless File.exist?('pkg')
|
184
|
-
sh "mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
185
|
-
end
|
186
|
-
|
187
|
-
def newest_version
|
188
|
-
`#{git} tag`.split("\n").map { |tag| tag.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max || Gem::Version.new('0.0.0')
|
189
|
-
end
|
190
|
-
|
191
|
-
def next_version(increment = nil)
|
192
|
-
next_version = newest_version.segments
|
193
|
-
increment_index = case increment
|
194
|
-
when :micro then 3
|
195
|
-
when :patch then 2
|
196
|
-
when :minor then 1
|
197
|
-
when :major then 0
|
198
|
-
else next_version.length - 1
|
199
|
-
end
|
200
|
-
|
201
|
-
next_version[increment_index] ||= 0
|
202
|
-
next_version[increment_index] = next_version[increment_index].succ
|
203
|
-
((increment_index + 1)...next_version.length).each { |i| next_version[i] = 0 }
|
204
|
-
|
205
|
-
Gem::Version.new(next_version.join('.'))
|
206
|
-
end
|
207
|
-
|
208
|
-
def next_version_task(increment = nil)
|
209
|
-
ENV['VERSION'] = next_version(increment).version
|
210
|
-
puts "Releasing version #{ENV['VERSION']}..."
|
211
|
-
end
|
212
|
-
|
213
|
-
# Updates the version number in the gemspec file, the VERSION constant in the main
|
214
|
-
# include file and the contents of the VERSION file.
|
215
|
-
def version_task
|
216
|
-
update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
|
217
|
-
update_gemspec(:date, Date.today)
|
218
|
-
|
219
|
-
update_version_file(gemspec.version)
|
220
|
-
update_version_constant(gemspec.version)
|
221
|
-
end
|
222
|
-
|
223
|
-
def check_version_task
|
224
|
-
raise "#{ENV['VERSION']} is not a valid version number!" if ENV['VERSION'] && !Gem::Version.correct?(ENV['VERSION'])
|
225
|
-
proposed_version = Gem::Version.new((ENV['VERSION'] || gemspec.version).dup)
|
226
|
-
raise "This version (#{proposed_version}) is not higher than the highest tagged version (#{newest_version})" if newest_version >= proposed_version
|
227
|
-
end
|
228
|
-
|
229
|
-
# Checks whether the current branch is not diverged from the remote branch
|
230
|
-
def check_not_diverged_task
|
231
|
-
raise "The current branch is diverged from the remote branch!" if `#{git} rev-list HEAD..#{remote}/#{remote_branch}`.split("\n").any?
|
232
|
-
end
|
233
|
-
|
234
|
-
# Checks whether the repository status ic clean
|
235
|
-
def check_clean_status_task
|
236
|
-
raise "The current working copy contains modifications" if `#{git} ls-files -m`.split("\n").any?
|
237
|
-
end
|
238
|
-
|
239
|
-
# Checks whether the current branch is correct
|
240
|
-
def check_current_branch_task
|
241
|
-
raise "Currently not on #{local_branch} branch!" unless `#{git} branch`.split("\n").detect { |b| /^\* / =~ b } == "* #{local_branch}"
|
242
|
-
end
|
243
|
-
|
244
|
-
# Fetches the latest updates from Github
|
245
|
-
def fetch_origin_task
|
246
|
-
sh git, 'fetch', remote
|
247
|
-
end
|
248
|
-
|
249
|
-
# Commits every file that has been changed by the release task.
|
250
|
-
def commit_modified_files_task
|
251
|
-
really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split("\n")
|
252
|
-
if really_modified.any?
|
253
|
-
really_modified.each { |file| sh git, 'add', file }
|
254
|
-
sh git, 'commit', '-m', "Released #{gemspec.name} gem version #{gemspec.version}."
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
# Adds a tag for the released version
|
259
|
-
def tag_version_task
|
260
|
-
sh git, 'tag', '-a', "#{gemspec.name}-#{gemspec.version}", '-m', "Released #{gemspec.name} gem version #{gemspec.version}."
|
261
|
-
end
|
262
|
-
|
263
|
-
# Pushes the changes and tag to github
|
264
|
-
def github_release_task
|
265
|
-
sh git, 'push', '--tags', remote, remote_branch
|
266
|
-
end
|
267
|
-
|
268
|
-
def gemcutter_release_task
|
269
|
-
sh "gem", 'push', "pkg/#{gemspec.name}-#{gemspec.version}.gem"
|
270
|
-
end
|
271
|
-
|
272
|
-
# Gem release task.
|
273
|
-
# All work is done by the task's dependencies, so just display a release completed message.
|
274
|
-
def release_task
|
275
|
-
puts
|
276
|
-
puts "Release successful."
|
277
|
-
end
|
278
|
-
|
279
|
-
private
|
280
|
-
|
281
|
-
# Checks whether this project has any RSpec files
|
282
|
-
def has_specs?
|
283
|
-
FileList[spec_pattern].any?
|
284
|
-
end
|
285
|
-
|
286
|
-
# Checks whether this project has any unit test files
|
287
|
-
def has_tests?
|
288
|
-
FileList[test_pattern].any?
|
289
|
-
end
|
290
|
-
|
291
|
-
# Loads the gemspec file
|
292
|
-
def load_gemspec!
|
293
|
-
@gemspec = eval(File.read(@gemspec_file))
|
294
|
-
end
|
295
|
-
|
296
|
-
# Updates the VERSION file with the new version
|
297
|
-
def update_version_file(version)
|
298
|
-
if File.exists?('VERSION')
|
299
|
-
File.open('VERSION', 'w') { |f| f << version.to_s }
|
300
|
-
modified_files << 'VERSION'
|
301
|
-
end
|
302
|
-
end
|
303
|
-
|
304
|
-
# Updates the VERSION constant in the main include file if it exists
|
305
|
-
def update_version_constant(version)
|
306
|
-
if main_include && File.exist?(main_include)
|
307
|
-
file_contents = File.read(main_include)
|
308
|
-
if file_contents.sub!(/^(\s+VERSION\s*=\s*)[^\s].*$/) { $1 + version.to_s.inspect }
|
309
|
-
File.open(main_include, 'w') { |f| f << file_contents }
|
310
|
-
modified_files << main_include
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
# Updates an attribute of the gemspec file.
|
316
|
-
# This function will open the file, and search/replace the attribute using a regular expression.
|
317
|
-
def update_gemspec(attribute, new_value, literal = false)
|
318
|
-
|
319
|
-
unless literal
|
320
|
-
new_value = case new_value
|
321
|
-
when Array then "%w(#{new_value.join(' ')})"
|
322
|
-
when Hash, String then new_value.inspect
|
323
|
-
when Date then new_value.strftime('%Y-%m-%d').inspect
|
324
|
-
else raise "Cannot write value #{new_value.inspect} to gemspec file!"
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
spec = File.read(gemspec_file)
|
329
|
-
regexp = Regexp.new('^(\s+\w+\.' + Regexp.quote(attribute.to_s) + '\s*=\s*)[^\s].*$')
|
330
|
-
if spec.sub!(regexp) { $1 + new_value }
|
331
|
-
File.open(gemspec_file, 'w') { |f| f << spec }
|
332
|
-
modified_files << gemspec_file
|
333
|
-
|
334
|
-
# Reload the gemspec so the changes are incorporated
|
335
|
-
load_gemspec!
|
336
|
-
|
337
|
-
# Also mark the Gemfile.lock file as changed because of the new version.
|
338
|
-
modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
|
-
# Updates the tasks file using the latest file found on Github
|
343
|
-
def update_tasks_task
|
344
|
-
require 'net/https'
|
345
|
-
require 'uri'
|
346
|
-
|
347
|
-
uri = URI.parse('https://raw.github.com/wvanbergen/github-gem/master/tasks/github-gem.rake')
|
348
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
349
|
-
http.use_ssl = true
|
350
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
351
|
-
response = http.request(Net::HTTP::Get.new(uri.path))
|
352
|
-
|
353
|
-
if Net::HTTPSuccess === response
|
354
|
-
open(__FILE__, "w") { |file| file.write(response.body) }
|
355
|
-
relative_file = File.expand_path(__FILE__).sub(%r[^#{@root_dir}/], '')
|
356
|
-
if `#{git} ls-files -m #{relative_file}`.split("\n").any?
|
357
|
-
sh git, 'add', relative_file
|
358
|
-
sh git, 'commit', '-m', "Updated to latest gem release management tasks."
|
359
|
-
else
|
360
|
-
puts "Release managament tasks already are at the latest version."
|
361
|
-
end
|
362
|
-
else
|
363
|
-
raise "Download failed with HTTP status #{response.code}!"
|
364
|
-
end
|
365
|
-
end
|
366
|
-
end
|
367
|
-
end
|