sleipnir-api 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +32 -0
- data/Manifest.txt +20 -3
- data/Rakefile +11 -1
- data/TODO.txt +4 -10
- data/bin/grepnir +1 -1
- data/examples/close_dup.rb +1 -1
- data/examples/close_err.rb +12 -0
- data/examples/command_list.rb +135 -0
- data/examples/open_last_url_by_firefox.rb +44 -0
- data/examples/open_selected_links.rb +40 -0
- data/helper/rake.rb +3 -57
- data/helper/rake/rake.rb +58 -0
- data/helper/{rake_sh_filter.rb → rake/rake_sh_filter.rb} +0 -0
- data/helper/{util.rb → rake/util.rb} +0 -0
- data/lib/sleipnir_api/cli/grepnir.rb +2 -3
- data/lib/sleipnir_api/command.rb +126 -0
- data/lib/sleipnir_api/commands.rb +264 -0
- data/lib/sleipnir_api/profile.rb +166 -27
- data/lib/sleipnir_api/profile/ini.rb +202 -0
- data/lib/sleipnir_api/profile/key.rb +120 -0
- data/lib/sleipnir_api/profile/section.rb +147 -0
- data/lib/sleipnir_api/profile/util.rb +82 -0
- data/lib/sleipnir_api/searcher.rb +133 -0
- data/lib/sleipnir_api/security.rb +88 -18
- data/lib/sleipnir_api/sleipnir.rb +91 -7
- data/lib/sleipnir_api/tab.rb +68 -2
- data/lib/sleipnir_api/tabbed_ie.rb +33 -0
- data/lib/sleipnir_api/util.rb +25 -0
- data/lib/sleipnir_api/version.rb +2 -2
- data/scripts/gesture2rb.rb +42 -0
- data/scripts/make_gesture.rb +271 -0
- data/scripts/subcategory.csv +253 -0
- data/spec/sleipnir_api/profile_mock_spec.rb +80 -6
- data/spec/sleipnir_api/profile_section_mock_spec.rb +143 -0
- data/spec/sleipnir_api/profile_spec.rb +191 -0
- data/spec/sleipnir_api/security_spec.rb +58 -0
- data/spec/sleipnir_api/tab_mock_spec.rb +0 -5
- data/spec/sleipnir_api/tab_spec.rb +27 -0
- data/spec/spec_helper.rb +20 -0
- metadata +22 -5
- data/helper/helper.rb +0 -3
@@ -86,6 +86,42 @@ describe SleipnirAPI::Security do
|
|
86
86
|
|
87
87
|
end
|
88
88
|
|
89
|
+
it "#enable! / #disable! should update security config" do
|
90
|
+
def @security.select_enable
|
91
|
+
select{|e| e.enable? }.map{|e| e.name }
|
92
|
+
end
|
93
|
+
@security.each{|e| e.disable! }
|
94
|
+
@security.select_enable.should be_empty
|
95
|
+
|
96
|
+
|
97
|
+
@security.enable!(:java)
|
98
|
+
@security.select_enable.should == [:java]
|
99
|
+
|
100
|
+
@security.enable!(:picture, :sound, :video)
|
101
|
+
@security.select_enable.should == [:java, :picture, :sound, :video]
|
102
|
+
|
103
|
+
@security.enable!(:all)
|
104
|
+
@security.select_enable.should == @security.keys
|
105
|
+
end
|
106
|
+
|
107
|
+
it "#enable! / #disable! should update security config" do
|
108
|
+
def @security.select_enable
|
109
|
+
select{|e| e.enable? }.map{|e| e.name }
|
110
|
+
end
|
111
|
+
@security.each{|e| e.enable! }
|
112
|
+
@security.select_enable.should == @security.keys
|
113
|
+
|
114
|
+
|
115
|
+
@security.disable!(:java)
|
116
|
+
@security.select_enable.should == [:javascript, :run_activex, :download_activex, :picture, :sound, :video]
|
117
|
+
|
118
|
+
@security.disable!(:picture, :sound, :video)
|
119
|
+
@security.select_enable.should == [:javascript, :run_activex, :download_activex]
|
120
|
+
|
121
|
+
@security.disable!(:all)
|
122
|
+
@security.select_enable.should be_empty
|
123
|
+
end
|
124
|
+
|
89
125
|
it "#enable? should return properly." do
|
90
126
|
@security.enable?(:javascript).should be_true
|
91
127
|
@security.enable?(:java).should be_false
|
@@ -96,6 +132,17 @@ describe SleipnirAPI::Security do
|
|
96
132
|
@security.enable?(:video).should be_true
|
97
133
|
end
|
98
134
|
|
135
|
+
it "#enable? can take multiple arguments." do
|
136
|
+
@security.enable?(:javascript, :run_activex).should be_true
|
137
|
+
@security.enable?(:javascript, :java, :sound).should be_false
|
138
|
+
@security.enable?(:sound, :video).should be_false
|
139
|
+
@security.enable?(:sound, :java).should be_false
|
140
|
+
|
141
|
+
@security.enable?(:all).should be_false
|
142
|
+
@security.enable!(:all)
|
143
|
+
@security.enable?(:all).should be_true
|
144
|
+
end
|
145
|
+
|
99
146
|
it "#disable? should return properly." do
|
100
147
|
@security.disable?(:javascript).should be_false
|
101
148
|
@security.disable?(:java).should be_true
|
@@ -106,6 +153,17 @@ describe SleipnirAPI::Security do
|
|
106
153
|
@security.disable?(:video).should be_false
|
107
154
|
end
|
108
155
|
|
156
|
+
it "#disable? can take multiple arguments." do
|
157
|
+
@security.disable?(:javascript, :run_activex).should be_false
|
158
|
+
@security.disable?(:javascript, :java, :sound).should be_false
|
159
|
+
@security.disable?(:sound, :video).should be_false
|
160
|
+
@security.disable?(:sound, :java).should be_true
|
161
|
+
|
162
|
+
@security.disable?(:all).should be_false
|
163
|
+
@security.disable!(:all)
|
164
|
+
@security.disable?(:all).should be_true
|
165
|
+
end
|
166
|
+
|
109
167
|
it "#<security> should return Security::Config." do
|
110
168
|
@security.javascript.should be_an_instance_of(SleipnirAPI::Security::Config)
|
111
169
|
@security.java.should be_an_instance_of(SleipnirAPI::Security::Config)
|
@@ -63,11 +63,6 @@ describe SleipnirAPI::Tab, "(with mock)" do
|
|
63
63
|
@blank.navigate("about:foobar")
|
64
64
|
end
|
65
65
|
|
66
|
-
it "#search should send Search" do
|
67
|
-
@mock.should_receive(:Search).with(@blank.id, "keyword")
|
68
|
-
@blank.search("keyword")
|
69
|
-
end
|
70
|
-
|
71
66
|
it "#hilight should send Hilight" do
|
72
67
|
@mock.should_receive(:Hilight).with(@blank.id, %Q,"keyword",)
|
73
68
|
@blank.hilight("keyword")
|
@@ -115,4 +115,31 @@ describe SleipnirAPI::Tab do
|
|
115
115
|
test.should_not == @test.id
|
116
116
|
end
|
117
117
|
|
118
|
+
it "#watir should return Watir object" do
|
119
|
+
test = @pnir.get_url_tab("about:test")
|
120
|
+
test.watir.should be_an_instance_of(Watir::IE)
|
121
|
+
test.watir.instance_variable_get(:@ie).should be_an_instance_of(SleipnirAPI::TabbedIE)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "#search should select matched keyword" do
|
125
|
+
t1 = @pnir.new_tab("about:foobar")
|
126
|
+
begin
|
127
|
+
t1.selection_text.should be_empty
|
128
|
+
|
129
|
+
r = t1.search("foo")
|
130
|
+
r.should be_true
|
131
|
+
t1.selection_text.should == "foo"
|
132
|
+
|
133
|
+
r = t1.search("bar")
|
134
|
+
r.should be_true
|
135
|
+
t1.selection_text.should == "bar"
|
136
|
+
|
137
|
+
r = t1.search("bar")
|
138
|
+
r.should be_false
|
139
|
+
t1.selection_text.should be_empty
|
140
|
+
ensure
|
141
|
+
t1.close(true)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
118
145
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -23,3 +23,23 @@ module OptionParserSpecHelper
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
|
28
|
+
class FileSaver
|
29
|
+
def initialize(file)
|
30
|
+
@file = file
|
31
|
+
@existed = File.exist?(file)
|
32
|
+
if @existed
|
33
|
+
@content = File.read(file)
|
34
|
+
File.unlink(file)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def restore
|
39
|
+
if @existed
|
40
|
+
File.open(@file, "w") {|w| w.puts @content }
|
41
|
+
else
|
42
|
+
File.unlink(@file) if File.exist?(@file)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: sleipnir-api
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2007-09-23 00:00:00 +09:00
|
8
8
|
summary: Ruby interface to the Sleipnir.API WIN32OLE object.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -37,27 +37,42 @@ files:
|
|
37
37
|
- TODO.txt
|
38
38
|
- bin/grepnir
|
39
39
|
- examples/close_dup.rb
|
40
|
+
- examples/close_err.rb
|
41
|
+
- examples/command_list.rb
|
42
|
+
- examples/open_last_url_by_firefox.rb
|
43
|
+
- examples/open_selected_links.rb
|
40
44
|
- examples/reload.rb
|
41
|
-
- helper/helper.rb
|
42
45
|
- helper/rake.rb
|
43
|
-
- helper/
|
44
|
-
- helper/
|
46
|
+
- helper/rake/rake.rb
|
47
|
+
- helper/rake/rake_sh_filter.rb
|
48
|
+
- helper/rake/util.rb
|
45
49
|
- lib/sleipnir_api.rb
|
46
50
|
- lib/sleipnir_api/cli/base.rb
|
47
51
|
- lib/sleipnir_api/cli/grepnir.rb
|
52
|
+
- lib/sleipnir_api/command.rb
|
53
|
+
- lib/sleipnir_api/commands.rb
|
48
54
|
- lib/sleipnir_api/dialog.rb
|
49
55
|
- lib/sleipnir_api/key_state.rb
|
50
56
|
- lib/sleipnir_api/output.rb
|
51
57
|
- lib/sleipnir_api/process.rb
|
52
58
|
- lib/sleipnir_api/profile.rb
|
59
|
+
- lib/sleipnir_api/profile/ini.rb
|
60
|
+
- lib/sleipnir_api/profile/key.rb
|
61
|
+
- lib/sleipnir_api/profile/section.rb
|
62
|
+
- lib/sleipnir_api/profile/util.rb
|
53
63
|
- lib/sleipnir_api/registry.rb
|
64
|
+
- lib/sleipnir_api/searcher.rb
|
54
65
|
- lib/sleipnir_api/security.rb
|
55
66
|
- lib/sleipnir_api/sleipnir.rb
|
56
67
|
- lib/sleipnir_api/tab.rb
|
68
|
+
- lib/sleipnir_api/tabbed_ie.rb
|
57
69
|
- lib/sleipnir_api/util.rb
|
58
70
|
- lib/sleipnir_api/version.rb
|
59
71
|
- lib/sleipnir_api/win32api.rb
|
72
|
+
- scripts/gesture2rb.rb
|
73
|
+
- scripts/make_gesture.rb
|
60
74
|
- scripts/rdoc_filter.rb
|
75
|
+
- scripts/subcategory.csv
|
61
76
|
- setup.rb
|
62
77
|
- spec/dsl/behaviour_eval.rb
|
63
78
|
- spec/matchers/exit_with.rb
|
@@ -67,6 +82,8 @@ files:
|
|
67
82
|
- spec/sleipnir_api/key_state_mock_spec.rb
|
68
83
|
- spec/sleipnir_api/output_spec.rb
|
69
84
|
- spec/sleipnir_api/profile_mock_spec.rb
|
85
|
+
- spec/sleipnir_api/profile_section_mock_spec.rb
|
86
|
+
- spec/sleipnir_api/profile_spec.rb
|
70
87
|
- spec/sleipnir_api/registry_spec.rb
|
71
88
|
- spec/sleipnir_api/security_mock_spec.rb
|
72
89
|
- spec/sleipnir_api/security_spec.rb
|
data/helper/helper.rb
DELETED