mobilize-base 1.0.6 → 1.0.7
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.
- data/README.md +11 -9
- data/lib/mobilize-base/extensions/google_drive/file.rb +5 -1
- data/lib/mobilize-base/handlers/gfile.rb +1 -1
- data/lib/mobilize-base/handlers/gsheet.rb +3 -3
- data/lib/mobilize-base/models/task.rb +9 -5
- data/lib/mobilize-base/version.rb +1 -1
- data/test/base_job_rows.yml +4 -4
- metadata +3 -3
data/README.md
CHANGED
@@ -493,22 +493,24 @@ name>))` and enter values under each header:
|
|
493
493
|
* Tasks have this syntax: <handler>.<call> <params>.
|
494
494
|
* handler specifies the file that should receive the task
|
495
495
|
* the call specifies the method within the file. The method should
|
496
|
-
be called `"<
|
496
|
+
be called `"<handler>.<call>_by_task_path"`
|
497
497
|
* the params the method accepts, which are custom to each
|
498
|
-
task. These should be
|
499
|
-
|
498
|
+
task. These should be of the for `<key1>: <value1>, <key2>: <value2>`, where
|
499
|
+
`<key>` is an unquoted string and `<value>` is a quoted string, an
|
500
|
+
integer, an array (delimited by square braces), or a hash (delimited by
|
501
|
+
curly braces).
|
500
502
|
* For mobilize-base, the following tasks are available:
|
501
|
-
* gsheet.read
|
502
|
-
* The
|
503
|
+
* gsheet.read `source: <input_gsheet_full_path>`, which reads the sheet.
|
504
|
+
* The gsheet_full_path should be of the form `<gbook_name>/<gsheet_name>`. The test uses
|
503
505
|
"Requestor_mobilize(test)/base1_task1.in".
|
504
|
-
* gsheet.write
|
505
|
-
which writes the specified task output to the
|
506
|
-
* The
|
506
|
+
* gsheet.write `source: <task_relative_path>`,`target: <target_gsheet_path>`,
|
507
|
+
which writes the specified task output to the target_gsheet.
|
508
|
+
* The task_relative_path should be of the form `<task_column>` or
|
507
509
|
`<job_name/task_column>`. The test uses "base1/task1" for the first test
|
508
510
|
and simply "task1" for the second test. Both of these take the output
|
509
511
|
from the first task.
|
510
512
|
* The test uses "Requestor_mobilize(test)/base1.out" and
|
511
|
-
"Requestor_mobilize(test)/base2.out" for
|
513
|
+
"Requestor_mobilize(test)/base2.out" for target sheets.
|
512
514
|
|
513
515
|
<a name='section_Start_Run_Test'></a>
|
514
516
|
### Run Test
|
@@ -54,7 +54,11 @@ module GoogleDrive
|
|
54
54
|
raise "Invalid role #{role}"
|
55
55
|
end
|
56
56
|
else
|
57
|
-
|
57
|
+
begin
|
58
|
+
f.acl.push({:scope_type=>"user",:scope=>email,:role=>role})
|
59
|
+
rescue => exc
|
60
|
+
raise exc unless exc.to_s.index("user already has access")
|
61
|
+
end
|
58
62
|
end
|
59
63
|
return true
|
60
64
|
end
|
@@ -27,7 +27,7 @@ module Mobilize
|
|
27
27
|
gdrive_slot = Gdrive.slot_worker_by_path(t.path)
|
28
28
|
return false unless gdrive_slot
|
29
29
|
t = Task.where(:path=>task_path)
|
30
|
-
gfile_path = t.params
|
30
|
+
gfile_path = t.params['file']
|
31
31
|
Gfile.find_by_path(gfile_path,gdrive_slot).read
|
32
32
|
end
|
33
33
|
end
|
@@ -37,7 +37,7 @@ module Mobilize
|
|
37
37
|
gdrive_slot = Gdrive.slot_worker_by_path(task_path)
|
38
38
|
return false unless gdrive_slot
|
39
39
|
t = Task.where(:path=>task_path).first
|
40
|
-
gsheet_path = t.params
|
40
|
+
gsheet_path = t.params['source']
|
41
41
|
Gsheet.find_by_path(gsheet_path,gdrive_slot).to_tsv
|
42
42
|
end
|
43
43
|
|
@@ -46,8 +46,8 @@ module Mobilize
|
|
46
46
|
#return false if there are no emails available
|
47
47
|
return false unless gdrive_slot
|
48
48
|
t = Task.where(:path=>task_path).first
|
49
|
-
source = t.params
|
50
|
-
target_path = t.params
|
49
|
+
source = t.params['source']
|
50
|
+
target_path = t.params['target']
|
51
51
|
source_job_name, source_task_name = if source.index("/")
|
52
52
|
source.split("/")
|
53
53
|
else
|
@@ -36,11 +36,15 @@ module Mobilize
|
|
36
36
|
|
37
37
|
def params
|
38
38
|
t = self
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
#evaluates param_string to ruby hash
|
40
|
+
#using YAML parser
|
41
|
+
#TODO: eliminate ridiculousness
|
42
|
+
begin
|
43
|
+
YAML.load(t.param_string)
|
44
|
+
raise "Must resolve to Hash" unless result.class==Hash
|
45
|
+
rescue
|
46
|
+
sub_param_string = t.param_string.gsub(":\"",": \"").gsub(":'",": '").gsub(":[",": [").gsub(":{",": {").gsub(/(:[0-9])/,'taskparamsgsub\1').gsub('taskparamsgsub:',': ')
|
47
|
+
YAML.load("{#{sub_param_string}}")
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
data/test/base_job_rows.yml
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
active: true
|
3
3
|
trigger: once
|
4
4
|
status: ""
|
5
|
-
task1: 'gsheet.read "Runner_mobilize(test)/base1_task1.in"'
|
6
|
-
task2: 'gsheet.write "base1/task1", "Runner_mobilize(test)/base1.out"'
|
5
|
+
task1: 'gsheet.read source:"Runner_mobilize(test)/base1_task1.in"'
|
6
|
+
task2: 'gsheet.write source:"base1/task1", target:"Runner_mobilize(test)/base1.out"'
|
7
7
|
|
8
8
|
- name: "base2"
|
9
9
|
active: true
|
10
10
|
trigger: "after base1"
|
11
11
|
status: ""
|
12
|
-
task1: 'gsheet.read "Runner_mobilize(test)/base1.out"'
|
13
|
-
task2: 'gsheet.write "task1", "Runner_mobilize(test)/base2.out"'
|
12
|
+
task1: 'gsheet.read source:"Runner_mobilize(test)/base1.out"'
|
13
|
+
task2: 'gsheet.write source:"task1", target:"Runner_mobilize(test)/base2.out"'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobilize-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -238,7 +238,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
segments:
|
240
240
|
- 0
|
241
|
-
hash:
|
241
|
+
hash: 889890289433038495
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
none: false
|
244
244
|
requirements:
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: '0'
|
248
248
|
segments:
|
249
249
|
- 0
|
250
|
-
hash:
|
250
|
+
hash: 889890289433038495
|
251
251
|
requirements: []
|
252
252
|
rubyforge_project: mobilize-base
|
253
253
|
rubygems_version: 1.8.24
|