knjrbfw 0.0.104 → 0.0.105
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/Gemfile.lock +4 -4
- data/VERSION +1 -1
- data/knjrbfw.gemspec +4 -3
- data/lib/knj/knjdb/drivers/sqlite3/knjdb_sqlite3_tables.rb +2 -0
- data/lib/knj/os.rb +6 -2
- data/lib/knj/webscripts/image.rhtml +84 -82
- data/lib/knj/webscripts/image_subproc.rhtml +180 -0
- data/spec/db_spec.rb +76 -0
- metadata +42 -41
data/Gemfile.lock
CHANGED
|
@@ -3,20 +3,20 @@ GEM
|
|
|
3
3
|
specs:
|
|
4
4
|
array_enumerator (0.0.3)
|
|
5
5
|
datet (0.0.25)
|
|
6
|
-
diff-lcs (1.2.
|
|
6
|
+
diff-lcs (1.2.4)
|
|
7
7
|
git (1.2.5)
|
|
8
|
-
http2 (0.0.
|
|
8
|
+
http2 (0.0.17)
|
|
9
9
|
jeweler (1.8.4)
|
|
10
10
|
bundler (~> 1.0)
|
|
11
11
|
git (>= 1.2.5)
|
|
12
12
|
rake
|
|
13
13
|
rdoc
|
|
14
|
-
json (1.
|
|
14
|
+
json (1.8.0)
|
|
15
15
|
php4r (0.0.4)
|
|
16
16
|
datet
|
|
17
17
|
http2
|
|
18
18
|
string-strtr
|
|
19
|
-
rake (10.0
|
|
19
|
+
rake (10.1.0)
|
|
20
20
|
rdoc (4.0.1)
|
|
21
21
|
json (~> 1.4)
|
|
22
22
|
rmagick (2.13.2)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.105
|
data/knjrbfw.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "knjrbfw"
|
|
8
|
-
s.version = "0.0.
|
|
8
|
+
s.version = "0.0.105"
|
|
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"]
|
|
12
|
-
s.date = "2013-
|
|
12
|
+
s.date = "2013-06-28"
|
|
13
13
|
s.description = "Including stuff for HTTP, SSH and much more."
|
|
14
14
|
s.email = "k@spernj.org"
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -241,6 +241,7 @@ Gem::Specification.new do |s|
|
|
|
241
241
|
"lib/knj/unix_proc.rb",
|
|
242
242
|
"lib/knj/web.rb",
|
|
243
243
|
"lib/knj/webscripts/image.rhtml",
|
|
244
|
+
"lib/knj/webscripts/image_subproc.rhtml",
|
|
244
245
|
"lib/knj/win.rb",
|
|
245
246
|
"lib/knj/win_registry.rb",
|
|
246
247
|
"lib/knj/win_tightvnc.rb",
|
|
@@ -266,7 +267,7 @@ Gem::Specification.new do |s|
|
|
|
266
267
|
s.homepage = "http://github.com/kaspernj/knjrbfw"
|
|
267
268
|
s.licenses = ["MIT"]
|
|
268
269
|
s.require_paths = ["lib"]
|
|
269
|
-
s.rubygems_version = "1.8.
|
|
270
|
+
s.rubygems_version = "1.8.23"
|
|
270
271
|
s.summary = "A framework with lots of stuff for Ruby."
|
|
271
272
|
|
|
272
273
|
if s.respond_to? :specification_version then
|
|
@@ -31,6 +31,8 @@ class KnjDB_sqlite3::Tables
|
|
|
31
31
|
|
|
32
32
|
@list_mutex.synchronize do
|
|
33
33
|
q_tables = @db.select("sqlite_master", {"type" => "table"}, {"orderby" => "name"}) do |d_tables|
|
|
34
|
+
next if d_tables[:name] == "sqlite_sequence"
|
|
35
|
+
|
|
34
36
|
obj = @list.get!(d_tables[:name])
|
|
35
37
|
|
|
36
38
|
if !obj
|
data/lib/knj/os.rb
CHANGED
|
@@ -241,8 +241,12 @@ module Knj::Os
|
|
|
241
241
|
end
|
|
242
242
|
end
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
# Code for returning RBEnv Ruby path if running through RBEnv.
|
|
245
|
+
if ENV["RBENV_VERSION"] && ENV["RBENV_ROOT"]
|
|
246
|
+
rbenv_path = "#{ENV["RBENV_ROOT"]}/versions/#{ENV["RBENV_VERSION"]}/bin/ruby"
|
|
247
|
+
return rbenv_path if File.exists?(rbenv_path)
|
|
248
|
+
end
|
|
245
249
|
|
|
246
|
-
raise "Could not figure out the executed executable."
|
|
250
|
+
raise "Could not figure out the executed executable from the environment: '#{ENV.to_hash}'."
|
|
247
251
|
end
|
|
248
252
|
end
|
|
@@ -48,23 +48,23 @@
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
time_orig = File.mtime(_get["path"])
|
|
51
|
-
|
|
52
|
-
tmp_use = false
|
|
53
51
|
tmp_write = false
|
|
54
52
|
if Knj::CONFIG["webscripts_image"]
|
|
55
|
-
tmp_use = true
|
|
56
53
|
tmp_path = "#{Knj::CONFIG["webscripts_image"]["tmp_path"]}/#{idstr}"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
54
|
+
else
|
|
55
|
+
tmp_path = "#{Knj::Os.tmpdir}/knjrbfw_image_#{idstr}"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
tmp_exists = File.exists?(tmp_path)
|
|
59
|
+
tmp_write = true unless tmp_exists
|
|
60
|
+
|
|
61
|
+
if !tmp_write and tmp_exists
|
|
62
|
+
time_cache = File.mtime(tmp_path)
|
|
63
|
+
|
|
64
|
+
if time_orig > time_cache
|
|
65
|
+
tmp_write = true
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
68
|
|
|
69
69
|
if _get["force"] == "true" or _get["force"] == "1"
|
|
70
70
|
force = true
|
|
@@ -85,85 +85,87 @@
|
|
|
85
85
|
exit
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
if
|
|
88
|
+
if tmp_write or force
|
|
89
89
|
blob_cont = nil
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
width =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
if _get["maxwidth"]
|
|
126
|
-
maxwidth = _get["maxwidth"].to_i
|
|
127
|
-
|
|
128
|
-
if width > maxwidth
|
|
129
|
-
height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
|
|
130
|
-
width = maxwidth
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
if _get["maxheight"]
|
|
135
|
-
maxheight = _get["maxheight"].to_i
|
|
136
|
-
|
|
137
|
-
if height > maxheight
|
|
138
|
-
width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
|
|
139
|
-
height = maxheight
|
|
140
|
-
end
|
|
90
|
+
|
|
91
|
+
raise "RMagick has not been loaded. If loaded through here bugs will occur. Load in beginning of script." unless ::Kernel.const_defined?(:Magick)
|
|
92
|
+
pic = Magick::Image.read(_get["path"]).first
|
|
93
|
+
|
|
94
|
+
if !pic
|
|
95
|
+
print "Could not open image from '#{_get["path"]}'."
|
|
96
|
+
exit
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
pic.format = "png"
|
|
100
|
+
|
|
101
|
+
pic_columns = pic.columns
|
|
102
|
+
pic_rows = pic.rows
|
|
103
|
+
|
|
104
|
+
width = pic_columns
|
|
105
|
+
height = pic_rows
|
|
106
|
+
|
|
107
|
+
height = _get["height"].to_i if _get["height"]
|
|
108
|
+
width = _get["width"].to_i if _get["width"]
|
|
109
|
+
|
|
110
|
+
if _get["width"] && !_get["height"]
|
|
111
|
+
height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
|
|
112
|
+
elsif _get["height"] && !_get["width"]
|
|
113
|
+
width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if _get["smartsize"]
|
|
117
|
+
if pic_columns > pic_rows
|
|
118
|
+
width = _get["smartsize"].to_i
|
|
119
|
+
height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
|
|
120
|
+
else
|
|
121
|
+
height = _get["smartsize"].to_i
|
|
122
|
+
width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
|
|
141
123
|
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if _get["maxwidth"]
|
|
127
|
+
maxwidth = _get["maxwidth"].to_i
|
|
142
128
|
|
|
143
|
-
if
|
|
144
|
-
|
|
145
|
-
|
|
129
|
+
if width > maxwidth
|
|
130
|
+
height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
|
|
131
|
+
width = maxwidth
|
|
146
132
|
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if _get["maxheight"]
|
|
136
|
+
maxheight = _get["maxheight"].to_i
|
|
147
137
|
|
|
148
|
-
if height
|
|
149
|
-
|
|
138
|
+
if height > maxheight
|
|
139
|
+
width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
|
|
140
|
+
height = maxheight
|
|
150
141
|
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if _get["width"] and _get["height"]
|
|
145
|
+
width = _get["width"].to_i
|
|
146
|
+
height = _get["height"].to_i
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if height != pic_rows or width != pic_columns
|
|
150
|
+
pic = pic.resize_to_fill(width.to_i, height.to_i)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if _get["rounded_corners"]
|
|
154
|
+
args = {:img => pic, :radius => _get["rounded_corners"].to_i}
|
|
151
155
|
|
|
152
|
-
if _get["
|
|
153
|
-
args =
|
|
154
|
-
|
|
155
|
-
if _get["border"] and _get["border_color"]
|
|
156
|
-
args[:border] = _get["border"].to_i
|
|
157
|
-
args[:border_color] = _get["border_color"]
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
#Call rounded_corners with the proxy-hash.
|
|
161
|
-
subproc.static("Knj::Image", :rounded_corners, args)
|
|
156
|
+
if _get["border"] and _get["border_color"]
|
|
157
|
+
args[:border] = _get["border"].to_i
|
|
158
|
+
args[:border_color] = _get["border_color"]
|
|
162
159
|
end
|
|
163
160
|
|
|
164
|
-
|
|
161
|
+
#Call rounded_corners with the proxy-hash.
|
|
162
|
+
Knj::Image.rounded_corners(args)
|
|
165
163
|
end
|
|
164
|
+
|
|
165
|
+
pic.write(tmp_path) if tmp_write or force
|
|
166
166
|
end
|
|
167
|
+
|
|
168
|
+
raise "Picture was not written: '#{tmp_path}'." if !tmp_path || !File.exists?(tmp_path)
|
|
167
169
|
|
|
168
170
|
appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
|
|
169
171
|
appsrv.header("Content-Type", "image/png")
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<%
|
|
2
|
+
#Register appserver.
|
|
3
|
+
begin
|
|
4
|
+
appsrv = _hb
|
|
5
|
+
rescue NameError
|
|
6
|
+
appsrv = _kas
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
#Support for the PHP-version... Comes handy when converting PHP to Ruby...
|
|
10
|
+
if !_get["path"]
|
|
11
|
+
trans = {
|
|
12
|
+
"picture" => "path"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if _get["edgesize"]
|
|
16
|
+
_get["rounded_corners"] = (_get["edgesize"].to_f / 3.0).to_i
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
if _get["edgeborder"]
|
|
20
|
+
if _get["edgeborder"].length == 6
|
|
21
|
+
_get["border_color"] = "##{_get["edgeborder"]}"
|
|
22
|
+
else
|
|
23
|
+
_get["border_color"] = _get["edbeborder"]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
if _get["edgeborder"]
|
|
28
|
+
_get["border"] = 1
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
trans.each do |key, val|
|
|
32
|
+
_get[val] = _get[key] if _get[key]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#Base64-encoding of path.
|
|
37
|
+
if _get["path64"]
|
|
38
|
+
require "base64"
|
|
39
|
+
_get["path"] = Base64.decode64(_get["path64"])
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
require "digest/md5"
|
|
43
|
+
idstr = Digest::MD5.hexdigest("#{_get["path"]}_#{_get["smartsize"].to_i}_#{_get["width"].to_i}_#{_get["height"].to_i}_#{_get["maxwidth"].to_i}_#{_get["maxheight"].to_i}_#{_get["rounded_corners"].to_i}_#{_get["border"].to_i}_#{_get["border_color"]}")
|
|
44
|
+
|
|
45
|
+
if !_get["path"] or !File.exists?(_get["path"])
|
|
46
|
+
print "File does not exist: '#{_get["path"]}'.\n"
|
|
47
|
+
exit
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
time_orig = File.mtime(_get["path"])
|
|
51
|
+
|
|
52
|
+
tmp_write = false
|
|
53
|
+
if Knj::CONFIG["webscripts_image"]
|
|
54
|
+
tmp_path = "#{Knj::CONFIG["webscripts_image"]["tmp_path"]}/#{idstr}"
|
|
55
|
+
else
|
|
56
|
+
tmp_path = "#{Knj::Os.tmpdir}/knjrbfw_image_#{idstr}"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
tmp_exists = File.exists?(tmp_path)
|
|
60
|
+
tmp_write = true if !tmp_exists
|
|
61
|
+
|
|
62
|
+
if !tmp_write and tmp_exists
|
|
63
|
+
time_cache = File.mtime(tmp_path)
|
|
64
|
+
|
|
65
|
+
if time_orig > time_cache
|
|
66
|
+
tmp_write = true
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if _get["force"] == "true" or _get["force"] == "1"
|
|
71
|
+
force = true
|
|
72
|
+
else
|
|
73
|
+
force = false
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
notchanged = false
|
|
77
|
+
|
|
78
|
+
if _httpsession.handler.modified_since and time_cache and _httpsession.handler.modified_since.utc.to_s == time_cache.utc.to_s
|
|
79
|
+
notchanged = true
|
|
80
|
+
elsif _httpsession.handler.modified_since and _httpsession.handler.modified_since.utc.to_s == time_orig.utc.to_s
|
|
81
|
+
notchanged = true
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if notchanged and !force
|
|
85
|
+
_httpsession.resp.status = 304
|
|
86
|
+
exit
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if tmp_write or force
|
|
90
|
+
blob_cont = nil
|
|
91
|
+
|
|
92
|
+
require "ruby_process"
|
|
93
|
+
Ruby_process::Cproxy.run do |data|
|
|
94
|
+
subproc = data[:subproc]
|
|
95
|
+
subproc.static(:Object, :require, "rubygems")
|
|
96
|
+
subproc.static(:Object, :require, "#{Knj.knjrbfw_path}/../knjrbfw.rb")
|
|
97
|
+
subproc.static(:Object, :require, "RMagick")
|
|
98
|
+
subproc.static(:Dir, :chdir, File.dirname(__FILE__))
|
|
99
|
+
|
|
100
|
+
pic = subproc.static("Magick::Image", :read, _get["path"]).first
|
|
101
|
+
|
|
102
|
+
if !pic
|
|
103
|
+
print "Could not open image from '#{_get["path"]}'."
|
|
104
|
+
exit
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
pic.format = "png"
|
|
108
|
+
|
|
109
|
+
pic_columns = pic.columns.__rp_marshal
|
|
110
|
+
pic_rows = pic.rows.__rp_marshal
|
|
111
|
+
|
|
112
|
+
width = pic_columns
|
|
113
|
+
height = pic_rows
|
|
114
|
+
|
|
115
|
+
height = _get["height"].to_i if _get["height"]
|
|
116
|
+
width = _get["width"].to_i if _get["width"]
|
|
117
|
+
|
|
118
|
+
if _get["width"] && !_get["height"]
|
|
119
|
+
height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
|
|
120
|
+
elsif _get["height"] && !_get["width"]
|
|
121
|
+
width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if _get["smartsize"]
|
|
125
|
+
if pic_columns > pic_rows
|
|
126
|
+
width = _get["smartsize"].to_i
|
|
127
|
+
height = (pic_rows.to_f / (pic_columns.to_f / width.to_f)).to_i
|
|
128
|
+
else
|
|
129
|
+
height = _get["smartsize"].to_i
|
|
130
|
+
width = (pic_columns.to_f / (pic_rows.to_f / height.to_f)).to_i
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if _get["maxwidth"]
|
|
135
|
+
maxwidth = _get["maxwidth"].to_i
|
|
136
|
+
|
|
137
|
+
if width > maxwidth
|
|
138
|
+
height = (pic_rows.to_f / (pic_columns.to_f / maxwidth.to_f)).to_i
|
|
139
|
+
width = maxwidth
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if _get["maxheight"]
|
|
144
|
+
maxheight = _get["maxheight"].to_i
|
|
145
|
+
|
|
146
|
+
if height > maxheight
|
|
147
|
+
width = (pic_columns.to_f / (pic_rows.to_f / maxheight.to_f)).to_i
|
|
148
|
+
height = maxheight
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if _get["width"] and _get["height"]
|
|
153
|
+
width = _get["width"].to_i
|
|
154
|
+
height = _get["height"].to_i
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if height != pic_rows or width != pic_columns
|
|
158
|
+
pic = pic.resize_to_fill(width.to_i, height.to_i)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if _get["rounded_corners"]
|
|
162
|
+
args = {:img => pic, :radius => _get["rounded_corners"].to_i}
|
|
163
|
+
|
|
164
|
+
if _get["border"] and _get["border_color"]
|
|
165
|
+
args[:border] = _get["border"].to_i
|
|
166
|
+
args[:border_color] = _get["border_color"]
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
#Call rounded_corners with the proxy-hash.
|
|
170
|
+
subproc.static("Knj::Image", :rounded_corners, args)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
pic.write(tmp_path) if tmp_write or force
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
appsrv.header("Last-Modified", "#{time_orig.httpdate} GMT") if time_orig
|
|
178
|
+
appsrv.header("Content-Type", "image/png")
|
|
179
|
+
_httpsession.force_fileread(tmp_path)
|
|
180
|
+
%>
|
data/spec/db_spec.rb
CHANGED
|
@@ -203,4 +203,80 @@ describe "Db" do
|
|
|
203
203
|
date = Date.new(1985, 6, 17)
|
|
204
204
|
db.insert(:test, {:date => date}, :return_sql => true).should eql("INSERT INTO `test` (`date`) VALUES ('1985-06-17')")
|
|
205
205
|
end
|
|
206
|
+
|
|
207
|
+
it "should copy database structure and data" do
|
|
208
|
+
require "knj/db"
|
|
209
|
+
require "knj/os"
|
|
210
|
+
require "rubygems"
|
|
211
|
+
require "sqlite3" if !Kernel.const_defined?("SQLite3") and RUBY_ENGINE != "jruby"
|
|
212
|
+
|
|
213
|
+
db_path1 = "#{Knj::Os.tmpdir}/knjrbfw_test_sqlite3_db1.sqlite3"
|
|
214
|
+
File.unlink(db_path1) if File.exists?(db_path1)
|
|
215
|
+
|
|
216
|
+
db_path2 = "#{Knj::Os.tmpdir}/knjrbfw_test_sqlite3_db2.sqlite3"
|
|
217
|
+
File.unlink(db_path2) if File.exists?(db_path2)
|
|
218
|
+
|
|
219
|
+
db1 = Knj::Db.new(
|
|
220
|
+
:type => "sqlite3",
|
|
221
|
+
:path => db_path1,
|
|
222
|
+
:return_keys => "symbols",
|
|
223
|
+
:index_append_table_name => true
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
db1.tables.create(:test_table, {
|
|
227
|
+
"columns" => [
|
|
228
|
+
{"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true},
|
|
229
|
+
{"name" => "testname", "type" => "varchar"}
|
|
230
|
+
],
|
|
231
|
+
"indexes" => [
|
|
232
|
+
"testname"
|
|
233
|
+
]
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
table1 = db1.tables["test_table"]
|
|
237
|
+
cols1 = table1.columns
|
|
238
|
+
|
|
239
|
+
100.times do |count|
|
|
240
|
+
table1.insert(:testname => "TestRow#{count}")
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
db2 = Knj::Db.new(
|
|
244
|
+
:type => "sqlite3",
|
|
245
|
+
:path => db_path2,
|
|
246
|
+
:return_keys => "symbols",
|
|
247
|
+
:index_append_table_name => true
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
begin
|
|
251
|
+
table2 = db2.tables["test_table"]
|
|
252
|
+
raise "Expected not-found exception."
|
|
253
|
+
rescue Errno::ENOENT
|
|
254
|
+
#expected
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
db1.copy_to(db2)
|
|
258
|
+
|
|
259
|
+
table2 = db2.tables["test_table"]
|
|
260
|
+
|
|
261
|
+
cols2 = table2.columns
|
|
262
|
+
cols2.length.should eql(cols1.length)
|
|
263
|
+
|
|
264
|
+
table2.rows_count.should eql(table1.rows_count)
|
|
265
|
+
|
|
266
|
+
db1.select(:test_table) do |row1|
|
|
267
|
+
found = 0
|
|
268
|
+
db2.select(:test_table, row1) do |row2|
|
|
269
|
+
found += 1
|
|
270
|
+
|
|
271
|
+
row1.each do |key, val|
|
|
272
|
+
row2[key].should eql(val)
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
found.should eql(1)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
table1.indexes.length.should eql(1)
|
|
280
|
+
table2.indexes.length.should eql(table1.indexes.length)
|
|
281
|
+
end
|
|
206
282
|
end
|
metadata
CHANGED
|
@@ -1,203 +1,203 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knjrbfw
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.104
|
|
5
4
|
prerelease:
|
|
5
|
+
version: 0.0.105
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Kasper Johansen
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
12
|
+
date: 2013-06-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
|
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
17
16
|
none: false
|
|
18
17
|
requirements:
|
|
19
18
|
- - ! '>='
|
|
20
19
|
- !ruby/object:Gem::Version
|
|
21
20
|
version: '0'
|
|
21
|
+
name: wref
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
|
|
24
|
+
requirement: !ruby/object:Gem::Requirement
|
|
25
25
|
none: false
|
|
26
26
|
requirements:
|
|
27
27
|
- - ! '>='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
29
|
version: '0'
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
|
-
|
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
33
32
|
none: false
|
|
34
33
|
requirements:
|
|
35
34
|
- - ! '>='
|
|
36
35
|
- !ruby/object:Gem::Version
|
|
37
36
|
version: '0'
|
|
37
|
+
name: tsafe
|
|
38
38
|
type: :runtime
|
|
39
39
|
prerelease: false
|
|
40
|
-
|
|
40
|
+
requirement: !ruby/object:Gem::Requirement
|
|
41
41
|
none: false
|
|
42
42
|
requirements:
|
|
43
43
|
- - ! '>='
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '0'
|
|
46
46
|
- !ruby/object:Gem::Dependency
|
|
47
|
-
|
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
49
48
|
none: false
|
|
50
49
|
requirements:
|
|
51
50
|
- - ! '>='
|
|
52
51
|
- !ruby/object:Gem::Version
|
|
53
52
|
version: '0'
|
|
53
|
+
name: datet
|
|
54
54
|
type: :runtime
|
|
55
55
|
prerelease: false
|
|
56
|
-
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
none: false
|
|
58
58
|
requirements:
|
|
59
59
|
- - ! '>='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '0'
|
|
62
62
|
- !ruby/object:Gem::Dependency
|
|
63
|
-
|
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
64
|
none: false
|
|
66
65
|
requirements:
|
|
67
66
|
- - ! '>='
|
|
68
67
|
- !ruby/object:Gem::Version
|
|
69
68
|
version: '0'
|
|
69
|
+
name: http2
|
|
70
70
|
type: :runtime
|
|
71
71
|
prerelease: false
|
|
72
|
-
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
73
|
none: false
|
|
74
74
|
requirements:
|
|
75
75
|
- - ! '>='
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
77
|
version: '0'
|
|
78
78
|
- !ruby/object:Gem::Dependency
|
|
79
|
-
|
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
81
80
|
none: false
|
|
82
81
|
requirements:
|
|
83
82
|
- - ! '>='
|
|
84
83
|
- !ruby/object:Gem::Version
|
|
85
84
|
version: '0'
|
|
85
|
+
name: php4r
|
|
86
86
|
type: :runtime
|
|
87
87
|
prerelease: false
|
|
88
|
-
|
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
|
89
89
|
none: false
|
|
90
90
|
requirements:
|
|
91
91
|
- - ! '>='
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
93
|
version: '0'
|
|
94
94
|
- !ruby/object:Gem::Dependency
|
|
95
|
-
|
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
97
96
|
none: false
|
|
98
97
|
requirements:
|
|
99
98
|
- - ! '>='
|
|
100
99
|
- !ruby/object:Gem::Version
|
|
101
100
|
version: '0'
|
|
101
|
+
name: ruby_process
|
|
102
102
|
type: :runtime
|
|
103
103
|
prerelease: false
|
|
104
|
-
|
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
|
105
105
|
none: false
|
|
106
106
|
requirements:
|
|
107
107
|
- - ! '>='
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
109
|
version: '0'
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
|
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
113
112
|
none: false
|
|
114
113
|
requirements:
|
|
115
114
|
- - ! '>='
|
|
116
115
|
- !ruby/object:Gem::Version
|
|
117
116
|
version: '0'
|
|
117
|
+
name: rspec
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
|
-
|
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
|
121
121
|
none: false
|
|
122
122
|
requirements:
|
|
123
123
|
- - ! '>='
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
125
|
version: '0'
|
|
126
126
|
- !ruby/object:Gem::Dependency
|
|
127
|
-
|
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
129
128
|
none: false
|
|
130
129
|
requirements:
|
|
131
130
|
- - ! '>='
|
|
132
131
|
- !ruby/object:Gem::Version
|
|
133
132
|
version: '0'
|
|
133
|
+
name: bundler
|
|
134
134
|
type: :development
|
|
135
135
|
prerelease: false
|
|
136
|
-
|
|
136
|
+
requirement: !ruby/object:Gem::Requirement
|
|
137
137
|
none: false
|
|
138
138
|
requirements:
|
|
139
139
|
- - ! '>='
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
141
|
version: '0'
|
|
142
142
|
- !ruby/object:Gem::Dependency
|
|
143
|
-
|
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
|
143
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
145
144
|
none: false
|
|
146
145
|
requirements:
|
|
147
146
|
- - ! '>='
|
|
148
147
|
- !ruby/object:Gem::Version
|
|
149
148
|
version: '0'
|
|
149
|
+
name: jeweler
|
|
150
150
|
type: :development
|
|
151
151
|
prerelease: false
|
|
152
|
-
|
|
152
|
+
requirement: !ruby/object:Gem::Requirement
|
|
153
153
|
none: false
|
|
154
154
|
requirements:
|
|
155
155
|
- - ! '>='
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
157
|
version: '0'
|
|
158
158
|
- !ruby/object:Gem::Dependency
|
|
159
|
-
|
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
|
159
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
161
160
|
none: false
|
|
162
161
|
requirements:
|
|
163
162
|
- - ! '>='
|
|
164
163
|
- !ruby/object:Gem::Version
|
|
165
164
|
version: '0'
|
|
165
|
+
name: sqlite3
|
|
166
166
|
type: :development
|
|
167
167
|
prerelease: false
|
|
168
|
-
|
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
|
169
169
|
none: false
|
|
170
170
|
requirements:
|
|
171
171
|
- - ! '>='
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
173
|
version: '0'
|
|
174
174
|
- !ruby/object:Gem::Dependency
|
|
175
|
-
|
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
176
|
none: false
|
|
178
177
|
requirements:
|
|
179
178
|
- - ! '>='
|
|
180
179
|
- !ruby/object:Gem::Version
|
|
181
180
|
version: '0'
|
|
181
|
+
name: rmagick
|
|
182
182
|
type: :development
|
|
183
183
|
prerelease: false
|
|
184
|
-
|
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
|
185
185
|
none: false
|
|
186
186
|
requirements:
|
|
187
187
|
- - ! '>='
|
|
188
188
|
- !ruby/object:Gem::Version
|
|
189
189
|
version: '0'
|
|
190
190
|
- !ruby/object:Gem::Dependency
|
|
191
|
-
|
|
192
|
-
requirement: !ruby/object:Gem::Requirement
|
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
193
192
|
none: false
|
|
194
193
|
requirements:
|
|
195
194
|
- - ! '>='
|
|
196
195
|
- !ruby/object:Gem::Version
|
|
197
196
|
version: '0'
|
|
197
|
+
name: array_enumerator
|
|
198
198
|
type: :development
|
|
199
199
|
prerelease: false
|
|
200
|
-
|
|
200
|
+
requirement: !ruby/object:Gem::Requirement
|
|
201
201
|
none: false
|
|
202
202
|
requirements:
|
|
203
203
|
- - ! '>='
|
|
@@ -435,6 +435,7 @@ files:
|
|
|
435
435
|
- lib/knj/unix_proc.rb
|
|
436
436
|
- lib/knj/web.rb
|
|
437
437
|
- lib/knj/webscripts/image.rhtml
|
|
438
|
+
- lib/knj/webscripts/image_subproc.rhtml
|
|
438
439
|
- lib/knj/win.rb
|
|
439
440
|
- lib/knj/win_registry.rb
|
|
440
441
|
- lib/knj/win_tightvnc.rb
|
|
@@ -468,10 +469,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
468
469
|
requirements:
|
|
469
470
|
- - ! '>='
|
|
470
471
|
- !ruby/object:Gem::Version
|
|
471
|
-
version: '0'
|
|
472
472
|
segments:
|
|
473
473
|
- 0
|
|
474
|
-
hash: -
|
|
474
|
+
hash: -3077588616452879408
|
|
475
|
+
version: '0'
|
|
475
476
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
476
477
|
none: false
|
|
477
478
|
requirements:
|
|
@@ -480,7 +481,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
480
481
|
version: '0'
|
|
481
482
|
requirements: []
|
|
482
483
|
rubyforge_project:
|
|
483
|
-
rubygems_version: 1.8.
|
|
484
|
+
rubygems_version: 1.8.23
|
|
484
485
|
signing_key:
|
|
485
486
|
specification_version: 3
|
|
486
487
|
summary: A framework with lots of stuff for Ruby.
|