knjrbfw 0.0.18 → 0.0.19
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.
- data/VERSION +1 -1
- data/knjrbfw.gemspec +2 -1
- data/lib/knj/autoload.rb +1 -0
- data/lib/knj/autoload/tzinfo.rb +2 -0
- data/lib/knj/image.rb +35 -8
- data/lib/knj/os.rb +12 -3
- data/lib/knj/process_meta.rb +7 -0
- data/lib/knj/scripts/process_meta_exec.rb +2 -0
- data/lib/knj/webscripts/image.rhtml +1 -1
- metadata +15 -14
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.19
|
data/knjrbfw.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{knjrbfw}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.19"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kasper Johansen"]
|
@@ -49,6 +49,7 @@ Gem::Specification.new do |s|
|
|
49
49
|
"lib/knj/autoload/soap.rb",
|
50
50
|
"lib/knj/autoload/sqlite3.rb",
|
51
51
|
"lib/knj/autoload/tmail.rb",
|
52
|
+
"lib/knj/autoload/tzinfo.rb",
|
52
53
|
"lib/knj/autoload/xmlsimple.rb",
|
53
54
|
"lib/knj/autoload/zip.rb",
|
54
55
|
"lib/knj/cmd_gen.rb",
|
data/lib/knj/autoload.rb
CHANGED
@@ -99,6 +99,7 @@ autoload :SQLite3, $knjpath + "autoload/sqlite3"
|
|
99
99
|
autoload :Timeout, "timeout"
|
100
100
|
autoload :TCPSocket, "socket"
|
101
101
|
autoload :TCPServer, "socket"
|
102
|
+
autoload :TZInfo, $knjpath + "autoload/tzinfo"
|
102
103
|
autoload :URI, "uri"
|
103
104
|
autoload :Win32, "win32/registry"
|
104
105
|
autoload :WIN32OLE, "win32ole"
|
data/lib/knj/image.rb
CHANGED
@@ -92,16 +92,27 @@ class Knj::Image
|
|
92
92
|
next if y_to <= 0
|
93
93
|
|
94
94
|
#Make corners transparent.
|
95
|
-
|
96
|
-
|
97
|
-
|
95
|
+
if false or RUBY_ENGINE == "jruby"
|
96
|
+
#Make up for the fact that "get_pixels" has not been implemented in "rmagick4j"...
|
97
|
+
pixels = []
|
98
|
+
0.upto(y_to) do |count|
|
99
|
+
pixels << Magick::Pixel.new(0, 0, 0, 255)
|
100
|
+
end
|
101
|
+
|
102
|
+
pic.store_pixels(x_from, y_from, 1, y_to, pixels)
|
103
|
+
else
|
104
|
+
pixels = pic.get_pixels(x_from, y_from, 1, y_to)
|
105
|
+
pixels.each do |pixel|
|
106
|
+
pixel.opacity = Magick::TransparentOpacity
|
107
|
+
end
|
108
|
+
pic.store_pixels(x_from, y_from, 1, y_to, pixels)
|
98
109
|
end
|
99
|
-
|
100
|
-
pic.store_pixels(x_from, y_from, 1, y_to, pixels)
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
104
113
|
if borders
|
114
|
+
color = args[:border_color]
|
115
|
+
|
105
116
|
borders.each do |border|
|
106
117
|
if border.key?(:x)
|
107
118
|
count_from = border[:yf]
|
@@ -112,12 +123,28 @@ class Knj::Image
|
|
112
123
|
end
|
113
124
|
|
114
125
|
count_from.upto(count_to - 1) do |coord|
|
115
|
-
|
126
|
+
if RUBY_ENGINE == "jruby" and color[0, 1] == "#"
|
127
|
+
r = color[1, 2].hex
|
128
|
+
b = color[3, 2].hex
|
129
|
+
g = color[5, 2].hex
|
130
|
+
|
131
|
+
pixel = Magick::Pixel.new(r, b, g)
|
132
|
+
else
|
133
|
+
pixel = Magick::Pixel.from_color(color)
|
134
|
+
end
|
116
135
|
|
117
136
|
if border.key?(:x)
|
118
|
-
|
137
|
+
if RUBY_ENGINE == "jruby"
|
138
|
+
pic.store_pixels(border[:x], coord, 1, 1, [pixel])
|
139
|
+
else
|
140
|
+
pic.pixel_color(border[:x], coord, pixel)
|
141
|
+
end
|
119
142
|
elsif border.key?(:y)
|
120
|
-
|
143
|
+
if RUBY_ENGINE == "jruby"
|
144
|
+
pic.store_pixels(coord, border[:y], 1, 1, [pixel])
|
145
|
+
else
|
146
|
+
pic.pixel_color(coord, border[:y], pixel)
|
147
|
+
end
|
121
148
|
end
|
122
149
|
end
|
123
150
|
end
|
data/lib/knj/os.rb
CHANGED
@@ -79,9 +79,18 @@ module Knj::Os
|
|
79
79
|
}
|
80
80
|
|
81
81
|
if RUBY_ENGINE == "jruby"
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
begin
|
83
|
+
IO.popen4(cmd) do |pid, stdin, stdout, stderr|
|
84
|
+
res[:out] << stdout.read
|
85
|
+
res[:err] << stderr.read
|
86
|
+
end
|
87
|
+
rescue Errno::EBADF => e
|
88
|
+
#Catch and rescue retarted JRuby.
|
89
|
+
if e.message == "Bad file descriptor - Bad file descriptor"
|
90
|
+
retry
|
91
|
+
else
|
92
|
+
raise e
|
93
|
+
end
|
85
94
|
end
|
86
95
|
else
|
87
96
|
Open3.popen3(cmd) do |stdin, stdout, stderr|
|
data/lib/knj/process_meta.rb
CHANGED
@@ -31,6 +31,9 @@ class Knj::Process_meta
|
|
31
31
|
@stdin, @stdout, @stderr = Open3.popen3(cmd)
|
32
32
|
end
|
33
33
|
|
34
|
+
@stdout.sync = true
|
35
|
+
@stdin.sync = true
|
36
|
+
|
34
37
|
args = {
|
35
38
|
:out => @stdin,
|
36
39
|
:in => @stdout,
|
@@ -45,6 +48,10 @@ class Knj::Process_meta
|
|
45
48
|
}
|
46
49
|
end
|
47
50
|
|
51
|
+
#Wait for process to start and check that it is returning the expected output.
|
52
|
+
start_line = @stdout.gets
|
53
|
+
raise "Expected startline from process to be 'process_meta_started' but got: '#{start_line}'." if start_line != "process_meta_started\n"
|
54
|
+
|
48
55
|
@process = Knj::Process.new(args)
|
49
56
|
|
50
57
|
res = @process.send("obj" => {"type" => "process_data"})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knjrbfw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
requirement: &
|
17
|
+
requirement: &18696600 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 2.3.0
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *18696600
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: bundler
|
28
|
-
requirement: &
|
28
|
+
requirement: &18672900 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *18672900
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: jeweler
|
39
|
-
requirement: &
|
39
|
+
requirement: &18626780 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 1.6.3
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *18626780
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rcov
|
50
|
-
requirement: &
|
50
|
+
requirement: &18624480 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *18624480
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: sqlite3
|
61
|
-
requirement: &
|
61
|
+
requirement: &18622160 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *18622160
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rmagick
|
72
|
-
requirement: &
|
72
|
+
requirement: &18602320 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *18602320
|
81
81
|
description: Including stuff for HTTP, SSH and much more.
|
82
82
|
email: k@spernj.org
|
83
83
|
executables: []
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/knj/autoload/soap.rb
|
119
119
|
- lib/knj/autoload/sqlite3.rb
|
120
120
|
- lib/knj/autoload/tmail.rb
|
121
|
+
- lib/knj/autoload/tzinfo.rb
|
121
122
|
- lib/knj/autoload/xmlsimple.rb
|
122
123
|
- lib/knj/autoload/zip.rb
|
123
124
|
- lib/knj/cmd_gen.rb
|
@@ -339,7 +340,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
339
340
|
version: '0'
|
340
341
|
segments:
|
341
342
|
- 0
|
342
|
-
hash:
|
343
|
+
hash: -2766455061602575387
|
343
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
344
345
|
none: false
|
345
346
|
requirements:
|