scout-gear 8.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.vimproject +48 -9
  3. data/Rakefile +6 -1
  4. data/VERSION +1 -1
  5. data/bin/scout +16 -4
  6. data/doc/lib/scout/path.md +35 -0
  7. data/doc/lib/scout/workflow/task.md +13 -0
  8. data/lib/rbbt-scout.rb +2 -1
  9. data/lib/scout/cmd.rb +32 -29
  10. data/lib/scout/concurrent_stream.rb +36 -19
  11. data/lib/scout/exceptions.rb +10 -0
  12. data/lib/scout/indiferent_hash.rb +17 -0
  13. data/lib/scout/log/color.rb +11 -11
  14. data/lib/scout/log/progress/report.rb +8 -5
  15. data/lib/scout/log/progress/util.rb +3 -0
  16. data/lib/scout/log/trap.rb +3 -3
  17. data/lib/scout/log.rb +67 -36
  18. data/lib/scout/meta_extension.rb +34 -0
  19. data/lib/scout/misc/digest.rb +11 -2
  20. data/lib/scout/misc/filesystem.rb +2 -3
  21. data/lib/scout/misc/format.rb +12 -7
  22. data/lib/scout/misc/monitor.rb +11 -0
  23. data/lib/scout/misc/system.rb +48 -0
  24. data/lib/scout/named_array.rb +8 -0
  25. data/lib/scout/offsite/ssh.rb +174 -0
  26. data/lib/scout/offsite/step.rb +100 -0
  27. data/lib/scout/offsite/sync.rb +55 -0
  28. data/lib/scout/offsite.rb +3 -0
  29. data/lib/scout/open/lock.rb +5 -24
  30. data/lib/scout/open/remote.rb +12 -1
  31. data/lib/scout/open/stream.rb +109 -122
  32. data/lib/scout/open/util.rb +9 -0
  33. data/lib/scout/open.rb +12 -11
  34. data/lib/scout/path/find.rb +15 -10
  35. data/lib/scout/path/util.rb +5 -0
  36. data/lib/scout/path.rb +1 -1
  37. data/lib/scout/persist/serialize.rb +4 -4
  38. data/lib/scout/persist.rb +1 -1
  39. data/lib/scout/resource/open.rb +8 -0
  40. data/lib/scout/resource/path.rb +16 -9
  41. data/lib/scout/resource/software.rb +4 -2
  42. data/lib/scout/resource/util.rb +10 -4
  43. data/lib/scout/resource.rb +2 -0
  44. data/lib/scout/tsv/dumper.rb +5 -1
  45. data/lib/scout/tsv/index.rb +28 -86
  46. data/lib/scout/tsv/open.rb +35 -14
  47. data/lib/scout/tsv/parser.rb +22 -5
  48. data/lib/scout/tsv/persist/tokyocabinet.rb +2 -0
  49. data/lib/scout/tsv/stream.rb +204 -0
  50. data/lib/scout/tsv/transformer.rb +11 -0
  51. data/lib/scout/tsv.rb +9 -2
  52. data/lib/scout/work_queue/worker.rb +2 -2
  53. data/lib/scout/work_queue.rb +37 -12
  54. data/lib/scout/workflow/definition.rb +2 -1
  55. data/lib/scout/workflow/deployment/orchestrator.rb +254 -0
  56. data/lib/scout/workflow/deployment.rb +1 -0
  57. data/lib/scout/workflow/step/dependencies.rb +46 -14
  58. data/lib/scout/workflow/step/file.rb +5 -0
  59. data/lib/scout/workflow/step/info.rb +13 -3
  60. data/lib/scout/workflow/step/inputs.rb +5 -0
  61. data/lib/scout/workflow/step/load.rb +1 -1
  62. data/lib/scout/workflow/step/provenance.rb +1 -0
  63. data/lib/scout/workflow/step/status.rb +27 -9
  64. data/lib/scout/workflow/step.rb +82 -30
  65. data/lib/scout/workflow/task/dependencies.rb +116 -0
  66. data/lib/scout/workflow/task/inputs.rb +36 -17
  67. data/lib/scout/workflow/task.rb +12 -109
  68. data/lib/scout/workflow/usage.rb +57 -41
  69. data/lib/scout/workflow.rb +19 -13
  70. data/lib/scout-gear.rb +2 -0
  71. data/lib/scout.rb +6 -0
  72. data/scout-gear.gemspec +38 -7
  73. data/scout_commands/doc +37 -0
  74. data/scout_commands/find +1 -0
  75. data/scout_commands/offsite +30 -0
  76. data/scout_commands/resource/produce +66 -0
  77. data/scout_commands/template +52 -0
  78. data/scout_commands/update +29 -0
  79. data/scout_commands/workflow/info +15 -3
  80. data/scout_commands/workflow/install +105 -0
  81. data/scout_commands/workflow/task +46 -6
  82. data/share/software/install_helpers +2 -2
  83. data/share/templates/command +25 -0
  84. data/share/templates/workflow.rb +14 -0
  85. data/test/scout/offsite/test_ssh.rb +15 -0
  86. data/test/scout/offsite/test_step.rb +32 -0
  87. data/test/scout/offsite/test_sync.rb +36 -0
  88. data/test/scout/offsite/test_task.rb +0 -0
  89. data/test/scout/resource/test_path.rb +6 -0
  90. data/test/scout/test_named_array.rb +6 -0
  91. data/test/scout/test_persist.rb +3 -2
  92. data/test/scout/test_tsv.rb +17 -0
  93. data/test/scout/test_work_queue.rb +64 -42
  94. data/test/scout/tsv/persist/test_adapter.rb +1 -1
  95. data/test/scout/tsv/test_index.rb +14 -0
  96. data/test/scout/tsv/test_parser.rb +35 -0
  97. data/test/scout/tsv/test_stream.rb +200 -0
  98. data/test/scout/tsv/test_transformer.rb +12 -0
  99. data/test/scout/workflow/deployment/test_orchestrator.rb +272 -0
  100. data/test/scout/workflow/step/test_dependencies.rb +68 -0
  101. data/test/scout/workflow/step/test_info.rb +17 -0
  102. data/test/scout/workflow/step/test_status.rb +0 -1
  103. data/test/scout/workflow/task/test_dependencies.rb +357 -0
  104. data/test/scout/workflow/task/test_inputs.rb +52 -0
  105. data/test/scout/workflow/test_definition.rb +18 -0
  106. data/test/scout/workflow/test_documentation.rb +24 -0
  107. data/test/scout/workflow/test_step.rb +109 -0
  108. data/test/scout/workflow/test_task.rb +0 -287
  109. data/test/test_scout.rb +9 -0
  110. metadata +89 -5
  111. data/scout_commands/workflow/task_old +0 -706
@@ -3,17 +3,40 @@ require 'scout/simple_opt'
3
3
  module Task
4
4
  def usage(workflow = nil, deps = nil)
5
5
  str = StringIO.new
6
- str.puts Log.color(:yellow, name)
7
- str.puts Log.color(:yellow, "-" * name.length)
8
- str.puts "\n" << Misc.format_paragraph(description.strip) << "\n" if description and not description.empty?
9
- str.puts
6
+
7
+ if description
8
+ title, paragraph = description.split("\n\n")
9
+ if title.length < Misc::MAX_TTY_LINE_WIDTH
10
+ title = self.name.to_s + " - " + title
11
+ str.puts Log.color :yellow, title
12
+ str.puts Log.color :yellow, "-" * title.length
13
+ if paragraph
14
+ str.puts "\n" << Misc.format_paragraph(paragraph)
15
+ end
16
+ else
17
+ title = self.name.to_s
18
+ str.puts Log.color :yellow, title
19
+ str.puts Log.color :yellow, "-" * title.length
20
+ str.puts "\n" << Misc.format_paragraph(description)
21
+ end
22
+ else
23
+ title = self.name.to_s
24
+ str.puts Log.color :yellow, title
25
+ str.puts Log.color :yellow, "-" * title.length
26
+ end
27
+
10
28
 
11
29
  selects = []
30
+
12
31
  if inputs && inputs.any?
32
+ str.puts
13
33
  str.puts Log.color(:magenta, "Inputs")
14
34
  str.puts
15
35
  str.puts SOPT.input_array_doc(inputs)
16
- str.puts
36
+
37
+ inputs.select{|name,type, _| type == :select }.each do |name,_,_,_,options|
38
+ selects << [name, options[:select_options]] if options[:select_options]
39
+ end
17
40
  end
18
41
 
19
42
  deps = workflow ? workflow.recursive_deps(self.name) : self.deps if deps.nil?
@@ -23,14 +46,21 @@ module Task
23
46
  deps.each do |dep_workflow,task_name,options|
24
47
  next if task_name.nil?
25
48
  task = dep_workflow.tasks[task_name]
49
+
26
50
  next if task.inputs.nil?
51
+
27
52
  inputs = task.inputs.reject{|name, _| seen.include? name }
28
53
  inputs = task.inputs.reject{|name, _| options.include? name }
29
54
  next unless inputs.any?
55
+ task.inputs.select{|name, _| inputs.include? name }.each do |name,_,_,_,options|
56
+ selects << [i, options[:select_options]] if options[:select_options]
57
+ end
58
+
30
59
  dep = workflow.nil? || dep_workflow.name != workflow.name ? ["#{dep_workflow.name}", task_name.to_s] *"#" : task_name.to_s
31
60
  dep_inputs[dep] = inputs
32
61
  end
33
62
 
63
+ str.puts
34
64
  str.puts Log.color(:magenta, "Inputs from dependencies:") if dep_inputs.any?
35
65
  dep_inputs.each do |dep,inputs|
36
66
  str.puts
@@ -38,54 +68,31 @@ module Task
38
68
  str.puts
39
69
  str.puts SOPT.input_array_doc(inputs)
40
70
  end
41
-
42
- #task_inputs = dep_inputs deps, workflow
43
- #task_inputs.each do |task,new_inputs|
44
- # new_inputs.zip(task.input_types.values_at(*new_inputs)).select do |i,t|
45
- # t.to_sym == :select and task.input_options[i][:select_options]
46
- # end.each do |i,t|
47
- # selects << [i, task.input_options[i][:select_options]]
48
- # end
49
-
50
- # next if new_inputs.empty?
51
-
52
- # if task.workflow and task.workflow != workflow
53
- # puts " #{Log.color :yellow, ["[#{task.workflow.to_s}]", task.name.to_s] *" "}:"
54
- # else
55
- # puts " #{Log.color :yellow, task.name.to_s}:"
56
- # end
57
- # puts unless Log.compact
58
- # puts SOPT.input_doc(new_inputs, task.input_types, task.input_descriptions, task.input_defaults, true)
59
- # puts unless Log.compact
60
- #end
61
- #puts
62
71
  end
63
72
 
64
73
  case
65
74
  when inputs && inputs.select{|name,type| type == :array }.any?
75
+ str.puts
66
76
  str.puts Log.color(:green, Misc.format_paragraph("Lists are specified as arguments using ',' or '|'. When specified as files the '\\n'
67
77
  also works in addition to the others. You may use the '--array_separator' option
68
78
  the change this default. Whenever a file is specified it may also accept STDIN using
69
79
  the '-' character."))
70
- str.puts
71
80
 
72
81
  when inputs && inputs.select{|name,type| type == :file || type == :tsv }.any?
73
- str.puts Log.color(:green, Misc.format_paragraph("Whenever a file is specified it may also accept STDIN using the '-' character."))
74
82
  str.puts
83
+ str.puts Log.color(:green, Misc.format_paragraph("Whenever a file is specified it may also accept STDIN using the '-' character."))
75
84
  end
76
85
 
77
86
  str.puts
78
87
  str.puts Log.color(:magenta, "Returns: ") << Log.color(:blue, type.to_s) << "\n"
79
- str.puts
80
88
 
81
89
  if selects.any?
82
- str.puts Log.color(:magenta, "Input select options")
83
90
  str.puts
91
+ str.puts Log.color(:magenta, "Input select options")
84
92
  selects.collect{|p| p}.uniq.each do |input,options|
93
+ str.puts
85
94
  str.puts Log.color(:blue, input.to_s + ": ") << Misc.format_paragraph(options.collect{|o| Array === o ? o.first.to_s : o.to_s} * ", ") << "\n"
86
- str.puts unless Log.compact
87
95
  end
88
- str.puts
89
96
  end
90
97
  str.rewind
91
98
  str.read
@@ -103,9 +110,16 @@ module Task
103
110
  sopt_options * ":"
104
111
  end
105
112
 
106
- def get_SOPT(task)
113
+ def get_SOPT
107
114
  sopt_option_string = self.SOPT_str
108
- SOPT.get sopt_option_string
115
+ job_options = SOPT.get sopt_option_string
116
+ recursive_inputs.uniq.each do |name,type|
117
+ next unless type.to_s.include?('array')
118
+ if job_options.include?(name) && (! Open.exist?(job_options[name]) || type.to_s.include?('file') || type.to_s.include?('path'))
119
+ job_options[name] = job_options[name].split(",")
120
+ end
121
+ end
122
+ job_options
109
123
  end
110
124
  end
111
125
 
@@ -219,14 +233,16 @@ module Workflow
219
233
  str.puts Log.color :magenta, "=" * self.name.length
220
234
  end
221
235
 
222
- if self.documentation[:description] and not self.documentation[:description].empty?
223
- str.puts
224
- str.puts Misc.format_paragraph self.documentation[:description]
225
- str.puts
226
- end
236
+ str.puts
227
237
 
238
+ if tasks.nil?
239
+ str.puts Log.color(:title, "No tasks")
240
+ elsif task.nil?
228
241
 
229
- if task.nil?
242
+ if self.documentation[:description] and not self.documentation[:description].empty?
243
+ str.puts Misc.format_paragraph self.documentation[:description]
244
+ str.puts
245
+ end
230
246
 
231
247
  str.puts Log.color :magenta, "## TASKS"
232
248
  if self.documentation[:task_description] and not self.documentation[:task_description].empty?
@@ -256,7 +272,7 @@ module Workflow
256
272
 
257
273
  prov_string = prov_string(dep_tree(name))
258
274
  str.puts Misc.format_paragraph Log.color(:blue, "->" + prov_string) if prov_string && ! prov_string.empty?
259
- end
275
+ end
260
276
 
261
277
  else
262
278
 
@@ -4,13 +4,14 @@ require_relative 'workflow/task'
4
4
  require_relative 'workflow/step'
5
5
  require_relative 'workflow/documentation'
6
6
  require_relative 'workflow/usage'
7
+ require_relative 'workflow/deployment'
7
8
 
8
9
  require_relative 'resource'
9
10
  require_relative 'resource/scout'
10
11
 
11
12
  module Workflow
12
13
  class << self
13
- attr_accessor :workflows
14
+ attr_accessor :workflows, :main
14
15
  def workflows
15
16
  @workflows ||= []
16
17
  end
@@ -24,19 +25,24 @@ module Workflow
24
25
  base.libdir = Path.setup(libdir).tap{|p| p.resource = base}
25
26
  end
26
27
 
27
- def self.require_workflow(workflow_name)
28
- workflow = workflow_name
29
- workflow = Path.setup('workflows')[workflow_name]["workflow.rb"] unless Open.exists?(workflow)
30
- workflow = Path.setup('workflows')[Misc.snake_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
31
- workflow = Path.setup('workflows')[Misc.camel_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
32
- if Open.exists?(workflow)
33
- workflow = workflow.find if Path === workflow
34
- $LOAD_PATH.unshift(File.join(File.dirname(workflow), 'lib'))
35
- load workflow
36
- else
37
- raise "Workflow #{workflow_name} not found"
28
+ def self.require_workflow(workflow_name_orig)
29
+ first = nil
30
+ workflow_name_orig.split("+").each do |workflow_name|
31
+ workflow = workflow_name
32
+ workflow = Path.setup('workflows')[workflow_name]["workflow.rb"] unless Open.exists?(workflow)
33
+ workflow = Path.setup('workflows')[Misc.snake_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
34
+ workflow = Path.setup('workflows')[Misc.camel_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow)
35
+ if Open.exists?(workflow)
36
+ self.main = nil
37
+ workflow = workflow.find if Path === workflow
38
+ $LOAD_PATH.unshift(File.join(File.dirname(workflow), 'lib'))
39
+ load workflow
40
+ else
41
+ raise "Workflow #{workflow_name} not found"
42
+ end
43
+ first ||= self.main || workflows.last
38
44
  end
39
- workflows.last
45
+ first
40
46
  end
41
47
 
42
48
  def job(name, *args)
data/lib/scout-gear.rb CHANGED
@@ -8,3 +8,5 @@ require_relative 'scout/resource'
8
8
  require_relative 'scout/resource/scout'
9
9
  require_relative 'scout/persist'
10
10
  require_relative 'scout/tsv'
11
+ require_relative 'scout/config'
12
+ require_relative 'scout/offsite'
data/lib/scout.rb CHANGED
@@ -1,2 +1,8 @@
1
1
  require 'workflow-scout'
2
2
  require 'rbbt-scout'
3
+
4
+ module Scout
5
+ def self.version
6
+ Open.read(File.join(__dir__, '../VERSION'))
7
+ end
8
+ end
data/scout-gear.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: scout-gear 8.0.0 ruby lib
5
+ # stub: scout-gear 9.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "scout-gear".freeze
9
- s.version = "8.0.0"
9
+ s.version = "9.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Miguel Vazquez".freeze]
14
- s.date = "2023-05-23"
15
- s.description = "Temporary files, logs, etc.".freeze
14
+ s.date = "2023-06-27"
15
+ s.description = "Temporary files, logs, path, resources, persistence, workflows, TSV, etc.".freeze
16
16
  s.email = "mikisvaz@gmail.com".freeze
17
17
  s.executables = ["scout".freeze]
18
18
  s.extra_rdoc_files = [
@@ -28,6 +28,8 @@ Gem::Specification.new do |s|
28
28
  "Rakefile",
29
29
  "VERSION",
30
30
  "bin/scout",
31
+ "doc/lib/scout/path.md",
32
+ "doc/lib/scout/workflow/task.md",
31
33
  "lib/rbbt-scout.rb",
32
34
  "lib/scout-gear.rb",
33
35
  "lib/scout.rb",
@@ -56,6 +58,10 @@ Gem::Specification.new do |s|
56
58
  "lib/scout/misc/monitor.rb",
57
59
  "lib/scout/misc/system.rb",
58
60
  "lib/scout/named_array.rb",
61
+ "lib/scout/offsite.rb",
62
+ "lib/scout/offsite/ssh.rb",
63
+ "lib/scout/offsite/step.rb",
64
+ "lib/scout/offsite/sync.rb",
59
65
  "lib/scout/open.rb",
60
66
  "lib/scout/open/lock.rb",
61
67
  "lib/scout/open/lock/lockfile.rb",
@@ -71,6 +77,7 @@ Gem::Specification.new do |s|
71
77
  "lib/scout/persist/path.rb",
72
78
  "lib/scout/persist/serialize.rb",
73
79
  "lib/scout/resource.rb",
80
+ "lib/scout/resource/open.rb",
74
81
  "lib/scout/resource/path.rb",
75
82
  "lib/scout/resource/produce.rb",
76
83
  "lib/scout/resource/produce/rake.rb",
@@ -98,6 +105,7 @@ Gem::Specification.new do |s|
98
105
  "lib/scout/tsv/persist/fix_width_table.rb",
99
106
  "lib/scout/tsv/persist/serialize.rb",
100
107
  "lib/scout/tsv/persist/tokyocabinet.rb",
108
+ "lib/scout/tsv/stream.rb",
101
109
  "lib/scout/tsv/transformer.rb",
102
110
  "lib/scout/tsv/traverse.rb",
103
111
  "lib/scout/tsv/util.rb",
@@ -111,33 +119,44 @@ Gem::Specification.new do |s|
111
119
  "lib/scout/work_queue/worker.rb",
112
120
  "lib/scout/workflow.rb",
113
121
  "lib/scout/workflow/definition.rb",
122
+ "lib/scout/workflow/deployment.rb",
123
+ "lib/scout/workflow/deployment/orchestrator.rb",
114
124
  "lib/scout/workflow/documentation.rb",
115
125
  "lib/scout/workflow/step.rb",
116
126
  "lib/scout/workflow/step/config.rb",
117
127
  "lib/scout/workflow/step/dependencies.rb",
118
128
  "lib/scout/workflow/step/file.rb",
119
129
  "lib/scout/workflow/step/info.rb",
130
+ "lib/scout/workflow/step/inputs.rb",
120
131
  "lib/scout/workflow/step/load.rb",
121
132
  "lib/scout/workflow/step/progress.rb",
122
133
  "lib/scout/workflow/step/provenance.rb",
123
134
  "lib/scout/workflow/step/status.rb",
124
135
  "lib/scout/workflow/task.rb",
136
+ "lib/scout/workflow/task/dependencies.rb",
125
137
  "lib/scout/workflow/task/inputs.rb",
126
138
  "lib/scout/workflow/usage.rb",
127
139
  "lib/scout/workflow/util.rb",
128
140
  "lib/workflow-scout.rb",
129
141
  "scout-gear.gemspec",
130
142
  "scout_commands/alias",
143
+ "scout_commands/doc",
131
144
  "scout_commands/find",
132
145
  "scout_commands/glob",
146
+ "scout_commands/offsite",
133
147
  "scout_commands/rbbt",
148
+ "scout_commands/resource/produce",
149
+ "scout_commands/template",
150
+ "scout_commands/update",
134
151
  "scout_commands/workflow/info",
152
+ "scout_commands/workflow/install",
135
153
  "scout_commands/workflow/list",
136
154
  "scout_commands/workflow/task",
137
- "scout_commands/workflow/task_old",
138
155
  "share/color/color_names",
139
156
  "share/color/diverging_colors.hex",
140
157
  "share/software/install_helpers",
158
+ "share/templates/command",
159
+ "share/templates/workflow.rb",
141
160
  "test/scout/indiferent_hash/test_case_insensitive.rb",
142
161
  "test/scout/indiferent_hash/test_options.rb",
143
162
  "test/scout/log/test_color.rb",
@@ -146,6 +165,10 @@ Gem::Specification.new do |s|
146
165
  "test/scout/misc/test_filesystem.rb",
147
166
  "test/scout/misc/test_insist.rb",
148
167
  "test/scout/misc/test_system.rb",
168
+ "test/scout/offsite/test_ssh.rb",
169
+ "test/scout/offsite/test_step.rb",
170
+ "test/scout/offsite/test_sync.rb",
171
+ "test/scout/offsite/test_task.rb",
149
172
  "test/scout/open/test_lock.rb",
150
173
  "test/scout/open/test_remote.rb",
151
174
  "test/scout/open/test_stream.rb",
@@ -190,6 +213,7 @@ Gem::Specification.new do |s|
190
213
  "test/scout/tsv/test_open.rb",
191
214
  "test/scout/tsv/test_parser.rb",
192
215
  "test/scout/tsv/test_persist.rb",
216
+ "test/scout/tsv/test_stream.rb",
193
217
  "test/scout/tsv/test_transformer.rb",
194
218
  "test/scout/tsv/test_traverse.rb",
195
219
  "test/scout/tsv/test_util.rb",
@@ -200,11 +224,13 @@ Gem::Specification.new do |s|
200
224
  "test/scout/tsv/util/test_unzip.rb",
201
225
  "test/scout/work_queue/test_socket.rb",
202
226
  "test/scout/work_queue/test_worker.rb",
227
+ "test/scout/workflow/deployment/test_orchestrator.rb",
203
228
  "test/scout/workflow/step/test_dependencies.rb",
204
229
  "test/scout/workflow/step/test_info.rb",
205
230
  "test/scout/workflow/step/test_load.rb",
206
231
  "test/scout/workflow/step/test_provenance.rb",
207
232
  "test/scout/workflow/step/test_status.rb",
233
+ "test/scout/workflow/task/test_dependencies.rb",
208
234
  "test/scout/workflow/task/test_inputs.rb",
209
235
  "test/scout/workflow/test_definition.rb",
210
236
  "test/scout/workflow/test_documentation.rb",
@@ -213,16 +239,21 @@ Gem::Specification.new do |s|
213
239
  "test/scout/workflow/test_usage.rb",
214
240
  "test/scout/workflow/test_util.rb",
215
241
  "test/test_helper.rb",
216
- "test/test_scout-gear.rb"
242
+ "test/test_scout-gear.rb",
243
+ "test/test_scout.rb"
217
244
  ]
218
245
  s.homepage = "http://github.com/mikisvaz/scout-gear".freeze
219
246
  s.licenses = ["MIT".freeze]
220
- s.rubygems_version = "3.4.11".freeze
247
+ s.rubygems_version = "3.4.13".freeze
221
248
  s.summary = "basic gear for scouts".freeze
222
249
 
223
250
  s.specification_version = 4
224
251
 
225
252
  s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0"])
253
+ s.add_runtime_dependency(%q<net-ssh>.freeze, [">= 0"])
254
+ s.add_runtime_dependency(%q<matrix>.freeze, [">= 0"])
255
+ s.add_runtime_dependency(%q<sys-proctable>.freeze, [">= 0"])
256
+ s.add_runtime_dependency(%q<RubyInline>.freeze, [">= 0"])
226
257
  s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
227
258
  s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
228
259
  s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scout'
4
+
5
+ $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
+
7
+ options = SOPT.setup <<EOF
8
+
9
+ Print documentation for a module
10
+
11
+ $ #{$0} [<options>] [module]
12
+
13
+ If you don't specify the module it prints those available
14
+
15
+ -h--help Print this help
16
+ EOF
17
+ if options[:help]
18
+ if defined? scout_usage
19
+ scout_usage
20
+ else
21
+ puts SOPT.doc
22
+ end
23
+ exit 0
24
+ end
25
+
26
+
27
+ module_name = ARGV.first
28
+ if module_name.nil?
29
+ puts Rbbt.doc.lib.scout.glob("**/*.md").collect{|f| File.basename(f.unset_extension) } * "\n"
30
+ else
31
+ begin
32
+ puts Rbbt.doc.lib.scout[module_name].find_with_extension('md', :lib).read
33
+ rescue
34
+ puts Rbbt.doc.lib.scout.glob("**/*.md").select{|f| File.basename(f.unset_extension) == module_name }.first.read
35
+ end
36
+ end
37
+
data/scout_commands/find CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'scout-gear'
4
+ require 'scout/offsite'
4
5
 
5
6
  $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
7
 
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scout'
4
+ require 'scout/offsite'
5
+
6
+ $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
7
+
8
+ options = SOPT.setup <<EOF
9
+
10
+ Description of the tool
11
+
12
+ $ #{$0} [<options>] <where> <command> ... -- [<protected options>]
13
+
14
+ Run a command offsite. Use -- to make sure options reach the offsite
15
+
16
+ -h--help Print this help
17
+ EOF
18
+ if options[:help]
19
+ if defined? scout_usage
20
+ scout_usage
21
+ else
22
+ puts SOPT.doc
23
+ end
24
+ exit 0
25
+ end
26
+
27
+ where = ARGV.shift
28
+ command = ARGV.shift
29
+
30
+ puts SSHLine.command(where, command, ARGV)
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scout'
4
+
5
+ $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
+
7
+ options = SOPT.setup <<EOF
8
+
9
+ Produce a resource
10
+
11
+ $ #{$0} [<options>] <Resource> <file>
12
+
13
+ -h--help Print this help
14
+ -W--workflows* Workflows to use; 'all' for all in Scout.etc.workflows:
15
+ -r--requires* Files to require; 'all' for all in Scout.etc.requires:
16
+ -f--force Force the production if the file is already present
17
+ EOF
18
+ if options[:help]
19
+ if defined? scout_usage
20
+ scout_usage
21
+ else
22
+ puts SOPT.doc
23
+ end
24
+ exit 0
25
+ end
26
+
27
+ case options[:workflows]
28
+ when nil, false, "false", "none"
29
+ when "all"
30
+ Scout.etc.workflows.list.each do |workflow|
31
+ Workflow.require_workflow file
32
+ end if Scout.etc.workflows.exists?
33
+ else
34
+ options[:workflows].split(/[ ,;|]/).each do |workflow|
35
+ Workflow.require_workflow workflow
36
+ end
37
+ end
38
+
39
+ case options[:requires]
40
+ when nil, false, "false", "none"
41
+ when "all"
42
+ Scout.etc.requires.list.each do |file|
43
+ require file
44
+ end if Scout.etc.requires.exists?
45
+ else
46
+ options[:requires].split(/[ ,;|]/).each do |file|
47
+ require file
48
+ end
49
+ end
50
+
51
+ resource, path = ARGV
52
+
53
+ begin
54
+ resource = Kernel.const_get(resource)
55
+ rescue
56
+ begin
57
+ resource = Workflow.require_workflow resource
58
+ rescue
59
+ raise "Resource not found: #{ resource }"
60
+ end
61
+ end
62
+
63
+ force = options[:force]
64
+
65
+ puts resource[path].produce(force).find
66
+
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scout'
4
+
5
+ $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
+
7
+ options = SOPT.setup <<EOF
8
+
9
+ Print a template
10
+
11
+ $ #{$0} [<options>] <template> [<VAR>=<value>]*
12
+
13
+ Print a template making the substitutions that follow
14
+
15
+ -h--help Print this help
16
+ -s--sub* List a substitutions as a parameter instead
17
+ -s--var* List a substitutions as a parameter, variable name
18
+ -s--value* List a substitutions as a parameter, value
19
+ EOF
20
+ if options[:help]
21
+ if defined? scout_usage
22
+ scout_usage
23
+ else
24
+ puts SOPT.doc
25
+ end
26
+ exit 0
27
+ end
28
+
29
+ template, *subs = ARGV
30
+
31
+ raise MissingParameterException, :template if template.nil?
32
+
33
+ txt = Scout.share.templates[template].find_with_extension('rb').read
34
+
35
+ if options[:sub]
36
+ subs ||= []
37
+ subs << options[:sub]
38
+ end
39
+
40
+ if options[:var]
41
+ subs ||= []
42
+ subs << [options[:var], options[:value]] * "="
43
+ end
44
+
45
+
46
+ subs.each do |sub|
47
+ key, value = sub.split("=")
48
+
49
+ txt.gsub!(key, value)
50
+ end
51
+
52
+ puts txt
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'scout'
4
+
5
+ $0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
6
+
7
+ options = SOPT.setup <<EOF
8
+
9
+ Update scout installation
10
+
11
+ $ #{$0} [<options>] [gem]
12
+
13
+ If no gem is specified 'scout-gear' is selected.
14
+
15
+ -h--help Print this help
16
+ EOF
17
+ if options[:help]
18
+ if defined? scout_usage
19
+ scout_usage
20
+ else
21
+ puts SOPT.doc
22
+ end
23
+ exit 0
24
+ end
25
+
26
+ gem_name = ARGV.first
27
+ Misc.update_git(gem_name)
28
+
29
+
@@ -23,7 +23,19 @@ end
23
23
 
24
24
  path = ARGV.first
25
25
  raise MissingParameterException.new :step_path if path.nil?
26
- step = Step.load(path)
27
-
28
- puts step.info.to_json
26
+ step = Step.load(path.dup)
27
+
28
+ step.info.each do |k,v|
29
+ case v
30
+ when nil
31
+ next
32
+ when Exception
33
+ puts Log.color(:title, "Exception")
34
+ Log.exception v
35
+ else
36
+ puts [Log.color(:title, k), Log.fingerprint(v)] * " = "
37
+ end
38
+ rescue
39
+ next
40
+ end
29
41