knjrbfw 0.0.113 → 0.0.115
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 +5 -5
- data/Rakefile +0 -14
- data/lib/knj/autoload/magick.rb +2 -2
- data/lib/knj/event_handler.rb +16 -16
- data/lib/knj/image.rb +1 -3
- data/lib/knj/web.rb +0 -10
- data/lib/knj/webscripts/image_subproc.rhtml +39 -39
- 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
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
|