knjrbfw 0.0.113 → 0.0.114
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +0 -14
- data/lib/knj/image.rb +1 -3
- metadata +4 -24
- data/.document +0 -5
- data/.rspec +0 -1
- data/Gemfile +0 -22
- data/Gemfile.lock +0 -90
- data/VERSION +0 -1
- data/knjrbfw.gemspec +0 -286
- data/lib/knj/.gitignore +0 -1
- data/lib/knj/sshrobot/sshrobot.rb +0 -135
- data/lib/knj/sshrobot.rb +0 -1
- data/spec/amixer_spec.rb +0 -32
- data/spec/arrayext_spec.rb +0 -42
- data/spec/autoload_spec.rb +0 -7
- data/spec/cmd_parser_spec.rb +0 -25
- data/spec/knjrbfw_spec.rb +0 -109
- data/spec/locales_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -12
- data/spec/strings_spec.rb +0 -65
- data/spec/web_spec.rb +0 -77
- data/testfiles/image.jpg +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 07fe0af5b28cf7ca05f3046d0790968c1296b06bd7cb62d5c66736824f08e7c8
|
4
|
+
data.tar.gz: b2e0be27b9cc06223b8a87439b6d676d611f8220038a1b95fba83de9dda51688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad7ecf818020effd32d3d8bf4efd2c87f1f3672dee5fbaf23970cd497bd89f031bbb4bb2803e483b5c32b16daf33c863e2b5317448ab0d0c601e99c1c1ff3efb
|
7
|
+
data.tar.gz: 16085e10575051841201d32398601aecd47c9134788b52e97555d0b5d9671f83d8660571dee7d11a1da45f4236a250d605e11dd596c52b2c83c51f21d036c196
|
data/Rakefile
CHANGED
@@ -11,20 +11,6 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
end
|
12
12
|
require 'rake'
|
13
13
|
|
14
|
-
require 'jeweler'
|
15
|
-
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
-
gem.name = "knjrbfw"
|
18
|
-
gem.homepage = "http://github.com/kaspernj/knjrbfw"
|
19
|
-
gem.license = "MIT"
|
20
|
-
gem.summary = %Q{A framework with lots of stuff for Ruby.}
|
21
|
-
gem.description = %Q{Including stuff for HTTP, SSH and much more.}
|
22
|
-
gem.email = "k@spernj.org"
|
23
|
-
gem.authors = ["Kasper Johansen"]
|
24
|
-
# dependencies defined in Gemfile
|
25
|
-
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
|
-
|
28
14
|
require 'rspec/core'
|
29
15
|
require 'rspec/core/rake_task'
|
30
16
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
data/lib/knj/image.rb
CHANGED
@@ -113,7 +113,7 @@ class Knj::Image
|
|
113
113
|
else
|
114
114
|
pixels = pic.get_pixels(x_from, y_from, 1, y_to)
|
115
115
|
pixels.each do |pixel|
|
116
|
-
pixel.
|
116
|
+
pixel.alpha = ::Magick::QuantumRange
|
117
117
|
end
|
118
118
|
pic.store_pixels(x_from, y_from, 1, y_to, pixels)
|
119
119
|
end
|
@@ -159,8 +159,6 @@ class Knj::Image
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
162
|
-
|
163
|
-
pic.matte = true
|
164
162
|
end
|
165
163
|
|
166
164
|
#Returns the width relative to the height.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.114
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Kasper
|
7
|
+
- Kasper Stöckel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wref
|
@@ -186,16 +186,9 @@ extra_rdoc_files:
|
|
186
186
|
- LICENSE.txt
|
187
187
|
- README.rdoc
|
188
188
|
files:
|
189
|
-
- ".document"
|
190
|
-
- ".rspec"
|
191
|
-
- Gemfile
|
192
|
-
- Gemfile.lock
|
193
189
|
- LICENSE.txt
|
194
190
|
- README.rdoc
|
195
191
|
- Rakefile
|
196
|
-
- VERSION
|
197
|
-
- knjrbfw.gemspec
|
198
|
-
- lib/knj/.gitignore
|
199
192
|
- lib/knj/amixer.rb
|
200
193
|
- lib/knj/arrayext.rb
|
201
194
|
- lib/knj/autoload.rb
|
@@ -365,8 +358,6 @@ files:
|
|
365
358
|
- lib/knj/scripts/svn_merge.rb
|
366
359
|
- lib/knj/scripts/upgrade_knjrbfw_checker.rb
|
367
360
|
- lib/knj/sms.rb
|
368
|
-
- lib/knj/sshrobot.rb
|
369
|
-
- lib/knj/sshrobot/sshrobot.rb
|
370
361
|
- lib/knj/strings.rb
|
371
362
|
- lib/knj/sysuser.rb
|
372
363
|
- lib/knj/table_writer.rb
|
@@ -389,16 +380,6 @@ files:
|
|
389
380
|
- lib/knj/x11vnc.rb
|
390
381
|
- lib/knj/youtube.rb
|
391
382
|
- lib/knjrbfw.rb
|
392
|
-
- spec/amixer_spec.rb
|
393
|
-
- spec/arrayext_spec.rb
|
394
|
-
- spec/autoload_spec.rb
|
395
|
-
- spec/cmd_parser_spec.rb
|
396
|
-
- spec/knjrbfw_spec.rb
|
397
|
-
- spec/locales_spec.rb
|
398
|
-
- spec/spec_helper.rb
|
399
|
-
- spec/strings_spec.rb
|
400
|
-
- spec/web_spec.rb
|
401
|
-
- testfiles/image.jpg
|
402
383
|
homepage: http://github.com/kaspernj/knjrbfw
|
403
384
|
licenses:
|
404
385
|
- MIT
|
@@ -418,8 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
399
|
- !ruby/object:Gem::Version
|
419
400
|
version: '0'
|
420
401
|
requirements: []
|
421
|
-
|
422
|
-
rubygems_version: 2.4.0
|
402
|
+
rubygems_version: 3.2.32
|
423
403
|
signing_key:
|
424
404
|
specification_version: 4
|
425
405
|
summary: A framework with lots of stuff for Ruby.
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
|
-
gem "wref", ">= 0.0.8"
|
6
|
-
gem "tsafe"
|
7
|
-
gem "datet"
|
8
|
-
gem "http2"
|
9
|
-
gem "php4r"
|
10
|
-
gem "ruby_process"
|
11
|
-
|
12
|
-
# Add dependencies to develop your gem here.
|
13
|
-
# Include everything needed to run rake, tests, features, etc.
|
14
|
-
group :development do
|
15
|
-
gem "rspec"
|
16
|
-
gem "bundler"
|
17
|
-
gem "jeweler"
|
18
|
-
gem "sqlite3" if RUBY_ENGINE != "jruby"
|
19
|
-
gem "rmagick" if RUBY_ENGINE != "jruby"
|
20
|
-
gem "rmagick4j" if RUBY_ENGINE == "jruby"
|
21
|
-
gem "array_enumerator"
|
22
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.3.6)
|
5
|
-
array_enumerator (0.0.3)
|
6
|
-
builder (3.2.2)
|
7
|
-
datet (0.0.25)
|
8
|
-
descendants_tracker (0.0.4)
|
9
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
10
|
-
diff-lcs (1.2.5)
|
11
|
-
faraday (0.9.0)
|
12
|
-
multipart-post (>= 1.2, < 3)
|
13
|
-
git (1.2.6)
|
14
|
-
github_api (0.11.3)
|
15
|
-
addressable (~> 2.3)
|
16
|
-
descendants_tracker (~> 0.0.1)
|
17
|
-
faraday (~> 0.8, < 0.10)
|
18
|
-
hashie (>= 1.2)
|
19
|
-
multi_json (>= 1.7.5, < 2.0)
|
20
|
-
nokogiri (~> 1.6.0)
|
21
|
-
oauth2
|
22
|
-
hashie (2.1.1)
|
23
|
-
highline (1.6.21)
|
24
|
-
http2 (0.0.23)
|
25
|
-
jeweler (2.0.1)
|
26
|
-
builder
|
27
|
-
bundler (>= 1.0)
|
28
|
-
git (>= 1.2.5)
|
29
|
-
github_api
|
30
|
-
highline (>= 1.6.15)
|
31
|
-
nokogiri (>= 1.5.10)
|
32
|
-
rake
|
33
|
-
rdoc
|
34
|
-
json (1.8.1)
|
35
|
-
jwt (0.1.11)
|
36
|
-
multi_json (>= 1.5)
|
37
|
-
mini_portile (0.5.3)
|
38
|
-
multi_json (1.9.2)
|
39
|
-
multi_xml (0.5.5)
|
40
|
-
multipart-post (2.0.0)
|
41
|
-
nokogiri (1.6.1)
|
42
|
-
mini_portile (~> 0.5.0)
|
43
|
-
oauth2 (0.9.3)
|
44
|
-
faraday (>= 0.8, < 0.10)
|
45
|
-
jwt (~> 0.1.8)
|
46
|
-
multi_json (~> 1.3)
|
47
|
-
multi_xml (~> 0.5)
|
48
|
-
rack (~> 1.2)
|
49
|
-
php4r (0.0.4)
|
50
|
-
datet
|
51
|
-
http2
|
52
|
-
string-strtr
|
53
|
-
rack (1.5.2)
|
54
|
-
rake (10.3.2)
|
55
|
-
rdoc (4.1.1)
|
56
|
-
json (~> 1.4)
|
57
|
-
rmagick (2.13.2)
|
58
|
-
rspec (2.14.1)
|
59
|
-
rspec-core (~> 2.14.0)
|
60
|
-
rspec-expectations (~> 2.14.0)
|
61
|
-
rspec-mocks (~> 2.14.0)
|
62
|
-
rspec-core (2.14.8)
|
63
|
-
rspec-expectations (2.14.5)
|
64
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
65
|
-
rspec-mocks (2.14.6)
|
66
|
-
ruby_process (0.0.9)
|
67
|
-
tsafe
|
68
|
-
wref
|
69
|
-
sqlite3 (1.3.9)
|
70
|
-
string-strtr (0.0.3)
|
71
|
-
thread_safe (0.3.3)
|
72
|
-
tsafe (0.0.11)
|
73
|
-
wref (0.0.8)
|
74
|
-
|
75
|
-
PLATFORMS
|
76
|
-
ruby
|
77
|
-
|
78
|
-
DEPENDENCIES
|
79
|
-
array_enumerator
|
80
|
-
bundler
|
81
|
-
datet
|
82
|
-
http2
|
83
|
-
jeweler
|
84
|
-
php4r
|
85
|
-
rmagick
|
86
|
-
rspec
|
87
|
-
ruby_process
|
88
|
-
sqlite3
|
89
|
-
tsafe
|
90
|
-
wref (>= 0.0.8)
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.113
|
data/knjrbfw.gemspec
DELETED
@@ -1,286 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: knjrbfw 0.0.113 ruby lib
|
6
|
-
|
7
|
-
Gem::Specification.new do |s|
|
8
|
-
s.name = "knjrbfw"
|
9
|
-
s.version = "0.0.113"
|
10
|
-
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
|
-
s.authors = ["Kasper Johansen"]
|
14
|
-
s.date = "2015-04-21"
|
15
|
-
s.description = "Including stuff for HTTP, SSH and much more."
|
16
|
-
s.email = "k@spernj.org"
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".rspec",
|
24
|
-
"Gemfile",
|
25
|
-
"Gemfile.lock",
|
26
|
-
"LICENSE.txt",
|
27
|
-
"README.rdoc",
|
28
|
-
"Rakefile",
|
29
|
-
"VERSION",
|
30
|
-
"knjrbfw.gemspec",
|
31
|
-
"lib/knj/.gitignore",
|
32
|
-
"lib/knj/amixer.rb",
|
33
|
-
"lib/knj/arrayext.rb",
|
34
|
-
"lib/knj/autoload.rb",
|
35
|
-
"lib/knj/autoload/activesupport.rb",
|
36
|
-
"lib/knj/autoload/backups/facets_dictionary.rb",
|
37
|
-
"lib/knj/autoload/backups/parsedate.rb",
|
38
|
-
"lib/knj/autoload/backups/ping.rb",
|
39
|
-
"lib/knj/autoload/cinch.rb",
|
40
|
-
"lib/knj/autoload/erubis.rb",
|
41
|
-
"lib/knj/autoload/facebooker.rb",
|
42
|
-
"lib/knj/autoload/facets_dictionary.rb",
|
43
|
-
"lib/knj/autoload/gd2.rb",
|
44
|
-
"lib/knj/autoload/gettext.rb",
|
45
|
-
"lib/knj/autoload/gtk2.rb",
|
46
|
-
"lib/knj/autoload/json.rb",
|
47
|
-
"lib/knj/autoload/magick.rb",
|
48
|
-
"lib/knj/autoload/mysql.rb",
|
49
|
-
"lib/knj/autoload/parsedate.rb",
|
50
|
-
"lib/knj/autoload/ping.rb",
|
51
|
-
"lib/knj/autoload/rexml.rb",
|
52
|
-
"lib/knj/autoload/soap.rb",
|
53
|
-
"lib/knj/autoload/sqlite3.rb",
|
54
|
-
"lib/knj/autoload/tmail.rb",
|
55
|
-
"lib/knj/autoload/tzinfo.rb",
|
56
|
-
"lib/knj/autoload/wref.rb",
|
57
|
-
"lib/knj/autoload/xmlsimple.rb",
|
58
|
-
"lib/knj/autoload/zip.rb",
|
59
|
-
"lib/knj/cmd_gen.rb",
|
60
|
-
"lib/knj/cmd_parser.rb",
|
61
|
-
"lib/knj/compiler.rb",
|
62
|
-
"lib/knj/cpufreq.rb",
|
63
|
-
"lib/knj/csv.rb",
|
64
|
-
"lib/knj/degulesider.rb",
|
65
|
-
"lib/knj/erb/apache_knjerb.conf",
|
66
|
-
"lib/knj/erb/cache/README",
|
67
|
-
"lib/knj/erb/erb.rb",
|
68
|
-
"lib/knj/erb/erb_1.9.rb",
|
69
|
-
"lib/knj/erb/erb_cache_clean.rb",
|
70
|
-
"lib/knj/erb/erb_fcgi.rb",
|
71
|
-
"lib/knj/erb/erb_fcgi_1.9.rb",
|
72
|
-
"lib/knj/erb/erb_fcgi_jruby.rb",
|
73
|
-
"lib/knj/erb/erb_jruby.rb",
|
74
|
-
"lib/knj/erb/include.rb",
|
75
|
-
"lib/knj/errors.rb",
|
76
|
-
"lib/knj/eruby.rb",
|
77
|
-
"lib/knj/event_filemod.rb",
|
78
|
-
"lib/knj/event_handler.rb",
|
79
|
-
"lib/knj/exchangerates.rb",
|
80
|
-
"lib/knj/facebook_connect.rb",
|
81
|
-
"lib/knj/filesystem.rb",
|
82
|
-
"lib/knj/fs/drivers/filesystem.rb",
|
83
|
-
"lib/knj/fs/drivers/ftp.rb",
|
84
|
-
"lib/knj/fs/drivers/ssh.rb",
|
85
|
-
"lib/knj/fs/fs.rb",
|
86
|
-
"lib/knj/gettext_fallback.rb",
|
87
|
-
"lib/knj/gettext_threadded.rb",
|
88
|
-
"lib/knj/google_sitemap.rb",
|
89
|
-
"lib/knj/gtk2.rb",
|
90
|
-
"lib/knj/gtk2_cb.rb",
|
91
|
-
"lib/knj/gtk2_menu.rb",
|
92
|
-
"lib/knj/gtk2_msgbox.rb",
|
93
|
-
"lib/knj/gtk2_statuswindow.rb",
|
94
|
-
"lib/knj/gtk2_tv.rb",
|
95
|
-
"lib/knj/gtk2_window.rb",
|
96
|
-
"lib/knj/hash_methods.rb",
|
97
|
-
"lib/knj/image.rb",
|
98
|
-
"lib/knj/includes/appserver_cli.rb",
|
99
|
-
"lib/knj/includes/require_info.rb",
|
100
|
-
"lib/knj/iotop.rb",
|
101
|
-
"lib/knj/ip2location.rb",
|
102
|
-
"lib/knj/ironruby-gtk2/button.rb",
|
103
|
-
"lib/knj/ironruby-gtk2/dialog.rb",
|
104
|
-
"lib/knj/ironruby-gtk2/entry.rb",
|
105
|
-
"lib/knj/ironruby-gtk2/gdk_event.rb",
|
106
|
-
"lib/knj/ironruby-gtk2/gdk_eventbutton.rb",
|
107
|
-
"lib/knj/ironruby-gtk2/gdk_pixbuf.rb",
|
108
|
-
"lib/knj/ironruby-gtk2/gladexml.rb",
|
109
|
-
"lib/knj/ironruby-gtk2/glib.rb",
|
110
|
-
"lib/knj/ironruby-gtk2/gtk2.rb",
|
111
|
-
"lib/knj/ironruby-gtk2/gtk_builder.rb",
|
112
|
-
"lib/knj/ironruby-gtk2/gtk_cellrenderertext.rb",
|
113
|
-
"lib/knj/ironruby-gtk2/gtk_combobox.rb",
|
114
|
-
"lib/knj/ironruby-gtk2/gtk_filechooserbutton.rb",
|
115
|
-
"lib/knj/ironruby-gtk2/gtk_liststore.rb",
|
116
|
-
"lib/knj/ironruby-gtk2/gtk_menu.rb",
|
117
|
-
"lib/knj/ironruby-gtk2/gtk_menuitem.rb",
|
118
|
-
"lib/knj/ironruby-gtk2/gtk_statusicon.rb",
|
119
|
-
"lib/knj/ironruby-gtk2/gtk_treeiter.rb",
|
120
|
-
"lib/knj/ironruby-gtk2/gtk_treeselection.rb",
|
121
|
-
"lib/knj/ironruby-gtk2/gtk_treeview.rb",
|
122
|
-
"lib/knj/ironruby-gtk2/gtk_treeviewcolumn.rb",
|
123
|
-
"lib/knj/ironruby-gtk2/iconsize.rb",
|
124
|
-
"lib/knj/ironruby-gtk2/image.rb",
|
125
|
-
"lib/knj/ironruby-gtk2/label.rb",
|
126
|
-
"lib/knj/ironruby-gtk2/stock.rb",
|
127
|
-
"lib/knj/ironruby-gtk2/tests/test.glade",
|
128
|
-
"lib/knj/ironruby-gtk2/tests/test_2.rb",
|
129
|
-
"lib/knj/ironruby-gtk2/tests/test_ironruby_window.rb",
|
130
|
-
"lib/knj/ironruby-gtk2/vbox.rb",
|
131
|
-
"lib/knj/ironruby-gtk2/window.rb",
|
132
|
-
"lib/knj/jruby-gtk2/builder.rb",
|
133
|
-
"lib/knj/jruby-gtk2/builder/test_builder.glade",
|
134
|
-
"lib/knj/jruby-gtk2/builder/test_builder.rb",
|
135
|
-
"lib/knj/jruby-gtk2/builder/test_builder.ui",
|
136
|
-
"lib/knj/jruby-gtk2/cellrenderertext.rb",
|
137
|
-
"lib/knj/jruby-gtk2/checkbutton.rb",
|
138
|
-
"lib/knj/jruby-gtk2/combobox.rb",
|
139
|
-
"lib/knj/jruby-gtk2/dialog.rb",
|
140
|
-
"lib/knj/jruby-gtk2/eventbutton.rb",
|
141
|
-
"lib/knj/jruby-gtk2/gladexml.rb",
|
142
|
-
"lib/knj/jruby-gtk2/gtk2.rb",
|
143
|
-
"lib/knj/jruby-gtk2/hbox.rb",
|
144
|
-
"lib/knj/jruby-gtk2/iconsize.rb",
|
145
|
-
"lib/knj/jruby-gtk2/image.rb",
|
146
|
-
"lib/knj/jruby-gtk2/liststore.rb",
|
147
|
-
"lib/knj/jruby-gtk2/menu.rb",
|
148
|
-
"lib/knj/jruby-gtk2/progressbar.rb",
|
149
|
-
"lib/knj/jruby-gtk2/statusicon.rb",
|
150
|
-
"lib/knj/jruby-gtk2/stock.rb",
|
151
|
-
"lib/knj/jruby-gtk2/tests/test_glade_window.glade",
|
152
|
-
"lib/knj/jruby-gtk2/tests/test_glade_window.rb",
|
153
|
-
"lib/knj/jruby-gtk2/tests/test_normal_window.rb",
|
154
|
-
"lib/knj/jruby-gtk2/tests/test_trayicon.png",
|
155
|
-
"lib/knj/jruby-gtk2/tests/test_trayicon.rb",
|
156
|
-
"lib/knj/jruby-gtk2/treeview.rb",
|
157
|
-
"lib/knj/jruby-gtk2/vbox.rb",
|
158
|
-
"lib/knj/jruby-gtk2/window.rb",
|
159
|
-
"lib/knj/jruby_compiler.rb",
|
160
|
-
"lib/knj/knj.rb",
|
161
|
-
"lib/knj/knj_controller.rb",
|
162
|
-
"lib/knj/kvm.rb",
|
163
|
-
"lib/knj/libqt.rb",
|
164
|
-
"lib/knj/libqt_window.rb",
|
165
|
-
"lib/knj/locale_strings.rb",
|
166
|
-
"lib/knj/locales.rb",
|
167
|
-
"lib/knj/maemo/fremantle-calendar/fremantle-calendar.rb",
|
168
|
-
"lib/knj/mail.rb",
|
169
|
-
"lib/knj/mailobj.rb",
|
170
|
-
"lib/knj/memory_analyzer.rb",
|
171
|
-
"lib/knj/mount.rb",
|
172
|
-
"lib/knj/mutexcl.rb",
|
173
|
-
"lib/knj/notify.rb",
|
174
|
-
"lib/knj/nvidia_settings.rb",
|
175
|
-
"lib/knj/objects/objects_sqlhelper.rb",
|
176
|
-
"lib/knj/opts.rb",
|
177
|
-
"lib/knj/os.rb",
|
178
|
-
"lib/knj/php_parser/arguments.rb",
|
179
|
-
"lib/knj/php_parser/functions.rb",
|
180
|
-
"lib/knj/php_parser/php_parser.rb",
|
181
|
-
"lib/knj/php_parser/tests/test.rb",
|
182
|
-
"lib/knj/php_parser/tests/test_function.php",
|
183
|
-
"lib/knj/php_parser/tests/test_function_run.rb",
|
184
|
-
"lib/knj/power_manager.rb",
|
185
|
-
"lib/knj/rand.rb",
|
186
|
-
"lib/knj/rhodes/mutex.rb",
|
187
|
-
"lib/knj/rhodes/rhodes.js",
|
188
|
-
"lib/knj/rhodes/rhodes.rb",
|
189
|
-
"lib/knj/rhodes/youtube_embed.erb",
|
190
|
-
"lib/knj/rhodes/youtube_open.erb",
|
191
|
-
"lib/knj/rsvgbin.rb",
|
192
|
-
"lib/knj/scripts/degulesider.rb",
|
193
|
-
"lib/knj/scripts/filesearch.rb",
|
194
|
-
"lib/knj/scripts/ip2location.rb",
|
195
|
-
"lib/knj/scripts/keepalive.rb",
|
196
|
-
"lib/knj/scripts/php_to_rb_helper.rb",
|
197
|
-
"lib/knj/scripts/speed_test.rb",
|
198
|
-
"lib/knj/scripts/svn_merge.rb",
|
199
|
-
"lib/knj/scripts/upgrade_knjrbfw_checker.rb",
|
200
|
-
"lib/knj/sms.rb",
|
201
|
-
"lib/knj/sshrobot.rb",
|
202
|
-
"lib/knj/sshrobot/sshrobot.rb",
|
203
|
-
"lib/knj/strings.rb",
|
204
|
-
"lib/knj/sysuser.rb",
|
205
|
-
"lib/knj/table_writer.rb",
|
206
|
-
"lib/knj/tests/compiler/compiler_test.rb",
|
207
|
-
"lib/knj/tests/compiler/compiler_test_file.rb",
|
208
|
-
"lib/knj/tests/test_degulesider.rb",
|
209
|
-
"lib/knj/tests/test_http2.rb",
|
210
|
-
"lib/knj/tests/test_http2_proxy.rb",
|
211
|
-
"lib/knj/tests/test_mount.rb",
|
212
|
-
"lib/knj/thread.rb",
|
213
|
-
"lib/knj/thread2.rb",
|
214
|
-
"lib/knj/threadhandler.rb",
|
215
|
-
"lib/knj/unix_proc.rb",
|
216
|
-
"lib/knj/web.rb",
|
217
|
-
"lib/knj/webscripts/image.rhtml",
|
218
|
-
"lib/knj/webscripts/image_subproc.rhtml",
|
219
|
-
"lib/knj/win.rb",
|
220
|
-
"lib/knj/win_registry.rb",
|
221
|
-
"lib/knj/win_tightvnc.rb",
|
222
|
-
"lib/knj/x11vnc.rb",
|
223
|
-
"lib/knj/youtube.rb",
|
224
|
-
"lib/knjrbfw.rb",
|
225
|
-
"spec/amixer_spec.rb",
|
226
|
-
"spec/arrayext_spec.rb",
|
227
|
-
"spec/autoload_spec.rb",
|
228
|
-
"spec/cmd_parser_spec.rb",
|
229
|
-
"spec/knjrbfw_spec.rb",
|
230
|
-
"spec/locales_spec.rb",
|
231
|
-
"spec/spec_helper.rb",
|
232
|
-
"spec/strings_spec.rb",
|
233
|
-
"spec/web_spec.rb",
|
234
|
-
"testfiles/image.jpg"
|
235
|
-
]
|
236
|
-
s.homepage = "http://github.com/kaspernj/knjrbfw"
|
237
|
-
s.licenses = ["MIT"]
|
238
|
-
s.rubygems_version = "2.4.0"
|
239
|
-
s.summary = "A framework with lots of stuff for Ruby."
|
240
|
-
|
241
|
-
if s.respond_to? :specification_version then
|
242
|
-
s.specification_version = 4
|
243
|
-
|
244
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
245
|
-
s.add_runtime_dependency(%q<wref>, [">= 0.0.8"])
|
246
|
-
s.add_runtime_dependency(%q<tsafe>, [">= 0"])
|
247
|
-
s.add_runtime_dependency(%q<datet>, [">= 0"])
|
248
|
-
s.add_runtime_dependency(%q<http2>, [">= 0"])
|
249
|
-
s.add_runtime_dependency(%q<php4r>, [">= 0"])
|
250
|
-
s.add_runtime_dependency(%q<ruby_process>, [">= 0"])
|
251
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
252
|
-
s.add_development_dependency(%q<bundler>, [">= 0"])
|
253
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
254
|
-
s.add_development_dependency(%q<sqlite3>, [">= 0"])
|
255
|
-
s.add_development_dependency(%q<rmagick>, [">= 0"])
|
256
|
-
s.add_development_dependency(%q<array_enumerator>, [">= 0"])
|
257
|
-
else
|
258
|
-
s.add_dependency(%q<wref>, [">= 0.0.8"])
|
259
|
-
s.add_dependency(%q<tsafe>, [">= 0"])
|
260
|
-
s.add_dependency(%q<datet>, [">= 0"])
|
261
|
-
s.add_dependency(%q<http2>, [">= 0"])
|
262
|
-
s.add_dependency(%q<php4r>, [">= 0"])
|
263
|
-
s.add_dependency(%q<ruby_process>, [">= 0"])
|
264
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
265
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
266
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
267
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
268
|
-
s.add_dependency(%q<rmagick>, [">= 0"])
|
269
|
-
s.add_dependency(%q<array_enumerator>, [">= 0"])
|
270
|
-
end
|
271
|
-
else
|
272
|
-
s.add_dependency(%q<wref>, [">= 0.0.8"])
|
273
|
-
s.add_dependency(%q<tsafe>, [">= 0"])
|
274
|
-
s.add_dependency(%q<datet>, [">= 0"])
|
275
|
-
s.add_dependency(%q<http2>, [">= 0"])
|
276
|
-
s.add_dependency(%q<php4r>, [">= 0"])
|
277
|
-
s.add_dependency(%q<ruby_process>, [">= 0"])
|
278
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
279
|
-
s.add_dependency(%q<bundler>, [">= 0"])
|
280
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
281
|
-
s.add_dependency(%q<sqlite3>, [">= 0"])
|
282
|
-
s.add_dependency(%q<rmagick>, [">= 0"])
|
283
|
-
s.add_dependency(%q<array_enumerator>, [">= 0"])
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
data/lib/knj/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
erb/cache/*
|
@@ -1,135 +0,0 @@
|
|
1
|
-
class Knj::SSHRobot
|
2
|
-
def initialize(args)
|
3
|
-
require "net/ssh"
|
4
|
-
|
5
|
-
@forwards = []
|
6
|
-
@args = Knj::ArrayExt.hash_sym(args)
|
7
|
-
@args[:port] = 22 if !@args.key?(:port)
|
8
|
-
|
9
|
-
if block_given?
|
10
|
-
begin
|
11
|
-
yield(self)
|
12
|
-
ensure
|
13
|
-
self.close
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
#Spawns a session if it hasnt already been spawned and returns it.
|
19
|
-
def session
|
20
|
-
@session = self.session_spawn if !@session
|
21
|
-
return @session
|
22
|
-
end
|
23
|
-
|
24
|
-
#Spawns a new net-ssh-instance.
|
25
|
-
def session_spawn
|
26
|
-
return Net::SSH.start(@args[:host], @args[:user], :password => @args[:passwd], :port => @args[:port].to_i)
|
27
|
-
end
|
28
|
-
|
29
|
-
#Returns the a shell-session.
|
30
|
-
def shell
|
31
|
-
return self.session.shell.sync
|
32
|
-
end
|
33
|
-
|
34
|
-
def sftp
|
35
|
-
@sftp = Net::SFTP.start(@args[:host], @args[:user], @args[:passwd], :port => @args[:port].to_i)
|
36
|
-
end
|
37
|
-
|
38
|
-
#Executes a command.
|
39
|
-
def exec(command, &block)
|
40
|
-
if block
|
41
|
-
return self.session.exec!(command) do |channel, stream, line|
|
42
|
-
block.call(:channel => channel, :stream => stream, :line => line)
|
43
|
-
end
|
44
|
-
else
|
45
|
-
return self.session.exec!(command)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
#Executes a command as "root" via "sudo". Accepts the "sudo"-password and a command.
|
50
|
-
def sudo_exec(sudo_passwd, command)
|
51
|
-
result = ""
|
52
|
-
|
53
|
-
self.session.open_channel do |ch|
|
54
|
-
ch.request_pty
|
55
|
-
|
56
|
-
ch.exec("sudo #{command}") do |ch, success|
|
57
|
-
ch.on_data do |ch, data|
|
58
|
-
if data =~ /^\[sudo\] password for (.+):\s*$/
|
59
|
-
ch.send_data("#{sudo_passwd}\n")
|
60
|
-
else
|
61
|
-
result << data
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
self.session.loop
|
68
|
-
return result
|
69
|
-
end
|
70
|
-
|
71
|
-
def fileExists(filepath)
|
72
|
-
result = self.exec("ls #{Strings.UnixSafe(filepath)}").strip
|
73
|
-
return true if result == filepath
|
74
|
-
return false
|
75
|
-
end
|
76
|
-
|
77
|
-
def forward(args)
|
78
|
-
Knj::ArrayExt.hash_sym(args)
|
79
|
-
args[:type] = "local" if !args[:type]
|
80
|
-
args[:session] = self.session_spawn if !args[:session]
|
81
|
-
args[:host_local] = "0.0.0.0" if !args[:host_local]
|
82
|
-
return SSHRobot::Forward.new(args)
|
83
|
-
end
|
84
|
-
|
85
|
-
alias getShell shell
|
86
|
-
alias getSFTP sftp
|
87
|
-
alias shellCMD exec
|
88
|
-
|
89
|
-
def close
|
90
|
-
@session.close if @session
|
91
|
-
@session = nil
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
class Knj::SSHRobot::Forward
|
96
|
-
attr_reader :open
|
97
|
-
|
98
|
-
def initialize(args)
|
99
|
-
@open = true
|
100
|
-
@args = args
|
101
|
-
@thread = Knj::Thread.new do
|
102
|
-
begin
|
103
|
-
#args[:session].logger.sev_threshold = Logger::Severity::DEBUG
|
104
|
-
if args[:type] == "local"
|
105
|
-
@args[:session].forward.local(@args[:host_local], @args[:port_local].to_i, @args[:host], @args[:port_remote].to_i)
|
106
|
-
elsif args[:type] == "remote"
|
107
|
-
@args[:session].forward.remote_to(@args[:port_local], @args[:host], @args[:port_remote], @args[:host_local])
|
108
|
-
else
|
109
|
-
raise "No valid type given."
|
110
|
-
end
|
111
|
-
|
112
|
-
@args[:session].loop do
|
113
|
-
true
|
114
|
-
end
|
115
|
-
rescue => e
|
116
|
-
puts e.inspect
|
117
|
-
puts e.backtrace
|
118
|
-
|
119
|
-
@open = false
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def close
|
125
|
-
if !@args
|
126
|
-
return nil
|
127
|
-
end
|
128
|
-
|
129
|
-
@args[:session].close
|
130
|
-
@open = false
|
131
|
-
@thread.exit
|
132
|
-
@args = nil
|
133
|
-
@thread = nil
|
134
|
-
end
|
135
|
-
end
|
data/lib/knj/sshrobot.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "#{$knjpath}sshrobot/sshrobot"
|
data/spec/amixer_spec.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Amixer" do
|
4
|
-
it "should load by using autoload" do
|
5
|
-
if Knj::Os.os == "linux"
|
6
|
-
require "knjrbfw"
|
7
|
-
$amixer = Knj::Amixer.new
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should register various devices" do
|
12
|
-
if Knj::Os.os == "linux"
|
13
|
-
$devices = $amixer.devices
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should register various mixers and do various operations on them" do
|
18
|
-
if Knj::Os.os == "linux"
|
19
|
-
$devices.each do |name, device|
|
20
|
-
mixers = device.mixers
|
21
|
-
|
22
|
-
if device.active?(:stream => "PLAYBACK")
|
23
|
-
mixers.each do |name, mixer|
|
24
|
-
next if !mixer.volume?
|
25
|
-
mixer.vol_add -5
|
26
|
-
mixer.vol_add 3
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/spec/arrayext_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "ArrayExt" do
|
4
|
-
it "should be able to do powersets" do
|
5
|
-
ps = Knj::ArrayExt.powerset(:arr => [1, 2, 3, 4]).to_a
|
6
|
-
raise "Expected length of 16 but it wasnt: #{ps.length}" if ps.length != 16
|
7
|
-
|
8
|
-
ite = 0
|
9
|
-
Knj::ArrayExt.powerset(:arr => [1, 2, 3, 4]) do |arr|
|
10
|
-
ite += 1
|
11
|
-
end
|
12
|
-
|
13
|
-
raise "Expected block to be executed 16 times but it wasnt: #{ite}" if ite != 16
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should be able to divide arrays" do
|
17
|
-
arr = [1, 2, 3, 4, 6, 7, 8, 9, 15, 16, 17, 18]
|
18
|
-
res = Knj::ArrayExt.divide(:arr => arr) do |a, b|
|
19
|
-
if (b - a) > 1
|
20
|
-
false
|
21
|
-
else
|
22
|
-
true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
raise "Expected length of 3 but it wasnt: #{res.length}" if res.length != 3
|
27
|
-
raise "Expected length of 4 but it wasnt: #{res[0].length}" if res[0].length != 4
|
28
|
-
raise "Expected length of 3 but it wasnt: #{res[1].length}" if res[1].length != 3
|
29
|
-
raise "Expected length of 3 but it wasnt: #{res[2].length}" if res[2].length != 3
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should be able to make ago-strings" do
|
33
|
-
arr = [1, 2]
|
34
|
-
Knj::ArrayExt.force_no_cols(:arr => arr, :no => 1)
|
35
|
-
raise "Expected length of 1 but got: #{arr.length}" if arr.length != 1
|
36
|
-
raise "Expected element to be 1 but it wasnt: #{arr[0]}" if arr[0] != 1
|
37
|
-
|
38
|
-
Knj::ArrayExt.force_no_cols(:arr => arr, :no => 3, :empty => "test")
|
39
|
-
raise "Expected length of 3 but got: #{arr.lengtj}" if arr.length != 3
|
40
|
-
raise "Expected element 2 to be 'test' but it wasnt: #{arr[2]}" if arr[2] != "test"
|
41
|
-
end
|
42
|
-
end
|
data/spec/autoload_spec.rb
DELETED
data/spec/cmd_parser_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Cmd_parser" do
|
4
|
-
it "should be able to parse various strings" do
|
5
|
-
require "knjrbfw"
|
6
|
-
require "knj/cmd_parser"
|
7
|
-
require "php4r" if !Kernel.const_defined?(:Php4r)
|
8
|
-
|
9
|
-
strs = [
|
10
|
-
"-rw-r--r-- 1 admin administ 186.3M Aug 30 18:09 b4u_synoptik_2011_08_30_17_57_32.sql.gz\n",
|
11
|
-
"-rw-r--r-- 1 admin administ 2 Nov 21 18:12 test\n",
|
12
|
-
"-rw-r--r-- 1 kaspernj kaspernj 279943393 2011-07-27 09:28 dbdump_2011_07_27_03_07_36.sql\n",
|
13
|
-
"-rw-rw-r-- 1 kaspernj kaspernj 58648 2011-10-28 18:33 2011-11-28 - Programmerings aften hos Anders - mad - 600 kr.pdf\n",
|
14
|
-
"-rw-r--r-- 1 www-data www-data 4,0K 2011-05-16 23:21 dbbackup_2011_05_16-23:21:10.sql.gz\n"
|
15
|
-
]
|
16
|
-
|
17
|
-
strs.each do |str|
|
18
|
-
res = Knj::Cmd_parser.lsl(str)
|
19
|
-
|
20
|
-
res.each do |file|
|
21
|
-
raise "Byte was not numeric in: '#{str}'." if !(Float(file[:size]) rescue false)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/spec/knjrbfw_spec.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Knjrbfw" do
|
4
|
-
it "should be able to join arrays with callbacks." do
|
5
|
-
res = Knj::ArrayExt.join(:arr => [1, 2, 3], :sep => ",", :callback => proc{|value| "'#{value}'"})
|
6
|
-
raise "Unexpected result from ArrayExt." if res != "'1','2','3'"
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should be able to draw rounded transparent corners on images." do
|
10
|
-
require "rubygems"
|
11
|
-
require "RMagick"
|
12
|
-
|
13
|
-
pic = Magick::Image.read("#{File.dirname(__FILE__)}/../testfiles/image.jpg").first
|
14
|
-
pic.format = "png"
|
15
|
-
|
16
|
-
Knj::Image.rounded_corners(
|
17
|
-
:img => pic,
|
18
|
-
:radius => 10
|
19
|
-
)
|
20
|
-
|
21
|
-
blob_cont = pic.to_blob
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should be possible to use Strings.html_links-method." do
|
25
|
-
teststr = "This is a test. http://www.google.com This is a test."
|
26
|
-
|
27
|
-
#Test normal usage.
|
28
|
-
test1 = Knj::Strings.html_links(teststr)
|
29
|
-
raise "Unexpected string: '#{teststr}'" if test1 != "This is a test. <a href=\"http://www.google.com\">http://www.google.com</a> This is a test."
|
30
|
-
|
31
|
-
|
32
|
-
#Test with a block.
|
33
|
-
test2 = Knj::Strings.html_links(teststr) do |data|
|
34
|
-
data[:str].gsub(data[:match][0], "TEST")
|
35
|
-
end
|
36
|
-
|
37
|
-
raise "Unexpected string: '#{test2}'." if test2 != "This is a test. TEST This is a test."
|
38
|
-
end
|
39
|
-
|
40
|
-
=begin
|
41
|
-
it "should be able to use Knj::Mutexcl with advanced arguments." do
|
42
|
-
mutex = Knj::Mutexcl.new(
|
43
|
-
:modes => {
|
44
|
-
:reader => {
|
45
|
-
:blocks => [:writer]
|
46
|
-
},
|
47
|
-
:writer => {
|
48
|
-
:blocks => [:reader, :writer]
|
49
|
-
}
|
50
|
-
}
|
51
|
-
)
|
52
|
-
|
53
|
-
$count = 0
|
54
|
-
|
55
|
-
Knj::Thread.new do
|
56
|
-
mutex.sync(:reader) do
|
57
|
-
sleep 0.2
|
58
|
-
$count += 1
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
mutex.sync(:reader) do
|
63
|
-
$count += 1
|
64
|
-
end
|
65
|
-
|
66
|
-
raise "Count should be 1 by now but it wasnt: '#{$count}'." if $count != 1
|
67
|
-
sleep 0.3
|
68
|
-
raise "Count should be 2 by now but it wasnt: '#{$count}'." if $count != 2
|
69
|
-
|
70
|
-
|
71
|
-
$count = 0
|
72
|
-
Knj::Thread.new do
|
73
|
-
mutex.sync(:reader) do
|
74
|
-
sleep 2
|
75
|
-
$count += 1
|
76
|
-
end
|
77
|
-
end
|
78
|
-
sleep 0.1
|
79
|
-
|
80
|
-
Knj::Thread.new do
|
81
|
-
mutex.sync(:writer) do
|
82
|
-
$count += 1
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
sleep 1
|
87
|
-
raise "Count should be 0 but it wasnt: '#{$count}'." if $count != 0
|
88
|
-
sleep 1.1
|
89
|
-
raise "Count should be 2 but it wasnt: '#{$count}'." if $count != 2
|
90
|
-
|
91
|
-
Knj::Thread.new do
|
92
|
-
mutex.sync(:reader) do
|
93
|
-
sleep 0.2
|
94
|
-
$count += 1
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
Knj::Thread.new do
|
99
|
-
mutex.sync(:reader) do
|
100
|
-
sleep 0.2
|
101
|
-
$count += 1
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
sleep 0.35
|
106
|
-
raise "Count should be 4 but it wasnt: '#{$count}'." if $count != 4
|
107
|
-
end
|
108
|
-
=end
|
109
|
-
end
|
data/spec/locales_spec.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Locales" do
|
4
|
-
it "should do convertions of short formats" do
|
5
|
-
Thread.current[:locale] = "en"
|
6
|
-
res = Knj::Locales.lang
|
7
|
-
raise "Result wasnt as expected: '#{res}'." if res["first"] != "en" or res["second"] != "GB" or res["full"] != "en_GB"
|
8
|
-
end
|
9
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'knjrbfw'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|
data/spec/strings_spec.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
require "knj/strings"
|
4
|
-
require "knj/errors"
|
5
|
-
|
6
|
-
describe "Strings" do
|
7
|
-
it "regex" do
|
8
|
-
regex = Knj::Strings.regex("/(\d+)/i")
|
9
|
-
raise "Regex should be '(?i-mx:(d+))' but wasnt: '#{regex}'." if "#{regex}" != "(?i-mx:(d+))"
|
10
|
-
|
11
|
-
regex = Knj::Strings.regex("/\d+/")
|
12
|
-
raise "Regex should be '(?-mix:d+)' but wasnt: '#{regex}'." if "#{regex}" != "(?-mix:d+)"
|
13
|
-
|
14
|
-
begin
|
15
|
-
regex = Knj::Strings.regex("/\d+/U")
|
16
|
-
raise "Ruby doesnt support the U-modifier - an exception should be thrown!"
|
17
|
-
rescue ArgumentError
|
18
|
-
#this should happen - Ruby doesnt support U-modifier...
|
19
|
-
end
|
20
|
-
|
21
|
-
regex = Knj::Strings.regex("/(\\d{6})$/")
|
22
|
-
res = "FNR. 7213820".match(regex)
|
23
|
-
raise "Not matched." if !res
|
24
|
-
raise "Expected result 1 to be '213820' but it wasnt: '#{res[1]}'." if res[1] != "213820"
|
25
|
-
|
26
|
-
res = Knj::Strings.is_regex?("Kasper")
|
27
|
-
raise "Expected res to be false but it wasnt." if res
|
28
|
-
|
29
|
-
res = Knj::Strings.is_regex?("/^Kasper$/")
|
30
|
-
raise "Expected res to be true but it wasnt." if !res
|
31
|
-
end
|
32
|
-
|
33
|
-
it "secs_to_human_time_str" do
|
34
|
-
res = Knj::Strings.secs_to_human_time_str(3695)
|
35
|
-
raise "Expected '01:01:35' but got: '#{res}'." if res != "01:01:35"
|
36
|
-
|
37
|
-
secs = Knj::Strings.human_time_str_to_secs("01:30:30")
|
38
|
-
raise "Expected secs to be 5430 but it was #{secs}" if secs != 5430
|
39
|
-
|
40
|
-
secs = Knj::Strings.human_time_str_to_secs("01:30")
|
41
|
-
raise "Expected secs to be 5400 but it was #{secs}" if secs != 5400
|
42
|
-
end
|
43
|
-
|
44
|
-
it "secs_to_human_short_time" do
|
45
|
-
res = Knj::Strings.secs_to_human_short_time(3700)
|
46
|
-
raise "Expected '1.0t' but got '#{res}'." if res != "1.0t"
|
47
|
-
|
48
|
-
res = Knj::Strings.secs_to_human_short_time(57)
|
49
|
-
raise "Expected '57s' but got '#{res}'." if res != "57s"
|
50
|
-
|
51
|
-
res = Knj::Strings.secs_to_human_short_time(185)
|
52
|
-
raise "Expected '3m' but got '#{res}'." if res != "3m"
|
53
|
-
|
54
|
-
res = Knj::Strings.secs_to_human_short_time(57, :secs => false)
|
55
|
-
raise "Expected '0m' but got '#{res}'." if res != "0m"
|
56
|
-
|
57
|
-
res = Knj::Strings.secs_to_human_short_time(120, :mins => false)
|
58
|
-
raise "Expected '0.0t' but got '#{res}'." if res != "0.0t"
|
59
|
-
end
|
60
|
-
|
61
|
-
it "sanitize_filename" do
|
62
|
-
res = Knj::Strings.sanitize_filename('1\2 3/4')
|
63
|
-
res.should eql("1_2_3_4")
|
64
|
-
end
|
65
|
-
end
|
data/spec/web_spec.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Web" do
|
4
|
-
it "should be able to parse url and generate hashes" do
|
5
|
-
require "php4r" if !Kernel.const_defined?(:Php4r)
|
6
|
-
require "knj/web"
|
7
|
-
|
8
|
-
url = "first=test&#{Knj::Web.urlenc("second[trala][]")}=1&#{Knj::Web.urlenc("second[trala][]")}=2&#{Knj::Web.urlenc("second[trala][]")}=3"
|
9
|
-
res = Knj::Web.parse_urlquery(url)
|
10
|
-
|
11
|
-
raise "Couldnt parse 'first'-element." if res["first"] != "test"
|
12
|
-
raise "'second' wasnt a hash or contained invalid amounr of elements." if !res["second"].is_a?(Hash) or res["second"].length != 1
|
13
|
-
raise "'trala' in 'second' wasnt a hash or contained invalid amount of elements." if !res["second"]["trala"].is_a?(Hash) or res["second"]["trala"].length != 3
|
14
|
-
raise "'trala' in 'second' didnt contain the right elements." if res["second"]["trala"]["0"] != "1" or res["second"]["trala"]["1"] != "2" or res["second"]["trala"]["2"] != "3"
|
15
|
-
end
|
16
|
-
|
17
|
-
#Moved from "knjrbfw_spec.rb".
|
18
|
-
it "should be able to use alert and back." do
|
19
|
-
Knj::Web.alert("Trala")
|
20
|
-
|
21
|
-
begin
|
22
|
-
Knj::Web.back
|
23
|
-
raise "It should have called exit which it didnt."
|
24
|
-
rescue SystemExit
|
25
|
-
#ignore.
|
26
|
-
end
|
27
|
-
|
28
|
-
begin
|
29
|
-
Knj::Web.redirect("?show=test")
|
30
|
-
raise "It should have called exit which it didnt."
|
31
|
-
rescue SystemExit
|
32
|
-
#ignore.
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should be able to properly parse 'Set-Cookie' headers." do
|
37
|
-
data = Knj::Web.parse_set_cookies("TestCookie=TestValue+; Expires=Fri, 05 Aug 2011 10:58:17 GMT; Path=\n")
|
38
|
-
|
39
|
-
raise "No data returned?" if !data or !data.respond_to?(:length)
|
40
|
-
raise "Wrong number of cookies returned: '#{data.length}'." if data.length != 1
|
41
|
-
|
42
|
-
raise "Unexpected name: '#{data[0]["name"]}'." if data[0]["name"] != "TestCookie"
|
43
|
-
raise "Unexpected value: '#{data[0]["value"]}'." if data[0]["value"] != "TestValue "
|
44
|
-
raise "Unexpected path: '#{data[0]["path"]}'." if data[0]["path"] != ""
|
45
|
-
raise "Unexpected expire:' #{data[0]["expire"]}'." if data[0]["expires"] != "Fri, 05 Aug 2011 10:58:17 GMT"
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should be able to execute various forms of Web.input methods." do
|
49
|
-
html = Knj::Web.inputs([{
|
50
|
-
:title => "Test 1",
|
51
|
-
:name => :textest1,
|
52
|
-
:type => :text,
|
53
|
-
:default => "hmm",
|
54
|
-
:value => "trala"
|
55
|
-
},{
|
56
|
-
:title => "Test 2",
|
57
|
-
:name => :chetest2,
|
58
|
-
:type => :checkbox,
|
59
|
-
:default => true
|
60
|
-
},{
|
61
|
-
:title => "Test 4",
|
62
|
-
:name => :textest4,
|
63
|
-
:type => :textarea,
|
64
|
-
:height => 300,
|
65
|
-
:default => "Hmm",
|
66
|
-
:value => "Trala"
|
67
|
-
},{
|
68
|
-
:title => "Test 5",
|
69
|
-
:name => :filetest5,
|
70
|
-
:type => :file
|
71
|
-
},{
|
72
|
-
:title => "Test 6",
|
73
|
-
:type => :info,
|
74
|
-
:value => "Argh"
|
75
|
-
}])
|
76
|
-
end
|
77
|
-
end
|
data/testfiles/image.jpg
DELETED
Binary file
|