scout-gear 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +10 -4
  3. data/Rakefile +2 -0
  4. data/VERSION +1 -1
  5. data/bin/scout +2 -0
  6. data/lib/scout/meta_extension.rb +4 -2
  7. data/lib/scout/misc/format.rb +16 -4
  8. data/lib/scout/misc/monitor.rb +23 -0
  9. data/lib/scout/misc.rb +1 -0
  10. data/lib/scout/open/stream.rb +1 -0
  11. data/lib/scout/path/find.rb +2 -1
  12. data/lib/scout/path.rb +1 -1
  13. data/lib/scout/persist/serialize.rb +15 -4
  14. data/lib/scout/resource/path.rb +5 -0
  15. data/lib/scout/resource/util.rb +48 -0
  16. data/lib/scout/resource.rb +2 -0
  17. data/lib/scout/simple_opt/doc.rb +26 -2
  18. data/lib/scout/workflow/definition.rb +8 -2
  19. data/lib/scout/workflow/documentation.rb +32 -26
  20. data/lib/scout/workflow/step/info.rb +11 -11
  21. data/lib/scout/workflow/step/load.rb +18 -0
  22. data/lib/scout/workflow/step.rb +40 -4
  23. data/lib/scout/workflow/task/inputs.rb +4 -2
  24. data/lib/scout/workflow/task.rb +15 -1
  25. data/lib/scout/workflow/usage.rb +96 -76
  26. data/lib/scout/workflow.rb +1 -0
  27. data/scout-gear.gemspec +14 -3
  28. data/scout_commands/workflow/info +29 -0
  29. data/scout_commands/workflow/list +27 -0
  30. data/scout_commands/workflow/task +32 -681
  31. data/scout_commands/workflow/task_old +706 -0
  32. data/test/scout/resource/test_util.rb +27 -0
  33. data/test/scout/simple_opt/test_doc.rb +16 -0
  34. data/test/scout/test_meta_extension.rb +9 -0
  35. data/test/scout/workflow/step/test_info.rb +17 -15
  36. data/test/scout/workflow/step/test_load.rb +65 -0
  37. data/test/scout/workflow/test_definition.rb +0 -0
  38. data/test/scout/workflow/test_documentation.rb +30 -0
  39. data/test/scout/workflow/test_task.rb +1 -0
  40. data/test/scout/workflow/test_usage.rb +12 -3
  41. metadata +13 -2
@@ -0,0 +1,27 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
+
4
+ class TestResourceUtil < Test::Unit::TestCase
5
+ def test_identify
6
+ path = Path.setup('share/data/somedir/somepath').find
7
+ assert_equal 'share/data/somedir/somepath', Scout.identify(path)
8
+ end
9
+
10
+ def test_relocate
11
+ TmpFile.with_file do |dir|
12
+ Path.setup dir
13
+
14
+ path_base = Path.setup("basedir").someother.file
15
+ path_base.path_maps[:subdir1] = File.join(dir, 'subdir1', '{PATH}')
16
+ path_base.path_maps[:subdir2] = File.join(dir, 'subdir2', '{PATH}')
17
+
18
+ path1 = path_base.find(:subdir1)
19
+ path2 = path_base.find(:subdir2)
20
+
21
+ Open.write(path1, "TEST")
22
+ Open.mv path1, path2
23
+ assert_equal path2, Resource.relocate(path1)
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,16 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
+
4
+ class TestSimpleOptDoc < Test::Unit::TestCase
5
+ def test_input_format
6
+ assert_match 'default: :def', SOPT.input_format(:name, :type, :def, :n)
7
+ end
8
+ def test_input_doc
9
+ inputs =<<-EOF.split("\n").collect{|l| l.split(" ") }
10
+ input1 integer Integer_input 10 i1
11
+ input2 float Float_input 0.2 i2
12
+ EOF
13
+ assert SOPT.input_array_doc(inputs).include?('-i1,--input1')
14
+ end
15
+ end
16
+
@@ -32,5 +32,14 @@ class TestMetaExtension < Test::Unit::TestCase
32
32
  assert_equal :code, str.code2
33
33
 
34
34
  end
35
+
36
+ def test_setup_block
37
+ o = ExtensionClass.setup nil, :code => :c, :code2 => :c2 do
38
+ puts 1
39
+ end
40
+
41
+ assert o.extension_attr_hash.include?(:code)
42
+ assert o.extension_attr_hash.include?(:code2)
43
+ end
35
44
  end
36
45
 
@@ -4,25 +4,27 @@ require 'scout/workflow'
4
4
 
5
5
  class TestStepInfo < Test::Unit::TestCase
6
6
  def test_dependency
7
- Log.with_severity 0 do
8
- tmpfile = tmpdir.test_step
9
- step1 = Step.new tmpfile.step1, ["12"] do |s|
10
- s.length
11
- end
7
+ sss 0 do
8
+ TmpFile.with_file do |tmpdir|
9
+ Path.setup(tmpdir)
10
+ tmpfile = tmpdir.test_step
11
+ step1 = Step.new tmpfile.step1, ["12"] do |s|
12
+ s.length
13
+ end
12
14
 
13
- assert_equal 2, step1.exec
14
- assert_equal 2, step1.run
15
+ assert_equal 2, step1.exec
16
+ assert_equal 2, step1.run
15
17
 
16
- step2 = Step.new tmpfile.step2 do
17
- step1 = dependencies.first
18
- step1.inputs.first + " has " + step1.load.to_s + " characters"
19
- end
18
+ step2 = Step.new tmpfile.step2 do
19
+ step1 = dependencies.first
20
+ step1.inputs.first + " has " + step1.load.to_s + " characters"
21
+ end
20
22
 
21
- step2.dependencies = [step1]
23
+ step2.dependencies = [step1]
22
24
 
23
- assert_equal "12 has 2 characters", step2.run
24
- assert_equal "12 has 2 characters", step2.run
25
+ assert_equal "12 has 2 characters", step2.run
26
+ assert_equal "12 has 2 characters", step2.run
27
+ end
25
28
  end
26
29
  end
27
30
  end
28
-
@@ -0,0 +1,65 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
+
4
+ require 'scout/workflow/step'
5
+
6
+ class TestStepLoad < Test::Unit::TestCase
7
+ def test_dependency
8
+ sss 0 do
9
+ tmpfile = tmpdir.test_step
10
+ step1 = Step.new tmpfile.step1, ["12"] do |s|
11
+ s.length
12
+ end
13
+
14
+ step2 = Step.new tmpfile.step2 do
15
+ step1 = dependencies.first
16
+ step1.inputs.first + " has " + step1.load.to_s + " characters"
17
+ end
18
+
19
+ step2.dependencies = [step1]
20
+
21
+ step2.recursive_clean
22
+ step2.run
23
+
24
+ new_step2 = Step.load(step2.path)
25
+
26
+ assert_equal "12 has 2 characters", new_step2.load
27
+ assert_equal "12 has 2 characters", new_step2.run
28
+ assert_equal 2, new_step2.dependencies.first.run
29
+ assert_equal "12", new_step2.dependencies.first.inputs.first
30
+ end
31
+ end
32
+
33
+ def test_relocate
34
+ wf = Workflow.annonymous_workflow "RelocateWorkflow" do
35
+ input :input1, :string
36
+ task :step1 => :string do |input1|
37
+ input1
38
+ end
39
+
40
+ dep :step1
41
+ task :step2 => :string do
42
+ step(:step1).load.reverse
43
+ end
44
+ end
45
+
46
+ step2 = wf.job(:step2, :input1 => "TEST")
47
+ step1 = step2.step(:step1)
48
+
49
+ step2.run
50
+ new_step2 = Step.load(step2.path)
51
+ TmpFile.with_file do |dir|
52
+ Misc.in_dir dir do
53
+ Path.setup(dir)
54
+ Open.mv step1.path, dir.var.jobs.RelocateWorkflow.step1[File.basename(step1.path)]
55
+ Open.mv step1.info_file, dir.var.jobs.RelocateWorkflow.step1[File.basename(step1.info_file)]
56
+
57
+ new_step2 = Step.load(step2.path)
58
+ assert_equal "TEST".reverse, new_step2.load
59
+ assert_equal "TEST", new_step2.dependencies.first.load
60
+ end
61
+ end
62
+
63
+ end
64
+ end
65
+
File without changes
@@ -0,0 +1,30 @@
1
+ require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
2
+ require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
3
+
4
+ class TestWorkflowDocumentation < Test::Unit::TestCase
5
+ module UsageWorkflow
6
+ extend Workflow
7
+
8
+ self.name = "UsageWorkflow"
9
+
10
+ self.title = "Workflow to test documentation"
11
+ self.description = "Use this workflow to test if the documentation is correctly presented"
12
+
13
+ desc "Desc"
14
+ input :array, :array, "Array"
15
+ task :step1 => :string do
16
+ end
17
+
18
+ dep :step1
19
+ desc "Desc2"
20
+ input :float, :float, "Float"
21
+ task :step2 => :string do
22
+ end
23
+ end
24
+
25
+ def test_usage
26
+ assert_match 'test', UsageWorkflow.documentation[:title]
27
+ assert_match 'presented', UsageWorkflow.documentation[:description]
28
+ end
29
+ end
30
+
@@ -17,6 +17,7 @@ class TestTask < Test::Unit::TestCase
17
17
  end
18
18
 
19
19
  s = task.job('test', ['12'])
20
+ s.clean
20
21
  assert_equal 2, s.run
21
22
  end
22
23
 
@@ -5,6 +5,11 @@ require 'scout/workflow'
5
5
  class TestWorkflowUsage < Test::Unit::TestCase
6
6
  module UsageWorkflow
7
7
  extend Workflow
8
+
9
+ self.name = "UsageWorkflow"
10
+
11
+ self.title = "Workflow to test documentation"
12
+ self.description = "Use this workflow to test if the documentation is correctly presented."
8
13
 
9
14
  desc "Desc"
10
15
  input :array, :array, "Array"
@@ -18,9 +23,13 @@ class TestWorkflowUsage < Test::Unit::TestCase
18
23
  end
19
24
  end
20
25
 
21
- def __test_usage
22
- UsageWorkflow.tasks[:step1].doc
23
- UsageWorkflow.doc
26
+
27
+ def test_workflow_usage
28
+ assert_match "test if the documentation", UsageWorkflow.usage
29
+ end
30
+
31
+ def test_task_usage
32
+ assert_match "Desc2", UsageWorkflow.tasks[:step2].usage
24
33
  end
25
34
  end
26
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout-gear
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-27 00:00:00.000000000 Z
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor
@@ -118,6 +118,7 @@ files:
118
118
  - lib/scout/misc/filesystem.rb
119
119
  - lib/scout/misc/format.rb
120
120
  - lib/scout/misc/insist.rb
121
+ - lib/scout/misc/monitor.rb
121
122
  - lib/scout/open.rb
122
123
  - lib/scout/open/lock.rb
123
124
  - lib/scout/open/remote.rb
@@ -136,6 +137,7 @@ files:
136
137
  - lib/scout/resource/produce.rb
137
138
  - lib/scout/resource/produce/rake.rb
138
139
  - lib/scout/resource/scout.rb
140
+ - lib/scout/resource/util.rb
139
141
  - lib/scout/simple_opt.rb
140
142
  - lib/scout/simple_opt/accessor.rb
141
143
  - lib/scout/simple_opt/doc.rb
@@ -148,6 +150,7 @@ files:
148
150
  - lib/scout/workflow/documentation.rb
149
151
  - lib/scout/workflow/step.rb
150
152
  - lib/scout/workflow/step/info.rb
153
+ - lib/scout/workflow/step/load.rb
151
154
  - lib/scout/workflow/task.rb
152
155
  - lib/scout/workflow/task/inputs.rb
153
156
  - lib/scout/workflow/usage.rb
@@ -158,7 +161,10 @@ files:
158
161
  - scout_commands/find
159
162
  - scout_commands/glob
160
163
  - scout_commands/rbbt
164
+ - scout_commands/workflow/info
165
+ - scout_commands/workflow/list
161
166
  - scout_commands/workflow/task
167
+ - scout_commands/workflow/task_old
162
168
  - test/scout/indiferent_hash/test_case_insensitive.rb
163
169
  - test/scout/indiferent_hash/test_options.rb
164
170
  - test/scout/log/test_progress.rb
@@ -176,6 +182,8 @@ files:
176
182
  - test/scout/persist/test_serialize.rb
177
183
  - test/scout/resource/test_path.rb
178
184
  - test/scout/resource/test_produce.rb
185
+ - test/scout/resource/test_util.rb
186
+ - test/scout/simple_opt/test_doc.rb
179
187
  - test/scout/simple_opt/test_get.rb
180
188
  - test/scout/simple_opt/test_parse.rb
181
189
  - test/scout/simple_opt/test_setup.rb
@@ -192,7 +200,10 @@ files:
192
200
  - test/scout/test_tmpfile.rb
193
201
  - test/scout/test_workflow.rb
194
202
  - test/scout/workflow/step/test_info.rb
203
+ - test/scout/workflow/step/test_load.rb
195
204
  - test/scout/workflow/task/test_inputs.rb
205
+ - test/scout/workflow/test_definition.rb
206
+ - test/scout/workflow/test_documentation.rb
196
207
  - test/scout/workflow/test_step.rb
197
208
  - test/scout/workflow/test_task.rb
198
209
  - test/scout/workflow/test_usage.rb