tap 0.9.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. data/History +37 -30
  2. data/MIT-LICENSE +1 -1
  3. data/README +92 -44
  4. data/bin/tap +62 -75
  5. data/cmd/console.rb +42 -0
  6. data/cmd/destroy.rb +16 -0
  7. data/cmd/generate.rb +16 -0
  8. data/cmd/run.rb +126 -0
  9. data/doc/Class Reference +362 -0
  10. data/doc/Command Reference +153 -0
  11. data/doc/Tutorial +237 -0
  12. data/lib/tap.rb +6 -45
  13. data/lib/tap/app.rb +126 -500
  14. data/lib/tap/constants.rb +2 -29
  15. data/lib/tap/env.rb +555 -250
  16. data/lib/tap/file_task.rb +60 -103
  17. data/lib/tap/generator/base.rb +109 -0
  18. data/lib/tap/generator/destroy.rb +37 -0
  19. data/lib/tap/generator/generate.rb +61 -0
  20. data/lib/tap/generator/generators/command/command_generator.rb +16 -12
  21. data/lib/tap/generator/generators/command/templates/command.erb +13 -19
  22. data/lib/tap/generator/generators/config/config_generator.rb +18 -27
  23. data/lib/tap/generator/generators/config/templates/doc.erb +12 -0
  24. data/lib/tap/generator/generators/config/templates/nodoc.erb +8 -0
  25. data/lib/tap/generator/generators/file_task/file_task_generator.rb +16 -11
  26. data/lib/tap/generator/generators/file_task/templates/file.txt +11 -2
  27. data/lib/tap/generator/generators/file_task/templates/result.yml +6 -0
  28. data/lib/tap/generator/generators/file_task/templates/task.erb +24 -31
  29. data/lib/tap/generator/generators/file_task/templates/test.erb +18 -22
  30. data/lib/tap/generator/generators/root/root_generator.rb +45 -31
  31. data/lib/tap/generator/generators/root/templates/Rakefile +64 -41
  32. data/lib/tap/generator/generators/root/templates/gemspec +27 -0
  33. data/lib/tap/generator/generators/root/templates/tapfile +8 -0
  34. data/lib/tap/generator/generators/root/templates/test/tap_test_helper.rb +0 -0
  35. data/lib/tap/generator/generators/root/templates/test/tap_test_suite.rb +1 -1
  36. data/lib/tap/generator/generators/root/templates/test/tapfile_test.rb +15 -0
  37. data/lib/tap/generator/generators/task/task_generator.rb +21 -28
  38. data/lib/tap/generator/generators/task/templates/task.erb +13 -23
  39. data/lib/tap/generator/generators/task/templates/test.erb +15 -18
  40. data/lib/tap/generator/manifest.rb +14 -0
  41. data/lib/tap/patches/rake/rake_test_loader.rb +0 -0
  42. data/lib/tap/patches/rake/testtask.rb +0 -0
  43. data/lib/tap/patches/ruby19/backtrace_filter.rb +0 -0
  44. data/lib/tap/patches/ruby19/parsedate.rb +0 -0
  45. data/lib/tap/root.rb +260 -21
  46. data/lib/tap/support/aggregator.rb +11 -11
  47. data/lib/tap/support/assignments.rb +172 -0
  48. data/lib/tap/support/audit.rb +20 -18
  49. data/lib/tap/support/batchable.rb +21 -10
  50. data/lib/tap/support/batchable_class.rb +107 -0
  51. data/lib/tap/support/class_configuration.rb +154 -239
  52. data/lib/tap/support/command_line.rb +97 -102
  53. data/lib/tap/support/comment.rb +270 -0
  54. data/lib/tap/support/configurable.rb +86 -65
  55. data/lib/tap/support/configurable_class.rb +296 -0
  56. data/lib/tap/support/configuration.rb +122 -0
  57. data/lib/tap/support/constant.rb +70 -0
  58. data/lib/tap/support/constant_utils.rb +127 -0
  59. data/lib/tap/support/declarations.rb +111 -0
  60. data/lib/tap/support/executable.rb +30 -17
  61. data/lib/tap/support/executable_queue.rb +0 -0
  62. data/lib/tap/support/framework.rb +71 -0
  63. data/lib/tap/support/framework_class.rb +199 -0
  64. data/lib/tap/support/instance_configuration.rb +147 -0
  65. data/lib/tap/support/lazydoc.rb +428 -0
  66. data/lib/tap/support/manifest.rb +89 -0
  67. data/lib/tap/support/run_error.rb +0 -0
  68. data/lib/tap/support/shell_utils.rb +33 -9
  69. data/lib/tap/support/summary.rb +30 -0
  70. data/lib/tap/support/tdoc.rb +339 -134
  71. data/lib/tap/support/tdoc/tdoc_html_generator.rb +0 -0
  72. data/lib/tap/support/tdoc/tdoc_html_template.rb +0 -0
  73. data/lib/tap/support/templater.rb +180 -0
  74. data/lib/tap/support/validation.rb +409 -76
  75. data/lib/tap/support/versions.rb +5 -3
  76. data/lib/tap/task.rb +78 -174
  77. data/lib/tap/tasks/dump.rb +56 -0
  78. data/lib/tap/tasks/rake.rb +93 -0
  79. data/lib/tap/test.rb +3 -3
  80. data/lib/tap/test/env_vars.rb +2 -2
  81. data/lib/tap/test/file_methods.rb +19 -20
  82. data/lib/tap/test/script_methods.rb +144 -0
  83. data/lib/tap/test/subset_methods.rb +1 -1
  84. data/lib/tap/test/tap_methods.rb +28 -62
  85. data/lib/tap/workflow.rb +22 -39
  86. metadata +48 -179
  87. data/Basic Overview +0 -151
  88. data/Command Reference +0 -99
  89. data/Rakefile +0 -127
  90. data/Tutorial +0 -287
  91. data/lib/tap/cmd/console.rb +0 -31
  92. data/lib/tap/cmd/destroy.rb +0 -20
  93. data/lib/tap/cmd/generate.rb +0 -20
  94. data/lib/tap/cmd/run.rb +0 -151
  95. data/lib/tap/dump.rb +0 -57
  96. data/lib/tap/generator.rb +0 -91
  97. data/lib/tap/generator/generators/command/USAGE +0 -6
  98. data/lib/tap/generator/generators/config/USAGE +0 -21
  99. data/lib/tap/generator/generators/config/templates/config.erb +0 -1
  100. data/lib/tap/generator/generators/file_task/USAGE +0 -3
  101. data/lib/tap/generator/generators/file_task/templates/file.yml +0 -3
  102. data/lib/tap/generator/generators/generator/USAGE +0 -0
  103. data/lib/tap/generator/generators/generator/generator_generator.rb +0 -21
  104. data/lib/tap/generator/generators/generator/templates/generator.erb +0 -32
  105. data/lib/tap/generator/generators/generator/templates/usage.erb +0 -1
  106. data/lib/tap/generator/generators/root/USAGE +0 -0
  107. data/lib/tap/generator/generators/root/templates/ReadMe.txt +0 -0
  108. data/lib/tap/generator/generators/root/templates/tap.yml +0 -80
  109. data/lib/tap/generator/generators/task/USAGE +0 -3
  110. data/lib/tap/generator/generators/workflow/USAGE +0 -0
  111. data/lib/tap/generator/generators/workflow/templates/task.erb +0 -16
  112. data/lib/tap/generator/generators/workflow/templates/test.erb +0 -7
  113. data/lib/tap/generator/generators/workflow/workflow_generator.rb +0 -6
  114. data/lib/tap/generator/options.rb +0 -26
  115. data/lib/tap/generator/usage.rb +0 -26
  116. data/lib/tap/support/batchable_methods.rb +0 -34
  117. data/lib/tap/support/command_line_methods.rb +0 -76
  118. data/lib/tap/support/configurable_methods.rb +0 -224
  119. data/lib/tap/support/logger.rb +0 -88
  120. data/lib/tap/support/rake.rb +0 -43
  121. data/lib/tap/support/tdoc/config_attr.rb +0 -362
  122. data/test/app/config/another/task.yml +0 -1
  123. data/test/app/config/batch.yml +0 -2
  124. data/test/app/config/empty.yml +0 -0
  125. data/test/app/config/erb.yml +0 -2
  126. data/test/app/config/some/task.yml +0 -1
  127. data/test/app/config/template.yml +0 -2
  128. data/test/app/config/version-0.1.yml +0 -1
  129. data/test/app/config/version.yml +0 -1
  130. data/test/app/lib/app_test_task.rb +0 -3
  131. data/test/app_test.rb +0 -1849
  132. data/test/env/test_configure/recurse_a.yml +0 -2
  133. data/test/env/test_configure/recurse_b.yml +0 -2
  134. data/test/env/test_configure/tap.yml +0 -23
  135. data/test/env/test_load_env_config/dir/tap.yml +0 -3
  136. data/test/env/test_load_env_config/recurse_a.yml +0 -2
  137. data/test/env/test_load_env_config/recurse_b.yml +0 -2
  138. data/test/env/test_load_env_config/tap.yml +0 -3
  139. data/test/env_test.rb +0 -198
  140. data/test/file_task/config/batch.yml +0 -2
  141. data/test/file_task/config/configured.yml +0 -1
  142. data/test/file_task/old_file_one.txt +0 -0
  143. data/test/file_task/old_file_two.txt +0 -0
  144. data/test/file_task_test.rb +0 -1291
  145. data/test/root/alt_lib/alt_module.rb +0 -4
  146. data/test/root/file.txt +0 -0
  147. data/test/root/glob/one.txt +0 -0
  148. data/test/root/glob/two.txt +0 -0
  149. data/test/root/lib/absolute_alt_filepath.rb +0 -2
  150. data/test/root/lib/alternative_filepath.rb +0 -2
  151. data/test/root/lib/another_module.rb +0 -2
  152. data/test/root/lib/nested/some_module.rb +0 -4
  153. data/test/root/lib/no_module_included.rb +0 -0
  154. data/test/root/lib/some/module.rb +0 -4
  155. data/test/root/lib/some_class.rb +0 -2
  156. data/test/root/lib/some_module.rb +0 -3
  157. data/test/root/load_path/load_path_module.rb +0 -2
  158. data/test/root/load_path/skip_module.rb +0 -2
  159. data/test/root/mtime/older.txt +0 -0
  160. data/test/root/unload/full_path.rb +0 -2
  161. data/test/root/unload/loaded_by_nested.rb +0 -2
  162. data/test/root/unload/nested/nested_load.rb +0 -6
  163. data/test/root/unload/nested/nested_with_ext.rb +0 -4
  164. data/test/root/unload/nested/relative_path.rb +0 -4
  165. data/test/root/unload/older.rb +0 -2
  166. data/test/root/unload/unload_base.rb +0 -9
  167. data/test/root/versions/another.yml +0 -0
  168. data/test/root/versions/file-0.1.2.yml +0 -0
  169. data/test/root/versions/file-0.1.yml +0 -0
  170. data/test/root/versions/file.yml +0 -0
  171. data/test/root_test.rb +0 -718
  172. data/test/support/aggregator_test.rb +0 -99
  173. data/test/support/audit_test.rb +0 -445
  174. data/test/support/batchable_test.rb +0 -74
  175. data/test/support/class_configuration_test.rb +0 -331
  176. data/test/support/command_line_test.rb +0 -58
  177. data/test/support/configurable/config/configured.yml +0 -2
  178. data/test/support/configurable_test.rb +0 -295
  179. data/test/support/executable_queue_test.rb +0 -103
  180. data/test/support/executable_test.rb +0 -38
  181. data/test/support/logger_test.rb +0 -31
  182. data/test/support/rake_test.rb +0 -37
  183. data/test/support/shell_utils_test.rb +0 -24
  184. data/test/support/tdoc_test.rb +0 -370
  185. data/test/support/validation_test.rb +0 -54
  186. data/test/support/versions_test.rb +0 -103
  187. data/test/tap_test_helper.rb +0 -57
  188. data/test/tap_test_suite.rb +0 -7
  189. data/test/task/config/batch.yml +0 -2
  190. data/test/task/config/batched.yml +0 -2
  191. data/test/task/config/configured.yml +0 -1
  192. data/test/task/config/example.yml +0 -1
  193. data/test/task_base_test.rb +0 -24
  194. data/test/task_syntax_test.rb +0 -300
  195. data/test/task_test.rb +0 -320
  196. data/test/test/env_vars_test.rb +0 -48
  197. data/test/test/file_methods/test_assert_files/expected/one.txt +0 -1
  198. data/test/test/file_methods/test_assert_files/expected/two.txt +0 -1
  199. data/test/test/file_methods/test_assert_files/input/one.txt +0 -1
  200. data/test/test/file_methods/test_assert_files/input/two.txt +0 -1
  201. data/test/test/file_methods/test_assert_files_can_have_no_expected_files_if_specified/input/one.txt +0 -1
  202. data/test/test/file_methods/test_assert_files_can_have_no_expected_files_if_specified/input/two.txt +0 -1
  203. data/test/test/file_methods/test_assert_files_fails_for_different_content/expected/one.txt +0 -1
  204. data/test/test/file_methods/test_assert_files_fails_for_different_content/expected/two.txt +0 -1
  205. data/test/test/file_methods/test_assert_files_fails_for_different_content/input/one.txt +0 -1
  206. data/test/test/file_methods/test_assert_files_fails_for_different_content/input/two.txt +0 -1
  207. data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/expected/one.txt +0 -1
  208. data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/input/one.txt +0 -1
  209. data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/input/two.txt +0 -1
  210. data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/expected/one.txt +0 -1
  211. data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/expected/two.txt +0 -1
  212. data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/input/one.txt +0 -1
  213. data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/input/two.txt +0 -1
  214. data/test/test/file_methods/test_assert_files_fails_for_no_expected_files/input/one.txt +0 -1
  215. data/test/test/file_methods/test_assert_files_fails_for_no_expected_files/input/two.txt +0 -1
  216. data/test/test/file_methods/test_method_glob/expected/file.yml +0 -0
  217. data/test/test/file_methods/test_method_glob/expected/file_1.txt +0 -0
  218. data/test/test/file_methods/test_method_glob/expected/file_2.txt +0 -0
  219. data/test/test/file_methods_doc/test_sub/expected/one.txt +0 -1
  220. data/test/test/file_methods_doc/test_sub/expected/two.txt +0 -1
  221. data/test/test/file_methods_doc/test_sub/input/one.txt +0 -1
  222. data/test/test/file_methods_doc/test_sub/input/two.txt +0 -1
  223. data/test/test/file_methods_doc_test.rb +0 -29
  224. data/test/test/file_methods_test.rb +0 -275
  225. data/test/test/subset_methods_test.rb +0 -171
  226. data/test/test/tap_methods/test_assert_files/expected/task/name/a.txt +0 -1
  227. data/test/test/tap_methods/test_assert_files/expected/task/name/b.txt +0 -1
  228. data/test/test/tap_methods/test_assert_files/input/a.txt +0 -1
  229. data/test/test/tap_methods/test_assert_files/input/b.txt +0 -1
  230. data/test/test/tap_methods_test.rb +0 -399
  231. data/test/workflow_test.rb +0 -120
  232. data/vendor/rails_generator.rb +0 -56
  233. data/vendor/rails_generator/base.rb +0 -263
  234. data/vendor/rails_generator/commands.rb +0 -581
  235. data/vendor/rails_generator/generated_attribute.rb +0 -42
  236. data/vendor/rails_generator/lookup.rb +0 -209
  237. data/vendor/rails_generator/manifest.rb +0 -53
  238. data/vendor/rails_generator/options.rb +0 -143
  239. data/vendor/rails_generator/scripts.rb +0 -83
  240. data/vendor/rails_generator/scripts/destroy.rb +0 -7
  241. data/vendor/rails_generator/scripts/generate.rb +0 -7
  242. data/vendor/rails_generator/scripts/update.rb +0 -12
  243. data/vendor/rails_generator/simple_logger.rb +0 -46
  244. data/vendor/rails_generator/spec.rb +0 -44
data/History CHANGED
@@ -1,28 +1,20 @@
1
- == 0.7.9 / 2007-09-14
1
+ == 0.10.0 / 2008-08-08
2
2
 
3
- * Initial testing release with partial documentation
3
+ Major revision. Reworked configurations and the execution
4
+ environment. Added Lazydoc documentation. Backwards incompatible.
5
+ Development is now on GitHub.
4
6
 
5
- == 0.8.0 / 2007-12-08 revision 138
7
+ == 0.9.1 / 2008-04-26 revision 253
6
8
 
7
- Major update to Tap. Many changes in this release ARE NOT BACKWARD COMPATIBLE.
8
- Documentation is still patchy, but improving.
9
+ Relatively minor update, but with one important refactoring that
10
+ removes the Tap::Script module. This breaks backward compatibility
11
+ but only should affect people who have made their own commands.
12
+ Simply sub Tap::Support::CommandLine for Tap::Script to fix.
9
13
 
10
- * Expanded/reworked application configuration, allowing specification of gems
11
- to be loaded as task libraries.
12
- * Default app config file is now tap.yml (from app.yml)
13
- * Updated and improved generators
14
- * Included rails_generators in distribution, removing rails dependency
15
- * Reworked many classes to clean up interface
16
- * Reworked testing methods
17
- * Improved configuration for tasks
18
- * Optimized loading
19
- * Reworked threading model
20
- * Addition of TDoc documentation
21
- * Reworked tap command and subcommands
22
- * Added packaging into executables
23
- * Updated to ActiveSupport 2.0.1
24
- * documentation, documentation, documentation
25
- * many other things as well...
14
+ * Added constants methods (ex try_constantize) to String
15
+ * Added gem discovery when no tap.yml file is present
16
+ * Cleanup and refactoring -- removal of Tap::Script
17
+ * Bug fix for JRuby 1.1.1
26
18
 
27
19
  == 0.9.0 / 2008-04-09 revision 246
28
20
 
@@ -49,14 +41,29 @@ Major update to Tap. Many changes in this release ARE NOT BACKWARD COMPATIBLE.
49
41
  * Removed condition blocks from tasks
50
42
  * many other things also...
51
43
 
52
- == 0.9.1 / 2008-04-26 revision 253
44
+ == 0.8.0 / 2007-12-08 revision 138
53
45
 
54
- Relatively minor update, but with one important refactoring that
55
- removes the Tap::Script module. This breaks backward compatibility
56
- but only should affect people who have made their own commands.
57
- Simply sub Tap::Support::CommandLine for Tap::Script to fix.
46
+ Major update to Tap. Many changes in this release ARE NOT BACKWARD COMPATIBLE.
47
+ Documentation is still patchy, but improving.
48
+
49
+ * Expanded/reworked application configuration, allowing specification of gems
50
+ to be loaded as task libraries.
51
+ * Default app config file is now tap.yml (from app.yml)
52
+ * Updated and improved generators
53
+ * Included rails_generators in distribution, removing rails dependency
54
+ * Reworked many classes to clean up interface
55
+ * Reworked testing methods
56
+ * Improved configuration for tasks
57
+ * Optimized loading
58
+ * Reworked threading model
59
+ * Addition of TDoc documentation
60
+ * Reworked tap command and subcommands
61
+ * Added packaging into executables
62
+ * Updated to ActiveSupport 2.0.1
63
+ * documentation, documentation, documentation
64
+ * many other things as well...
65
+
66
+ == 0.7.9 / 2007-09-14
67
+
68
+ * Initial testing release with partial documentation
58
69
 
59
- * Added constants methods (ex try_constantize) to String
60
- * Added gem discovery when no tap.yml file is present
61
- * Cleanup and refactoring -- removal of Tap::Script
62
- * Bug fix for JRuby 1.1.1
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2007, Regents of the University of Colorado.
1
+ Copyright (c) 2006-2008, Regents of the University of Colorado.
2
2
  Developer:: Simon Chiang, Biomolecular Structure Program, Hansen Lab
3
3
  Support:: CU Denver School of Medicine Deans Academic Enrichment Fund
4
4
 
data/README CHANGED
@@ -1,52 +1,103 @@
1
- = Tap (Task Application)
1
+ = {Tap (Task Application)}[http://tap.rubyforge.org]
2
2
 
3
- A framework for creating configurable, distributable, and easy-to-use tasks and workflow applications.
4
-
5
- See the {website}[http://tap.rubyforge.org] for more information.
3
+ A framework for creating configurable, distributable tasks and workflows.
6
4
 
7
5
  == Description
8
6
 
9
- Tap provides a framework to define, configure, and join tasks into workflows. Tap provides a lot of niceties like generators and libraries geared towards testing tasks, generating documentation, as well as task execution and distribution. Tasks are immediately available from the command line through the 'tap' command.
7
+ Tap tasks are designed to be easy to test, subclass, use in scripts, and run
8
+ from the command line. Tap provides methods to generate and utilize config
9
+ files, join tasks into workflows, as well as dump and reuse results. Task
10
+ libraries are readily shared as gems. Check out the links for tutorials,
11
+ development, and bug tracking.
10
12
 
11
- Make a task:
13
+ * {Tutorial}[link:files/doc/Tutorial.html], {Class}[link:files/doc/Class%20Reference.html] and {Command}[link:files/doc/Command%20Reference.html] Reference
14
+ * Website[http://tap.rubyforge.org]
15
+ * Lighthouse[http://bahuvrihi.lighthouseapp.com/projects/9908-tap-task-application/overview]
16
+ * Github[http://github.com/bahuvrihi/tap/tree/master]
12
17
 
13
- % tap generate task sample/task
18
+ === Additional Notes:
14
19
 
15
- Run the task setting the 'key' configuration:
16
-
17
- % tap run -- sample/task --key=value input
18
- ctl-i prints information
19
- ctl-c interupts execution
20
- beginning run...
21
- I[10:53:11] sample/task input was processed with value
22
-
23
- Interact with the task using irb:
20
+ - Tap and Rake[http://rake.rubyforge.org/] are targeted at different problems,
21
+ but play well together. See Tap::Tasks::Rake to use rake tasks in tap.
22
+ - Tap is tested on MRI (the standard Ruby interpreter, versions 1.8.6 and
23
+ 1.9.0) and JRuby[http://jruby.codehaus.org/].
24
+
25
+ === Usage
26
+
27
+ A simple task illustrates the usage of tap:
28
+
29
+ # Goodnight::manifest your basic goodnight moon task
30
+ # Says goodnight with a configurable message.
31
+ class Goodnight < Tap::Task
32
+
33
+ config :message, 'goodnight' # a goodnight message
34
+
35
+ def process(name)
36
+ log(message, name)
37
+ "#{message} #{name}"
38
+ end
39
+ end
24
40
 
25
- % tap console
26
- irb(main):001:0> t = app.task('sample/task', :key => 'value')
27
- irb(main):002:0> t.enq('input')
28
- irb(main):003:0> app.run
29
- I[10:55:17] sample/task input was processed with value
41
+ Tap pulls documentation out of task classes to generate manifests:
30
42
 
31
- Additional Notes:
43
+ % tap run -T
44
+ sample:
45
+ goodnight # your basic goodnight moon task
46
+ tap:
47
+ dump # the default dump task
48
+ rake # run rake tasks
32
49
 
33
- - Tap can incorporate and run Rake[http://rake.rubyforge.org/] tasks as well as Tap tasks.
34
- - Tap task libraries are designed for distribution as gems.
35
- - Tap is tested on both MRI (the standard Ruby interpreter, versions 1.8.6 and 1.9.0) and JRuby[http://jruby.codehaus.org/].
50
+ And help:
51
+
52
+ % tap run -- goodnight --help
53
+ Goodnight -- your basic goodnight moon task
54
+ --------------------------------------------------------------------------------
55
+ Says goodnight with a configurable message.
56
+ --------------------------------------------------------------------------------
57
+ usage: tap run -- goodnight NAME
58
+
59
+ configurations:
60
+ --message MESSAGE a goodnight message
61
+
62
+ options:
63
+ -h, --help Print this help
64
+ --name NAME Specify a name
65
+ --use FILE Loads inputs from file
66
+
67
+
68
+ Tasks are immediately available to run:
69
+
70
+ % tap run -- goodnight moon
71
+ I[00:09:55] goodnight moon
72
+
73
+
74
+ % tap run -- goodnight moon --message hello
75
+ I[00:10:01] hello moon
76
+
77
+ Tap comes with generators and allows distribution of task libraries as gems.
78
+ This can be illustrated by installing the
79
+ {sample_tasks}[http://tap.rubyforge.org/sample_tasks] gem:
80
+
81
+ % gem install sample_tasks
82
+ % tap run -T
83
+ sample:
84
+ goodnight # your basic goodnight moon task
85
+ sample_tasks:
86
+ concat # concatenate files with formatting
87
+ copy # copies files
88
+ grep # search for lines matching a pattern
89
+ print_tree # print a directory tree
90
+ tap:
91
+ dump # the default dump task
92
+ rake # run rake tasks
36
93
 
37
94
  === Bugs/Known Issues
38
95
 
39
96
  - Some inconsequential tests on JRuby fail due to bugs in JRuby itself.
40
97
  - Several patches are required so that Tap runs properly on MRI 1.9.0. These
41
98
  will likely resolve themselves as 1.9.0 becomes stable.
42
- - Some code is still in progress; in general the well-documented code is stable.
43
-
44
- == Info
45
-
46
- Copyright (c) 2006-2007, Regents of the University of Colorado.
47
- Developer:: {Simon Chiang}[http://bahuvrihi.wordpress.com], {Biomolecular Structure Program}[http://biomol.uchsc.edu/], {Hansen Lab}[http://hsc-proteomics.uchsc.edu/hansenlab/]
48
- Support:: CU Denver School of Medicine Deans Academic Enrichment Fund
49
- Licence:: MIT-Style
99
+ - Despite the talk of workflows, the Workflow class should still be considered
100
+ in progress. Tasks themselves are stable.
50
101
 
51
102
  == Installation
52
103
 
@@ -54,18 +105,15 @@ Tap is available as a gem on RubyForge[http://rubyforge.org/projects/tap]. Use:
54
105
 
55
106
  % gem install tap
56
107
 
57
- See the tutorial or check out the {website}[http://tap.rubyforge.org] to get started using Tap programatically.
108
+ Tap requires an updated version of RubyGems[http://docs.rubygems.org/] (>= 1.2.0). To check the version and update RubyGems:
58
109
 
59
- == Credits
110
+ % gem --version
111
+ % gem --update system
60
112
 
61
- A great deal of inspiration came from other excellent open-source projects including Rake[http://rake.rubyforge.org] and {Ruby on Rails}[http://www.rubyonrails.org].
62
-
63
- Thanks to my advisor {Dr. Kirk Hansen}[http://hsc-proteomics.uchsc.edu/hansenlab/] for his patience in letting me work on this project, and for putting together an awesome lab.
64
-
65
- Most of all I would like to <b>thank my family</b> for their never-ending support.
66
-
67
- === Code
68
-
69
- Tap uses ActiveSupport for dependencies loading and a variety of other extensions. Tap uses Rails generators and redistributes the code in the gem, to avoid an additional dependency.
113
+ == Info
70
114
 
115
+ Copyright (c) 2006-2008, Regents of the University of Colorado.
116
+ Developer:: {Simon Chiang}[http://bahuvrihi.wordpress.com], {Biomolecular Structure Program}[http://biomol.uchsc.edu/], {Hansen Lab}[http://hsc-proteomics.uchsc.edu/hansenlab/]
117
+ Support:: CU Denver School of Medicine Deans Academic Enrichment Fund
118
+ Licence:: {MIT-Style}[link:files/MIT-LICENSE.html]
71
119
 
data/bin/tap CHANGED
@@ -8,120 +8,107 @@
8
8
  # help:
9
9
  # tap help # prints this help
10
10
  # tap command --help # prints help for 'command'
11
- #
11
+ #
12
12
 
13
- require File.join( File.dirname(__FILE__), "../lib/tap.rb")
13
+ tap_root_dir = File.dirname(__FILE__) + "/.."
14
+ require "#{tap_root_dir}/lib/tap.rb"
14
15
 
15
16
  # setup the environment
16
- env = Tap::Env.instance
17
- app = Tap::App.instance
18
-
19
- env.logger = app.logger
20
- env.debug_setup if ARGV.delete('-d-')
17
+ begin
18
+
19
+ $DEBUG = true if ARGV.delete('-d-')
20
+ before = nil
21
+ after = nil
22
+ aliases = nil
21
23
 
22
- before = nil
23
- after = nil
24
+ app = Tap::App.instance
25
+ env = Tap::Env.instantiate(app, Tap::Env.load_config(Tap::Env::GLOBAL_CONFIG_FILE), app.logger) do |unhandled_configs|
26
+ before = unhandled_configs.delete(:before)
27
+ after = unhandled_configs.delete(:after)
28
+
29
+ aliases = unhandled_configs.delete(:alias)
30
+ Tap::Support::Validation.validate(aliases, [Hash]) if aliases
24
31
 
25
- def handle_error(err)
26
- case
27
- when $DEBUG
28
- puts err.message
29
- puts
30
- puts err.backtrace
31
- when Tap::App.instance.debug? then raise err
32
- else puts err.message
32
+ unless unhandled_configs.empty?
33
+ local.log(:warn, "ignoring non-env configs: #{unhandled_configs.keys.join(',')}", Logger::DEBUG)
34
+ end
33
35
  end
34
- end
35
-
36
- # configure the app to tap.yml if it exists
37
- default_config_file = Tap::Env::DEFAULT_CONFIG_FILE
38
- begin
39
36
 
40
- env.load_config(default_config_file, app) do |non_env_configs|
41
- before = non_env_configs.delete('before')
42
- after = non_env_configs.delete('after')
43
-
44
- app.reconfigure(non_env_configs)
37
+ # add all gems if no gems are specified (Note this is VERY SLOW ~ 1/3 the overhead for tap)
38
+ if !File.exists?(Tap::Env::DEFAULT_CONFIG_FILE)
39
+ env.gems = Tap::Env.known_gems(true)
45
40
  end
46
41
 
47
- env.discover_gems unless File.exists?(default_config_file)
42
+ tap = Tap::Env.instance_for(tap_root_dir)
43
+ env.push(tap)
48
44
 
49
- rescue(Exception)
45
+ rescue(Tap::Env::ConfigError)
50
46
  # catch errors and exit gracefully
51
47
  # (errors usu from gem loading errors)
52
- puts "Configuration error: #{$!.message}"
53
- puts $!.backtrace if $DEBUG
54
- puts "Check #{default_config_file} configurations"
48
+ puts $!.message
55
49
  exit(1)
56
50
  end
57
51
 
58
- # alert the user to the root directory if it's not Dir.pwd
59
- unless app.options.quiet || app.root == File.expand_path(Dir.pwd)
60
- puts "root: #{app.root}"
52
+ #
53
+ # setup after script
54
+ #
55
+
56
+ at_exit do
57
+ begin
58
+ eval(after) if after != nil
59
+ rescue(Exception)
60
+ puts "Error in after script."
61
+ env.handle_error($!)
62
+ exit(1)
63
+ end
61
64
  end
62
65
 
63
66
  #
64
67
  # run before script
65
68
  #
69
+
66
70
  begin
67
- eval(before.to_s)
68
- rescue
71
+ eval(before) if before != nil
72
+ rescue(Exception)
69
73
  puts "Error in before script."
70
- handle_error($!)
74
+ env.handle_error($!)
71
75
  exit(1)
72
- end
76
+ end
77
+
78
+ #
79
+ # run tap
80
+ #
73
81
 
74
82
  begin
75
- available_commands = env.commands
83
+ env.activate
84
+
76
85
  command = ARGV.shift
86
+ if aliases && aliases.has_key?(command)
87
+ aliases[command].reverse_each {|arg| ARGV.unshift(arg)}
88
+ command = ARGV.shift
89
+ end
77
90
 
78
91
  case command
79
- when "--help", "-h", "help", "?", nil
92
+ when nil, '--help'
80
93
  # give some help
81
- File.open(__FILE__) do |file|
82
- bang_line = true
83
- file.each_line do |line|
84
- if bang_line
85
- bang_line = false
86
- next
87
- end
88
-
89
- break if line !~ /^#\s?(.*)/
90
- puts $1
91
- end
92
- end
94
+ require 'tap/support/command_line'
93
95
 
96
+ puts Tap::Support::CommandLine.usage(__FILE__)
94
97
  puts
95
98
  puts "available commands:"
96
-
97
- commands = available_commands.keys
98
- commands.unshift("help")
99
-
100
- print " "
101
- puts commands.sort.join("\n ")
99
+ puts env.summarize(:commands)
102
100
  puts
103
- puts "version #{Tap::VERSION} -- #{Tap::WEBSITE}"
101
+ puts "version #{Tap::VERSION} -- #{Tap::WEBSITE}"
104
102
  else
105
- if available_commands.has_key?(command)
106
- # run the command, if it exists
107
- load available_commands[command]
103
+ if path = env.search(:commands, command)
104
+ load path # run the command, if it exists
108
105
  else
109
106
  puts "Unknown command: '#{command}'"
110
107
  puts "Type 'tap help' for usage information."
111
108
  end
112
109
  end
113
110
  rescue
114
- handle_error($!)
115
- puts "Type 'tap #{command} --help' for usage information."
111
+ env.handle_error($!)
116
112
  end
117
113
 
118
- #
119
- # run after script
120
- #
121
- begin
122
- eval(after.to_s)
123
- rescue
124
- puts "Error in after script."
125
- handle_error($!)
126
- exit(1)
127
- end
114
+ exit(0)
data/cmd/console.rb ADDED
@@ -0,0 +1,42 @@
1
+ # tap console {options}
2
+ #
3
+ # Opens up an IRB session with Tap initialized to the configurations
4
+ # in tap.yml. Access the Tap::App.instance through 'app'.
5
+
6
+ #
7
+ # handle options
8
+ #
9
+
10
+ OptionParser.new do |opts|
11
+ opts.separator ""
12
+ opts.separator "options:"
13
+
14
+ opts.on("-h", "--help", "Show this message") do
15
+ opts.banner = Tap::Support::CommandLine.usage(__FILE__)
16
+ puts opts
17
+ exit
18
+ end
19
+ end.parse!(ARGV)
20
+
21
+ require "irb"
22
+
23
+ def app
24
+ Tap::App.instance
25
+ end
26
+
27
+ def env
28
+ Tap::Env.instance
29
+ end
30
+
31
+ IRB.start
32
+
33
+ # Handles a bug in IRB that causes exit to throw :IRB_EXIT
34
+ # and consequentially make a warning message, even on a
35
+ # clean exit. This module resets exit to the original
36
+ # aliased method.
37
+ module CleanExit # :nodoc:
38
+ def exit(ret = 0)
39
+ __exit__(ret)
40
+ end
41
+ end
42
+ IRB.CurrentContext.extend CleanExit