rjobs 0.1.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/.codeintel/config +26 -0
- data/.gitignore +7 -0
- data/Gemfile +4 -0
- data/Guardfile +15 -0
- data/README.md +1 -0
- data/Rakefile +34 -0
- data/bin/rjharvest +34 -0
- data/bin/rjstatus +35 -0
- data/bin/rjsubmit +49 -0
- data/features/harvest.feature +32 -0
- data/features/listJobs.feature +22 -0
- data/features/step_definitions/listJobs_steps.rb +19 -0
- data/features/step_definitions/submit_steps.rb +2 -0
- data/features/submit.feature +27 -0
- data/features/support/env.rb +6 -0
- data/features/support/setup.rb +1 -0
- data/lib/rjobs.rb +5 -0
- data/lib/rjobs/cli_helper.rb +14 -0
- data/lib/rjobs/color_helper.rb +12 -0
- data/lib/rjobs/command_builder.rb +23 -0
- data/lib/rjobs/job.rb +53 -0
- data/lib/rjobs/job_handler.rb +58 -0
- data/lib/rjobs/job_input_file.rb +22 -0
- data/lib/rjobs/jobs_file.rb +44 -0
- data/lib/rjobs/process.rb +15 -0
- data/lib/rjobs/rj_status_cli.rb +25 -0
- data/lib/rjobs/version.rb +3 -0
- data/rjobs.gemspec +32 -0
- data/samples/jobAttributes.xml +31 -0
- data/samples/jobList.xml +16 -0
- data/samples/jobSepcification.xml +338 -0
- data/spec/data_helper.rb +52 -0
- data/spec/lib/command_builder_spec.rb +24 -0
- data/spec/lib/job_handler_spec.rb +29 -0
- data/spec/lib/job_spec.rb +48 -0
- data/spec/lib/process_spec.rb +18 -0
- metadata +234 -0
data/spec/data_helper.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
class DataHelper
|
2
|
+
def self.jobAttributes
|
3
|
+
@@jobAttributes
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.jobSubmit
|
7
|
+
@@jobSubmit
|
8
|
+
end
|
9
|
+
|
10
|
+
@@jobAttributes = '<?xml version="1.0" encoding="UTF-8"?>
|
11
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
12
|
+
<plist version="1.0">
|
13
|
+
<dict>
|
14
|
+
<key>jobAttributes</key>
|
15
|
+
<dict>
|
16
|
+
<key>activeCPUPower</key>
|
17
|
+
<string>0</string>
|
18
|
+
<key>applicationIdentifier</key>
|
19
|
+
<string>com.apple.xgrid.cli</string>
|
20
|
+
<key>dateNow</key>
|
21
|
+
<date>2011-11-17T06:21:15Z</date>
|
22
|
+
<key>dateStarted</key>
|
23
|
+
<date>2011-11-15T14:44:53Z</date>
|
24
|
+
<key>dateStopped</key>
|
25
|
+
<date>2011-11-15T14:44:53Z</date>
|
26
|
+
<key>dateSubmitted</key>
|
27
|
+
<date>2011-11-15T14:44:53Z</date>
|
28
|
+
<key>jobStatus</key>
|
29
|
+
<string>Finished</string>
|
30
|
+
<key>name</key>
|
31
|
+
<string>MyFirstJob</string>
|
32
|
+
<key>percentDone</key>
|
33
|
+
<real>100</real>
|
34
|
+
<key>taskCount</key>
|
35
|
+
<string>1</string>
|
36
|
+
<key>undoneTaskCount</key>
|
37
|
+
<string>0</string>
|
38
|
+
</dict>
|
39
|
+
</dict>
|
40
|
+
</plist>'
|
41
|
+
|
42
|
+
@@jobSubmit = '<?xml version="1.0" encoding="UTF-8"?>
|
43
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
44
|
+
<plist version="1.0">
|
45
|
+
<dict>
|
46
|
+
<key>jobIdentifier</key>
|
47
|
+
<string>11</string>
|
48
|
+
</dict>
|
49
|
+
</plist>
|
50
|
+
'
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rjobs/command_builder'
|
2
|
+
require 'rjobs/job'
|
3
|
+
describe Rjobs::CommandBuilder do
|
4
|
+
it "should have a class name CommandBuilder" do
|
5
|
+
cb = Rjobs::CommandBuilder.new
|
6
|
+
cb.should_not == nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should build get job attributes command" do
|
10
|
+
cb = Rjobs::CommandBuilder.new("xgrid", {
|
11
|
+
:h => "127.0.0.1",
|
12
|
+
:p => "xgrid",
|
13
|
+
:f => "xml",
|
14
|
+
:job => :attributes,
|
15
|
+
:id => 1
|
16
|
+
})
|
17
|
+
|
18
|
+
cb.build.should == "xgrid -h 127.0.0.1 -p xgrid -f xml -job attributes -id 1"
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rjobs/job_handler'
|
2
|
+
require 'rjobs/job'
|
3
|
+
require 'data_helper'
|
4
|
+
|
5
|
+
describe Rjobs::JobHandler do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@jobAttributes = DataHelper.jobAttributes
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should have get attributes command" do
|
12
|
+
#process = mock(Rjobs::Process)
|
13
|
+
Rjobs::Process.stub!(:run).and_return(@jobAttributes)
|
14
|
+
Rjobs::JobHandler.get_job_attributes(1).should match /MyFirstJob/
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have a job submit function" do
|
19
|
+
job = Rjobs::Job.new()
|
20
|
+
job.command = "test"
|
21
|
+
job.params = {:a => "a", :b => "b" , "this is test" => ""}
|
22
|
+
|
23
|
+
Rjobs::Process.stub!(:run).and_return(DataHelper.jobSubmit)
|
24
|
+
Rjobs::JobHandler.submit_job(job)
|
25
|
+
job.id.should == 11
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rjobs/job'
|
2
|
+
require 'data_helper'
|
3
|
+
describe "Job Spec" do
|
4
|
+
before(:each) do
|
5
|
+
|
6
|
+
@jobAttributes = DataHelper.jobAttributes
|
7
|
+
@job = Rjobs::Job.new(0,@jobAttributes)
|
8
|
+
|
9
|
+
end
|
10
|
+
it "should exist a class name Job" do
|
11
|
+
@job.should_not == nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have an id attribute" do
|
15
|
+
@job.id = 123
|
16
|
+
@job.id.should == 123
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a name attribute" do
|
20
|
+
@job.name = "TestJob"
|
21
|
+
@job.name.should == "TestJob"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "can get attribute name from xml attribute" do
|
25
|
+
@job.name.should == 'MyFirstJob'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have a status attribute" do
|
29
|
+
@job.status = "Pending"
|
30
|
+
@job.status.should == "Pending"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should get status from xml attribute" do
|
34
|
+
@job.status.should == "Finished"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should parse xml when assign to xml attribute reader" do
|
38
|
+
@job.xml = @jobAttributes
|
39
|
+
@job.status.should == "Finished"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have a command attributes" do
|
43
|
+
@job.command = "test"
|
44
|
+
@job.params = {:a => "a", :b => "b" , "this is test" => ""}
|
45
|
+
@job.command.should == "test -a a -b b this is test"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rjobs/process'
|
2
|
+
describe Rjobs::Process do
|
3
|
+
it "can execute a simple command" do
|
4
|
+
cmd = "echo Hello World!"
|
5
|
+
#cmd = "ls"
|
6
|
+
Rjobs::Process.run(cmd).should == "Hello World!\n"
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should have stdout attribute" do
|
10
|
+
cmd = "echo Hello World!"
|
11
|
+
#cmd = "ls"
|
12
|
+
output = Rjobs::Process.run(cmd)
|
13
|
+
|
14
|
+
output.should == "Hello World!\n"
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rjobs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.alpha
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nguyen Tran
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &70250459810400 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70250459810400
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: cucumber
|
27
|
+
requirement: &70250459809980 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70250459809980
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: aruba
|
38
|
+
requirement: &70250459809540 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70250459809540
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: guard
|
49
|
+
requirement: &70250459809080 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70250459809080
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: growl_notify
|
60
|
+
requirement: &70250459808660 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70250459808660
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: &70250459808240 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70250459808240
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: plist
|
82
|
+
requirement: &70250459807820 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70250459807820
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: colorize
|
93
|
+
requirement: &70250459807400 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70250459807400
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: trollop
|
104
|
+
requirement: &70250459806980 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70250459806980
|
113
|
+
description: Gem to handle Jobs for XGrid
|
114
|
+
email:
|
115
|
+
- merlinvn@gmail.com
|
116
|
+
executables:
|
117
|
+
- rjharvest
|
118
|
+
- rjstatus
|
119
|
+
- rjsubmit
|
120
|
+
extensions: []
|
121
|
+
extra_rdoc_files: []
|
122
|
+
files:
|
123
|
+
- .codeintel/config
|
124
|
+
- .gitignore
|
125
|
+
- Gemfile
|
126
|
+
- Guardfile
|
127
|
+
- README.md
|
128
|
+
- Rakefile
|
129
|
+
- bin/rjharvest
|
130
|
+
- bin/rjstatus
|
131
|
+
- bin/rjsubmit
|
132
|
+
- features/harvest.feature
|
133
|
+
- features/listJobs.feature
|
134
|
+
- features/step_definitions/listJobs_steps.rb
|
135
|
+
- features/step_definitions/submit_steps.rb
|
136
|
+
- features/submit.feature
|
137
|
+
- features/support/env.rb
|
138
|
+
- features/support/setup.rb
|
139
|
+
- lib/rjobs.rb
|
140
|
+
- lib/rjobs/cli_helper.rb
|
141
|
+
- lib/rjobs/color_helper.rb
|
142
|
+
- lib/rjobs/command_builder.rb
|
143
|
+
- lib/rjobs/job.rb
|
144
|
+
- lib/rjobs/job_handler.rb
|
145
|
+
- lib/rjobs/job_input_file.rb
|
146
|
+
- lib/rjobs/jobs_file.rb
|
147
|
+
- lib/rjobs/process.rb
|
148
|
+
- lib/rjobs/rj_status_cli.rb
|
149
|
+
- lib/rjobs/version.rb
|
150
|
+
- rjobs.gemspec
|
151
|
+
- samples/jobAttributes.xml
|
152
|
+
- samples/jobList.xml
|
153
|
+
- samples/jobSepcification.xml
|
154
|
+
- spec/data_helper.rb
|
155
|
+
- spec/lib/command_builder_spec.rb
|
156
|
+
- spec/lib/job_handler_spec.rb
|
157
|
+
- spec/lib/job_spec.rb
|
158
|
+
- spec/lib/process_spec.rb
|
159
|
+
- vendor/aruba-0.4.7/.document
|
160
|
+
- vendor/aruba-0.4.7/.gitignore
|
161
|
+
- vendor/aruba-0.4.7/.rvmrc
|
162
|
+
- vendor/aruba-0.4.7/.travis.yml
|
163
|
+
- vendor/aruba-0.4.7/Gemfile
|
164
|
+
- vendor/aruba-0.4.7/History.md
|
165
|
+
- vendor/aruba-0.4.7/LICENSE
|
166
|
+
- vendor/aruba-0.4.7/README.md
|
167
|
+
- vendor/aruba-0.4.7/Rakefile
|
168
|
+
- vendor/aruba-0.4.7/aruba.gemspec
|
169
|
+
- vendor/aruba-0.4.7/config/.gitignore
|
170
|
+
- vendor/aruba-0.4.7/cucumber.yml
|
171
|
+
- vendor/aruba-0.4.7/features/exit_statuses.feature
|
172
|
+
- vendor/aruba-0.4.7/features/file_system_commands.feature
|
173
|
+
- vendor/aruba-0.4.7/features/flushing.feature
|
174
|
+
- vendor/aruba-0.4.7/features/interactive.feature
|
175
|
+
- vendor/aruba-0.4.7/features/no_clobber.feature
|
176
|
+
- vendor/aruba-0.4.7/features/output.feature
|
177
|
+
- vendor/aruba-0.4.7/features/step_definitions/aruba_dev_steps.rb
|
178
|
+
- vendor/aruba-0.4.7/features/support/env.rb
|
179
|
+
- vendor/aruba-0.4.7/lib/aruba.rb
|
180
|
+
- vendor/aruba-0.4.7/lib/aruba/api.rb
|
181
|
+
- vendor/aruba-0.4.7/lib/aruba/cucumber.rb
|
182
|
+
- vendor/aruba-0.4.7/lib/aruba/hooks.rb
|
183
|
+
- vendor/aruba-0.4.7/lib/aruba/process.rb
|
184
|
+
- vendor/aruba-0.4.7/lib/aruba/reporting.rb
|
185
|
+
- vendor/aruba-0.4.7/templates/css/console.css
|
186
|
+
- vendor/aruba-0.4.7/templates/css/filesystem.css
|
187
|
+
- vendor/aruba-0.4.7/templates/css/pygments-autumn.css
|
188
|
+
- vendor/aruba-0.4.7/templates/files.erb
|
189
|
+
- vendor/aruba-0.4.7/templates/images/LICENSE
|
190
|
+
- vendor/aruba-0.4.7/templates/images/folder.png
|
191
|
+
- vendor/aruba-0.4.7/templates/images/page_white.png
|
192
|
+
- vendor/aruba-0.4.7/templates/images/page_white_gherkin.png
|
193
|
+
- vendor/aruba-0.4.7/templates/images/page_white_ruby.png
|
194
|
+
- vendor/aruba-0.4.7/templates/index.erb
|
195
|
+
- vendor/aruba-0.4.7/templates/js/filesystem.js
|
196
|
+
- vendor/aruba-0.4.7/templates/js/jquery-1.6.1.min.js
|
197
|
+
- vendor/aruba-0.4.7/templates/main.erb
|
198
|
+
homepage: https://github.com/nguyentd/rjobs
|
199
|
+
licenses: []
|
200
|
+
post_install_message:
|
201
|
+
rdoc_options: []
|
202
|
+
require_paths:
|
203
|
+
- lib
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
+
none: false
|
206
|
+
requirements:
|
207
|
+
- - ! '>='
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
210
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
+
none: false
|
212
|
+
requirements:
|
213
|
+
- - ! '>'
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 1.3.1
|
216
|
+
requirements: []
|
217
|
+
rubyforge_project: rjobs
|
218
|
+
rubygems_version: 1.8.10
|
219
|
+
signing_key:
|
220
|
+
specification_version: 3
|
221
|
+
summary: Gem to handle Jobs for XGrid
|
222
|
+
test_files:
|
223
|
+
- features/harvest.feature
|
224
|
+
- features/listJobs.feature
|
225
|
+
- features/step_definitions/listJobs_steps.rb
|
226
|
+
- features/step_definitions/submit_steps.rb
|
227
|
+
- features/submit.feature
|
228
|
+
- features/support/env.rb
|
229
|
+
- features/support/setup.rb
|
230
|
+
- spec/data_helper.rb
|
231
|
+
- spec/lib/command_builder_spec.rb
|
232
|
+
- spec/lib/job_handler_spec.rb
|
233
|
+
- spec/lib/job_spec.rb
|
234
|
+
- spec/lib/process_spec.rb
|