sirius-client-core 1.1.1

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.
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'rubygems/package_task'
3
+ require 'cucumber'
4
+ require 'cucumber/rake/task'
5
+
6
+ spec = Gem::Specification.new do |s|
7
+ s.platform = Gem::Platform::RUBY
8
+ s.summary = "Sirius Ruby client"
9
+ s.name = "sirius-client-core"
10
+ s.version = File.read('VERSION').chomp
11
+ s.requirements = "none"
12
+ s.files = FileList["lib/**/*.rb", "Rakefile"]
13
+ s.homepage = "http://github.com/mkolisnyk/Sirius"
14
+ s.description = "The client for Sirius system"
15
+ s.authors="Myk Kolisnyk"
16
+ s.email="kolesnik.nickolay@gmail.com"
17
+ end
18
+
19
+ Gem::PackageTask.new(spec) do |pkg|
20
+ end
21
+
22
+ Cucumber::Rake::Task.new(:test) do |t|
23
+ t.cucumber_opts = "tests/features --format pretty --guess"
24
+ end
@@ -0,0 +1,14 @@
1
+ require 'core/system.rb'
2
+
3
+ module Sirius
4
+ module Client
5
+ module Core
6
+ class Core
7
+ attr_accessor(:system)
8
+ def initialize(host = "localhost",port="21212")
9
+ @system = System::System.new(host,port)
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ require 'system/dir.rb'
2
+ require 'system/file.rb'
3
+ require 'system/sys.rb'
4
+
5
+ module Sirius
6
+ module Client
7
+ module Core
8
+ module System
9
+ class System
10
+ attr_accessor(:dir,:file,:sys)
11
+ def initialize(host = "localhost",port="21212")
12
+ @dir = DirectoryOperations.new(host,port)
13
+ @file = FileOperations.new(host,port)
14
+ @sys = SystemOperations.new(host,port)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,130 @@
1
+ require 'savon'
2
+
3
+ module Sirius
4
+ module Client
5
+ module Core
6
+ module System
7
+ class DirectoryOperations
8
+ attr_accessor(:host, :port, :client)
9
+ def initialize(host = "localhost",port="21212")
10
+ @host = host
11
+ @port = port
12
+
13
+ @client = Savon.client do |wsdl|
14
+ wsdl.endpoint = "http://#{@host}:#{@port}/system/file?wsdl"
15
+ wsdl.namespace = "http://system.server.sirius.org/"
16
+ end
17
+ end
18
+
19
+ def copy_ex(origin,destination,overwrite)
20
+ response = @client.request :sys, "copyEx" do
21
+ soap.body = {
22
+ :origin => origin,
23
+ :destination => destination,
24
+ :overwrite => overwrite,
25
+
26
+ }
27
+ end
28
+ response.to_hash[:copy_ex_response][:status]
29
+ end
30
+
31
+ def create_directory_ex(path,overwrite)
32
+ response = @client.request :sys, "createDirectoryEx" do
33
+ soap.body = {
34
+ :path => path,
35
+ :overwrite => overwrite,
36
+
37
+ }
38
+ end
39
+ response.to_hash[:create_directory_ex_response][:status]
40
+ end
41
+
42
+ def get_contents_ex(path,recursive)
43
+ response = @client.request :sys, "getContentsEx" do
44
+ soap.body = {
45
+ :path => path,
46
+ :recursive => recursive,
47
+
48
+ }
49
+ end
50
+ response.to_hash[:get_contents_ex_response][:contents]
51
+ end
52
+
53
+ def move_directory(origin,destination)
54
+ response = @client.request :sys, "moveDirectory" do
55
+ soap.body = {
56
+ :origin => origin,
57
+ :destination => destination,
58
+
59
+ }
60
+ end
61
+ response.to_hash[:move_directory_response][:status]
62
+ end
63
+
64
+ def move_directory_ex(origin,destination,overwrite)
65
+ response = @client.request :sys, "moveDirectoryEx" do
66
+ soap.body = {
67
+ :origin => origin,
68
+ :destination => destination,
69
+ :overwrite => overwrite,
70
+
71
+ }
72
+ end
73
+ response.to_hash[:move_directory_ex_response][:status]
74
+ end
75
+
76
+ def copy(origin,destination)
77
+ response = @client.request :sys, "copy" do
78
+ soap.body = {
79
+ :origin => origin,
80
+ :destination => destination,
81
+
82
+ }
83
+ end
84
+ response.to_hash[:copy_response][:status]
85
+ end
86
+
87
+ def delete(path)
88
+ response = @client.request :sys, "delete" do
89
+ soap.body = {
90
+ :path => path,
91
+
92
+ }
93
+ end
94
+ response.to_hash[:delete_response][:status]
95
+ end
96
+
97
+ def exists(path)
98
+ response = @client.request :sys, "exists" do
99
+ soap.body = {
100
+ :path => path,
101
+
102
+ }
103
+ end
104
+ response.to_hash[:exists_response][:status]
105
+ end
106
+
107
+ def create_directory(path)
108
+ response = @client.request :sys, "createDirectory" do
109
+ soap.body = {
110
+ :path => path,
111
+
112
+ }
113
+ end
114
+ response.to_hash[:create_directory_response][:status]
115
+ end
116
+
117
+ def get_contents(path)
118
+ response = @client.request :sys, "getContents" do
119
+ soap.body = {
120
+ :path => path,
121
+
122
+ }
123
+ end
124
+ response.to_hash[:get_contents_response][:contents]
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,228 @@
1
+ require 'savon'
2
+
3
+ module Sirius
4
+ module Client
5
+ module Core
6
+ module System
7
+ class FileOperations
8
+ attr_accessor(:host, :port, :client)
9
+ def initialize(host = "localhost",port="21212")
10
+ @host = host
11
+ @port = port
12
+
13
+ @client = Savon.client do |wsdl|
14
+ wsdl.endpoint = "http://#{@host}:#{@port}/system/file?wsdl"
15
+ wsdl.namespace = "http://system.server.sirius.org/"
16
+ end
17
+ end
18
+
19
+ def append_ex(path,text)
20
+ response = @client.request :sys, "appendEx" do
21
+ soap.body = {
22
+ :path => path,
23
+ :text => text,
24
+
25
+ }
26
+ end
27
+ response.to_hash[:append_ex_response][:status]
28
+ end
29
+
30
+ def copy_ex(origin,destination,overwrite)
31
+ response = @client.request :sys, "copyEx" do
32
+ soap.body = {
33
+ :origin => origin,
34
+ :destination => destination,
35
+ :overwrite => overwrite,
36
+
37
+ }
38
+ end
39
+ response.to_hash[:copy_ex_response][:status]
40
+ end
41
+
42
+ def create_file(file_name)
43
+ response = @client.request :sys, "createFile" do
44
+ soap.body = {
45
+ :file_name => file_name,
46
+
47
+ }
48
+ end
49
+ response.to_hash[:create_file_response][:status]
50
+ end
51
+
52
+ def get_file_contents(path)
53
+ response = @client.request :sys, "getFileContents" do
54
+ soap.body = {
55
+ :path => path,
56
+
57
+ }
58
+ end
59
+ response.to_hash[:get_file_contents_response][:content]
60
+ end
61
+
62
+ def get_file_contents_ex2(path,start,number)
63
+ response = @client.request :sys, "getFileContentsEx2" do
64
+ soap.body = {
65
+ :path => path,
66
+ :start => start,
67
+ :number => number,
68
+
69
+ }
70
+ end
71
+ response.to_hash[:get_file_contents_ex2_response][:content]
72
+ end
73
+
74
+ def get_file_contents_ex(path,start)
75
+ response = @client.request :sys, "getFileContentsEx" do
76
+ soap.body = {
77
+ :path => path,
78
+ :start => start,
79
+
80
+ }
81
+ end
82
+ response.to_hash[:get_file_contents_ex_response][:content]
83
+ end
84
+
85
+ def create_file_ex(file_name,overwrite)
86
+ response = @client.request :sys, "createFileEx" do
87
+ soap.body = {
88
+ :file_name => file_name,
89
+ :overwrite => overwrite,
90
+
91
+ }
92
+ end
93
+ response.to_hash[:create_file_ex_response][:status]
94
+ end
95
+
96
+ def delete_file(file_name)
97
+ response = @client.request :sys, "deleteFile" do
98
+ soap.body = {
99
+ :file_name => file_name,
100
+
101
+ }
102
+ end
103
+ response.to_hash[:delete_file_response][:status]
104
+ end
105
+
106
+ def file_exists(file_name)
107
+ response = @client.request :sys, "fileExists" do
108
+ soap.body = {
109
+ :file_name => file_name,
110
+ }
111
+ end
112
+ response.to_hash[:file_exists_response][:status]
113
+ end
114
+
115
+ def get_all_bytes(file_name)
116
+ response = @client.request :sys, "getAllBytes" do
117
+ soap.body = {
118
+ :file_name => file_name,
119
+
120
+ }
121
+ end
122
+ response.to_hash[:get_all_bytes_response][:content]
123
+ end
124
+
125
+ def move_ex(origin,destination,overwrite)
126
+ response = @client.request :sys, "moveEx" do
127
+ soap.body = {
128
+ :origin => origin,
129
+ :destination => destination,
130
+ :overwrite => overwrite,
131
+
132
+ }
133
+ end
134
+ response.to_hash[:move_ex_response][:status]
135
+ end
136
+
137
+ def write_ex(path,text)
138
+ response = @client.request :sys, "writeEx" do
139
+ soap.body = {
140
+ :path => path,
141
+ :text => text,
142
+
143
+ }
144
+ end
145
+ response.to_hash[:write_ex_response][:status]
146
+ end
147
+
148
+ def append(path,content)
149
+ response = @client.request :sys, "append" do
150
+ soap.body = {
151
+ :path => path,
152
+ :content => content,
153
+
154
+ }
155
+ end
156
+ response.to_hash[:append_response][:status]
157
+ end
158
+
159
+ def size(file_name)
160
+ response = @client.request :sys, "size" do
161
+ soap.body = {
162
+ :file_name => file_name,
163
+
164
+ }
165
+ end
166
+ response.to_hash[:size_response][:fileSize]
167
+ end
168
+
169
+ def write(path,content)
170
+ response = @client.request :sys, "write" do
171
+ soap.body = {
172
+ :path => path,
173
+ :content => content,
174
+
175
+ }
176
+ end
177
+ response.to_hash[:write_response][:status]
178
+ end
179
+
180
+ def copy(origin,destination)
181
+ response = @client.request :sys, "copy" do
182
+ soap.body = {
183
+ :origin => origin,
184
+ :destination => destination,
185
+
186
+ }
187
+ end
188
+ response.to_hash[:copy_response][:status]
189
+ end
190
+
191
+ def head(path,lines)
192
+ response = @client.request :sys, "head" do
193
+ soap.body = {
194
+ :path => path,
195
+ :lines => lines,
196
+
197
+ }
198
+ end
199
+ response.to_hash[:head_response][:content]
200
+ end
201
+
202
+ def tail(path,lines)
203
+ response = @client.request :sys, "tail" do
204
+ soap.body = {
205
+ :path => path,
206
+ :lines => lines,
207
+
208
+ }
209
+ end
210
+ response.to_hash[:tail_response][:content]
211
+ end
212
+
213
+ def move(origin,destination)
214
+ response = @client.request :sys, "move" do
215
+ soap.body = {
216
+ :origin => origin,
217
+ :destination => destination,
218
+
219
+ }
220
+ end
221
+ response.to_hash[:move_response][:status]
222
+ end
223
+
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
@@ -0,0 +1,89 @@
1
+ require 'savon'
2
+
3
+ module Sirius
4
+ module Client
5
+ module Core
6
+ module System
7
+ class SystemOperations
8
+ attr_accessor(:host, :port, :client)
9
+ def initialize(host = "localhost",port="21212")
10
+ @host = host
11
+ @port = port
12
+
13
+ @client = Savon.client do |wsdl|
14
+ wsdl.endpoint = "http://#{@host}:#{@port}/system/file?wsdl"
15
+ wsdl.namespace = "http://system.server.sirius.org/"
16
+ end
17
+ end
18
+
19
+ def get_environment_variable(value)
20
+ response = @client.request :sys, "getEnvironmentVariable" do
21
+ soap.body = {
22
+ :value => value
23
+ }
24
+ end
25
+ response.to_hash[:get_environment_variable_response][:value]
26
+ end
27
+
28
+ def set_environment_variable(variable_name,value)
29
+ response = @client.request :sys, "setEnvironmentVariable" do
30
+ soap.body = {
31
+ :variable_name => variable_name,
32
+ :value => value,
33
+
34
+ }
35
+ end
36
+ response.to_hash[:set_environment_variable_response][:status]
37
+ end
38
+
39
+ def get_machine_name()
40
+ response = @client.request :sys, "getMachineName" do
41
+ soap.body = {
42
+
43
+ }
44
+ end
45
+ response.to_hash[:get_machine_name_response][:machine]
46
+ end
47
+
48
+ def get_free_memory()
49
+ response = @client.request :sys, "getFreeMemory" do
50
+ soap.body = {
51
+
52
+ }
53
+ end
54
+ response.to_hash[:get_free_memory_response][:freeMemory]
55
+ end
56
+
57
+ def get_free_disk_space()
58
+ response = @client.request :sys, "getFreeDiskSpace" do
59
+ soap.body = {
60
+
61
+ }
62
+ end
63
+ response.to_hash[:get_free_disk_space_response][:freeDiskSpace]
64
+ end
65
+
66
+ def get_current_user()
67
+ response = @client.request :sys, "getCurrentUser" do
68
+ soap.body = {
69
+
70
+ }
71
+ end
72
+ response.to_hash[:get_current_user_response][:userName]
73
+ end
74
+
75
+ def get_date()
76
+ response = @client.request :sys, "getDate" do
77
+ soap.body = {
78
+
79
+ }
80
+ end
81
+ response.to_hash[:get_date_response][:date]
82
+ end
83
+
84
+ end
85
+
86
+ end
87
+ end
88
+ end
89
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sirius-client-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Myk Kolisnyk
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-18 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: The client for Sirius system
15
+ email: kolesnik.nickolay@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/sirius/core/system/dir.rb
21
+ - lib/sirius/core/system/file.rb
22
+ - lib/sirius/core/system/sys.rb
23
+ - lib/sirius/core/system.rb
24
+ - lib/sirius/core.rb
25
+ - Rakefile
26
+ homepage: http://github.com/mkolisnyk/Sirius
27
+ licenses: []
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements:
45
+ - none
46
+ rubyforge_project:
47
+ rubygems_version: 1.8.24
48
+ signing_key:
49
+ specification_version: 3
50
+ summary: Sirius Ruby client
51
+ test_files: []