zpng 0.2.3 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d2b6418f5582a71d006e8b8181884884eef0d2287bded6771b6dda3abf1da3cc
4
+ data.tar.gz: dc6e8aa63943cbc3f505d0b8635a61c9f0c4da1fb9abd2dc655f1c3869ef7ada
5
+ SHA512:
6
+ metadata.gz: 3a9063b7a4864fb7f172c17124a3aa24653a86768ba6c2c69d1daf7b3b14d646bacc199f8705dd2ca1238ad8e3397a93b86c03c11dbcd9ca525396327564c39e
7
+ data.tar.gz: 335c9e814b351dc42fc46ff7dbaf1ab808f16155722a9cfc0832242778d9b47efcd4c106393105e9ccd005f665d584c75032d47508435bff68013e8e3570c676
data/Gemfile CHANGED
@@ -7,8 +7,9 @@ gem 'rainbow'
7
7
  # Add dependencies to develop your gem here.
8
8
  # Include everything needed to run rake, tests, features, etc.
9
9
  group :development do
10
- gem "rspec", ">= 2.8.0"
11
- gem "bundler", ">= 1.0.0"
12
- gem "jeweler", "~> 1.8.4"
10
+ gem "rspec", "~> 3.9.0"
11
+ gem "rspec-its", "~> 1.3.0"
12
+ gem "bundler", "~> 2.2.3"
13
+ gem "jeweler", "~> 2.3.9"
13
14
  gem "what_methods"
14
15
  end
data/Gemfile.lock CHANGED
@@ -1,34 +1,87 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.1.3)
5
- git (1.2.5)
6
- jeweler (1.8.4)
7
- bundler (~> 1.0)
4
+ addressable (2.4.0)
5
+ builder (3.2.4)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ diff-lcs (1.4.4)
9
+ faraday (0.9.2)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.8.1)
12
+ rchardet (~> 1.8)
13
+ github_api (0.16.0)
14
+ addressable (~> 2.4.0)
15
+ descendants_tracker (~> 0.0.4)
16
+ faraday (~> 0.8, < 0.10)
17
+ hashie (>= 3.4)
18
+ mime-types (>= 1.16, < 3.0)
19
+ oauth2 (~> 1.0)
20
+ hashie (4.1.0)
21
+ highline (2.0.3)
22
+ jeweler (2.3.9)
23
+ builder
24
+ bundler
8
25
  git (>= 1.2.5)
26
+ github_api (~> 0.16.0)
27
+ highline (>= 1.6.15)
28
+ nokogiri (>= 1.5.10)
29
+ psych
9
30
  rake
10
31
  rdoc
11
- json (1.7.5)
12
- rainbow (1.1.4)
13
- rake (10.0.3)
14
- rdoc (3.12)
15
- json (~> 1.4)
16
- rspec (2.12.0)
17
- rspec-core (~> 2.12.0)
18
- rspec-expectations (~> 2.12.0)
19
- rspec-mocks (~> 2.12.0)
20
- rspec-core (2.12.1)
21
- rspec-expectations (2.12.0)
22
- diff-lcs (~> 1.1.3)
23
- rspec-mocks (2.12.0)
32
+ semver2
33
+ jwt (2.2.2)
34
+ mime-types (2.99.3)
35
+ mini_portile2 (2.5.0)
36
+ multi_json (1.15.0)
37
+ multi_xml (0.6.0)
38
+ multipart-post (2.1.1)
39
+ nokogiri (1.11.1)
40
+ mini_portile2 (~> 2.5.0)
41
+ racc (~> 1.4)
42
+ oauth2 (1.4.4)
43
+ faraday (>= 0.8, < 2.0)
44
+ jwt (>= 1.0, < 3.0)
45
+ multi_json (~> 1.3)
46
+ multi_xml (~> 0.5)
47
+ rack (>= 1.2, < 3)
48
+ psych (3.3.0)
49
+ racc (1.5.2)
50
+ rack (2.2.3)
51
+ rainbow (3.0.0)
52
+ rake (13.0.3)
53
+ rchardet (1.8.0)
54
+ rdoc (6.3.0)
55
+ rspec (3.9.0)
56
+ rspec-core (~> 3.9.0)
57
+ rspec-expectations (~> 3.9.0)
58
+ rspec-mocks (~> 3.9.0)
59
+ rspec-core (3.9.3)
60
+ rspec-support (~> 3.9.3)
61
+ rspec-expectations (3.9.4)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.9.0)
64
+ rspec-its (1.3.0)
65
+ rspec-core (>= 3.0.0)
66
+ rspec-expectations (>= 3.0.0)
67
+ rspec-mocks (3.9.1)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.9.0)
70
+ rspec-support (3.9.4)
71
+ semver2 (3.4.2)
72
+ thread_safe (0.3.6)
24
73
  what_methods (1.0.1)
25
74
 
26
75
  PLATFORMS
27
76
  ruby
28
77
 
29
78
  DEPENDENCIES
30
- bundler (>= 1.0.0)
31
- jeweler (~> 1.8.4)
79
+ bundler (~> 2.2.3)
80
+ jeweler (~> 2.3.9)
32
81
  rainbow
33
- rspec (>= 2.8.0)
82
+ rspec (~> 3.9.0)
83
+ rspec-its (~> 1.3.0)
34
84
  what_methods
85
+
86
+ BUNDLED WITH
87
+ 2.2.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.2
data/lib/zpng/cli.rb CHANGED
@@ -56,6 +56,10 @@ module ZPNG
56
56
  opts.on "-A", '--ascii', 'Try to convert image to ASCII (works best with monochrome images)' do
57
57
  @actions << :ascii
58
58
  end
59
+ opts.on '--ascii-string STRING', 'Use specific string to map pixels to ASCII characters' do |x|
60
+ @options[:ascii_string] = x
61
+ @actions << :ascii
62
+ end
59
63
  opts.on "-N", '--ansi', 'Try to display image as ANSI colored text' do
60
64
  @actions << :ansi
61
65
  end
@@ -216,7 +220,7 @@ module ZPNG
216
220
  def ascii
217
221
  @img.height.times do |y|
218
222
  @img.width.times do |x|
219
- c = @img[x,y].to_ascii
223
+ c = @img[x,y].to_ascii *[@options[:ascii_string]].compact
220
224
  c *= 2 if @options[:wide]
221
225
  print c
222
226
  end
@@ -1,4 +1,4 @@
1
- require 'rainbow'
1
+ require 'rainbow/ext/string'
2
2
 
3
3
  class String
4
4
  [:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white].each do |color|
@@ -2,13 +2,19 @@ module ZPNG
2
2
  class TextChunk < Chunk
3
3
  attr_accessor :keyword, :text
4
4
 
5
+ if RUBY_VERSION > "2.4"
6
+ INTEGER_CLASS = Integer
7
+ else
8
+ INTEGER_CLASS = Fixnum
9
+ end
10
+
5
11
  def inspect verbosity = 10
6
12
  vars = %w'keyword text language translated_keyword cmethod cflag'
7
13
  vars -= %w'text translated_keyword' if verbosity <=0
8
14
  super.sub(/ *>$/,'') + ", " +
9
15
  vars.map do |var|
10
16
  t = instance_variable_get("@#{var}")
11
- unless t.is_a?(Fixnum)
17
+ unless t.is_a?(INTEGER_CLASS)
12
18
  t = t.to_s
13
19
  t = t[0..20] + "..." if t.size > 20
14
20
  end
data/spec/adam7_spec.rb CHANGED
@@ -13,7 +13,8 @@ describe ZPNG::Adam7Decoder do
13
13
  }.each do |dims, slw|
14
14
  it "should be right for #{dims} image" do
15
15
  w,h = dims.split('x').map(&:to_i)
16
- img = stub(:width => w, :height => h)
16
+ img = Object.new
17
+ allow(img).to receive_messages(:width => w, :height => h)
17
18
  adam7 = ZPNG::Adam7Decoder.new(img)
18
19
  slw.size.times.map{ |i| adam7.scanline_width(i) }.should == slw
19
20
  end
@@ -33,7 +34,8 @@ describe ZPNG::Adam7Decoder do
33
34
  }.each do |dims, n|
34
35
  it "should be right for #{dims} image" do
35
36
  w,h = dims.split('x').map(&:to_i)
36
- img = stub(:width => w, :height => h)
37
+ img = Object.new
38
+ allow(img).to receive_messages(:width => w, :height => h)
37
39
  adam7 = ZPNG::Adam7Decoder.new(img)
38
40
  adam7.scanlines_count.should == n
39
41
  end
@@ -52,7 +54,8 @@ describe ZPNG::Adam7Decoder do
52
54
  }.each do |dims, pst|
53
55
  it "should be right for #{dims} image" do
54
56
  w,h = dims.split('x').map(&:to_i)
55
- img = stub(:width => w, :height => h)
57
+ img = Object.new
58
+ allow(img).to receive_messages(:width => w, :height => h)
56
59
  adam7 = ZPNG::Adam7Decoder.new(img)
57
60
  adam7.instance_variable_get("@pass_starts").should == pst
58
61
  end
@@ -33,7 +33,7 @@ describe Image do
33
33
 
34
34
  describe "new( :bpp => 16, :color => true )" do
35
35
  subject{ lambda{ _new_img(16,true) } }
36
- it { should raise_exception }
36
+ it { should raise_exception(RuntimeError) }
37
37
  end
38
38
 
39
39
  describe "new( :bpp => 24, :color => false )" do
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require 'rspec'
4
+ require 'rspec/its'
4
5
  require 'zpng'
5
6
 
6
7
  # Requires supporting files with custom matchers and macros, etc,
@@ -33,6 +34,7 @@ end
33
34
  PNGSuite.init( File.join(SAMPLES_DIR, "png_suite") )
34
35
 
35
36
  RSpec.configure do |config|
37
+ config.expect_with(:rspec) { |c| c.syntax = :should }
36
38
  config.before :suite do
37
39
  end
38
40
  end
@@ -16,12 +16,13 @@ module PNGSuite
16
16
  end
17
17
  require 'open-uri'
18
18
  puts "[.] fetching PNG test-suite from #{PNG_SUITE_URL} .. "
19
- data = open(PNG_SUITE_URL).read
19
+ data = URI.open(PNG_SUITE_URL).read
20
20
 
21
21
  fname = File.join(dir, "png_suite.tgz")
22
- File.open(fname, "wb"){ |f| f<<data }
22
+ File.binwrite fname, data
23
23
  puts "[.] unpacking .. "
24
- system "tar", "xzf", fname, "-C", dir
24
+ system "tar", "xf", fname, "-C", dir
25
+ raise "cannot unpack #{fname}" unless $?.success?
25
26
  end
26
27
 
27
28
  def each *prefixes
data/zpng.gemspec CHANGED
@@ -2,16 +2,18 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: zpng 0.3.2 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
- s.name = "zpng"
8
- s.version = "0.2.3"
8
+ s.name = "zpng".freeze
9
+ s.version = "0.3.2"
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Andrey \"Zed\" Zaikin"]
12
- s.date = "2013-01-24"
13
- s.email = "zed.0xff@gmail.com"
14
- s.executables = ["zpng"]
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Andrey \"Zed\" Zaikin".freeze]
14
+ s.date = "2021-02-18"
15
+ s.email = "zed.0xff@gmail.com".freeze
16
+ s.executables = ["zpng".freeze]
15
17
  s.extra_rdoc_files = [
16
18
  "LICENSE.txt",
17
19
  "README.md",
@@ -90,34 +92,29 @@ Gem::Specification.new do |s|
90
92
  "spec/support/png_suite.rb",
91
93
  "zpng.gemspec"
92
94
  ]
93
- s.homepage = "http://github.com/zed-0xff/zpng"
94
- s.licenses = ["MIT"]
95
- s.require_paths = ["lib"]
96
- s.rubygems_version = "1.8.24"
97
- s.summary = "pure ruby PNG file manipulation & validation"
95
+ s.homepage = "http://github.com/zed-0xff/zpng".freeze
96
+ s.licenses = ["MIT".freeze]
97
+ s.rubygems_version = "3.2.3".freeze
98
+ s.summary = "pure ruby PNG file manipulation & validation".freeze
98
99
 
99
100
  if s.respond_to? :specification_version then
100
- s.specification_version = 3
101
+ s.specification_version = 4
102
+ end
101
103
 
102
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
103
- s.add_runtime_dependency(%q<rainbow>, [">= 0"])
104
- s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
105
- s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
106
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
107
- s.add_development_dependency(%q<what_methods>, [">= 0"])
108
- else
109
- s.add_dependency(%q<rainbow>, [">= 0"])
110
- s.add_dependency(%q<rspec>, [">= 2.8.0"])
111
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
112
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
113
- s.add_dependency(%q<what_methods>, [">= 0"])
114
- end
104
+ if s.respond_to? :add_runtime_dependency then
105
+ s.add_runtime_dependency(%q<rainbow>.freeze, [">= 0"])
106
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.9.0"])
107
+ s.add_development_dependency(%q<rspec-its>.freeze, ["~> 1.3.0"])
108
+ s.add_development_dependency(%q<bundler>.freeze, ["~> 2.2.3"])
109
+ s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.3.9"])
110
+ s.add_development_dependency(%q<what_methods>.freeze, [">= 0"])
115
111
  else
116
- s.add_dependency(%q<rainbow>, [">= 0"])
117
- s.add_dependency(%q<rspec>, [">= 2.8.0"])
118
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
119
- s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
120
- s.add_dependency(%q<what_methods>, [">= 0"])
112
+ s.add_dependency(%q<rainbow>.freeze, [">= 0"])
113
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.9.0"])
114
+ s.add_dependency(%q<rspec-its>.freeze, ["~> 1.3.0"])
115
+ s.add_dependency(%q<bundler>.freeze, ["~> 2.2.3"])
116
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.3.9"])
117
+ s.add_dependency(%q<what_methods>.freeze, [">= 0"])
121
118
  end
122
119
  end
123
120
 
metadata CHANGED
@@ -1,97 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zpng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.3.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Andrey "Zed" Zaikin
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-24 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rainbow
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 2.8.0
33
+ version: 3.9.0
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: 2.8.0
40
+ version: 3.9.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-its
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.3.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.0
46
55
  - !ruby/object:Gem::Dependency
47
56
  name: bundler
48
57
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
58
  requirements:
51
- - - ! '>='
59
+ - - "~>"
52
60
  - !ruby/object:Gem::Version
53
- version: 1.0.0
61
+ version: 2.2.3
54
62
  type: :development
55
63
  prerelease: false
56
64
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
65
  requirements:
59
- - - ! '>='
66
+ - - "~>"
60
67
  - !ruby/object:Gem::Version
61
- version: 1.0.0
68
+ version: 2.2.3
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: jeweler
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
- - - ~>
73
+ - - "~>"
68
74
  - !ruby/object:Gem::Version
69
- version: 1.8.4
75
+ version: 2.3.9
70
76
  type: :development
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
- - - ~>
80
+ - - "~>"
76
81
  - !ruby/object:Gem::Version
77
- version: 1.8.4
82
+ version: 2.3.9
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: what_methods
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
- - - ! '>='
87
+ - - ">="
84
88
  - !ruby/object:Gem::Version
85
89
  version: '0'
86
90
  type: :development
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
- - - ! '>='
94
+ - - ">="
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
- description:
97
+ description:
95
98
  email: zed.0xff@gmail.com
96
99
  executables:
97
100
  - zpng
@@ -102,8 +105,8 @@ extra_rdoc_files:
102
105
  - README.md.tpl
103
106
  - TODO
104
107
  files:
105
- - .document
106
- - .rspec
108
+ - ".document"
109
+ - ".rspec"
107
110
  - Gemfile
108
111
  - Gemfile.lock
109
112
  - LICENSE.txt
@@ -175,29 +178,24 @@ files:
175
178
  homepage: http://github.com/zed-0xff/zpng
176
179
  licenses:
177
180
  - MIT
178
- post_install_message:
181
+ metadata: {}
182
+ post_install_message:
179
183
  rdoc_options: []
180
184
  require_paths:
181
185
  - lib
182
186
  required_ruby_version: !ruby/object:Gem::Requirement
183
- none: false
184
187
  requirements:
185
- - - ! '>='
188
+ - - ">="
186
189
  - !ruby/object:Gem::Version
187
190
  version: '0'
188
- segments:
189
- - 0
190
- hash: 377147211466559287
191
191
  required_rubygems_version: !ruby/object:Gem::Requirement
192
- none: false
193
192
  requirements:
194
- - - ! '>='
193
+ - - ">="
195
194
  - !ruby/object:Gem::Version
196
195
  version: '0'
197
196
  requirements: []
198
- rubyforge_project:
199
- rubygems_version: 1.8.24
200
- signing_key:
201
- specification_version: 3
197
+ rubygems_version: 3.2.3
198
+ signing_key:
199
+ specification_version: 4
202
200
  summary: pure ruby PNG file manipulation & validation
203
201
  test_files: []