tap 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Basic Overview b/data/Basic → Overview +0 -0
- data/Command Reference b/data/Command → Reference +0 -0
- data/History +14 -4
- data/MIT-LICENSE +0 -0
- data/README +0 -0
- data/Rakefile +0 -0
- data/Tutorial +0 -0
- data/bin/tap +11 -14
- data/lib/tap.rb +10 -1
- data/lib/tap/app.rb +1 -1
- data/lib/tap/cmd/console.rb +2 -6
- data/lib/tap/cmd/destroy.rb +0 -0
- data/lib/tap/cmd/generate.rb +0 -0
- data/lib/tap/cmd/run.rb +72 -77
- data/lib/tap/constants.rb +33 -2
- data/lib/tap/dump.rb +0 -0
- data/lib/tap/env.rb +40 -21
- data/lib/tap/file_task.rb +0 -0
- data/lib/tap/generator.rb +0 -0
- data/lib/tap/generator/generators/command/USAGE +0 -0
- data/lib/tap/generator/generators/command/command_generator.rb +0 -0
- data/lib/tap/generator/generators/command/templates/command.erb +2 -6
- data/lib/tap/generator/generators/config/USAGE +0 -0
- data/lib/tap/generator/generators/config/config_generator.rb +0 -0
- data/lib/tap/generator/generators/config/templates/config.erb +0 -0
- data/lib/tap/generator/generators/file_task/USAGE +0 -0
- data/lib/tap/generator/generators/file_task/file_task_generator.rb +0 -0
- data/lib/tap/generator/generators/file_task/templates/file.txt +0 -0
- data/lib/tap/generator/generators/file_task/templates/file.yml +0 -0
- data/lib/tap/generator/generators/file_task/templates/task.erb +0 -0
- data/lib/tap/generator/generators/file_task/templates/test.erb +0 -0
- data/lib/tap/generator/generators/generator/USAGE +0 -0
- data/lib/tap/generator/generators/generator/generator_generator.rb +0 -0
- data/lib/tap/generator/generators/generator/templates/generator.erb +0 -0
- data/lib/tap/generator/generators/generator/templates/usage.erb +0 -0
- data/lib/tap/generator/generators/root/USAGE +0 -0
- data/lib/tap/generator/generators/root/root_generator.rb +0 -0
- data/lib/tap/generator/generators/root/templates/Rakefile +0 -0
- data/lib/tap/generator/generators/root/templates/ReadMe.txt +0 -0
- data/lib/tap/generator/generators/root/templates/tap.yml +1 -0
- data/lib/tap/generator/generators/root/templates/test/tap_test_helper.rb +0 -0
- data/lib/tap/generator/generators/root/templates/test/tap_test_suite.rb +0 -0
- data/lib/tap/generator/generators/task/USAGE +0 -0
- data/lib/tap/generator/generators/task/task_generator.rb +0 -0
- data/lib/tap/generator/generators/task/templates/task.erb +0 -0
- data/lib/tap/generator/generators/task/templates/test.erb +0 -0
- data/lib/tap/generator/generators/workflow/USAGE +0 -0
- data/lib/tap/generator/generators/workflow/templates/task.erb +0 -0
- data/lib/tap/generator/generators/workflow/templates/test.erb +0 -0
- data/lib/tap/generator/generators/workflow/workflow_generator.rb +0 -0
- data/lib/tap/generator/options.rb +0 -0
- data/lib/tap/generator/usage.rb +0 -0
- data/lib/tap/patches/rake/rake_test_loader.rb +0 -0
- data/lib/tap/patches/rake/testtask.rb +0 -0
- data/lib/tap/patches/ruby19/backtrace_filter.rb +0 -0
- data/lib/tap/patches/ruby19/parsedate.rb +0 -0
- data/lib/tap/root.rb +0 -0
- data/lib/tap/support/aggregator.rb +0 -0
- data/lib/tap/support/audit.rb +0 -0
- data/lib/tap/support/batchable.rb +2 -25
- data/lib/tap/support/batchable_methods.rb +34 -0
- data/lib/tap/support/class_configuration.rb +0 -0
- data/lib/tap/support/command_line.rb +103 -0
- data/lib/tap/support/command_line_methods.rb +76 -0
- data/lib/tap/support/configurable.rb +1 -0
- data/lib/tap/support/configurable_methods.rb +1 -73
- data/lib/tap/support/executable.rb +0 -0
- data/lib/tap/support/executable_queue.rb +0 -0
- data/lib/tap/support/logger.rb +0 -0
- data/lib/tap/support/rake.rb +0 -0
- data/lib/tap/support/run_error.rb +0 -0
- data/lib/tap/support/shell_utils.rb +0 -0
- data/lib/tap/support/tdoc.rb +0 -0
- data/lib/tap/support/tdoc/config_attr.rb +0 -0
- data/lib/tap/support/tdoc/tdoc_html_generator.rb +0 -0
- data/lib/tap/support/tdoc/tdoc_html_template.rb +0 -0
- data/lib/tap/support/validation.rb +0 -0
- data/lib/tap/support/versions.rb +0 -0
- data/lib/tap/task.rb +1 -0
- data/lib/tap/test.rb +0 -0
- data/lib/tap/test/env_vars.rb +0 -0
- data/lib/tap/test/file_methods.rb +1 -1
- data/lib/tap/test/subset_methods.rb +0 -0
- data/lib/tap/test/tap_methods.rb +0 -0
- data/lib/tap/workflow.rb +1 -0
- data/test/app/config/another/task.yml +0 -0
- data/test/app/config/batch.yml +0 -0
- data/test/app/config/empty.yml +0 -0
- data/test/app/config/erb.yml +0 -0
- data/test/app/config/some/task.yml +0 -0
- data/test/app/config/template.yml +0 -0
- data/test/app/config/version-0.1.yml +0 -0
- data/test/app/config/version.yml +0 -0
- data/test/app/lib/app_test_task.rb +0 -0
- data/test/app_test.rb +0 -0
- data/test/env/test_configure/recurse_a.yml +0 -0
- data/test/env/test_configure/recurse_b.yml +0 -0
- data/test/env/test_configure/tap.yml +0 -0
- data/test/env/test_load_env_config/dir/tap.yml +0 -0
- data/test/env/test_load_env_config/recurse_a.yml +0 -0
- data/test/env/test_load_env_config/recurse_b.yml +0 -0
- data/test/env/test_load_env_config/tap.yml +0 -0
- data/test/env_test.rb +0 -0
- data/test/file_task/config/batch.yml +0 -0
- data/test/file_task/config/configured.yml +0 -0
- data/test/file_task/old_file_one.txt +0 -0
- data/test/file_task/old_file_two.txt +0 -0
- data/test/file_task_test.rb +0 -0
- data/test/root/alt_lib/alt_module.rb +0 -0
- data/test/root/file.txt +0 -0
- data/test/root/glob/one.txt +0 -0
- data/test/root/glob/two.txt +0 -0
- data/test/root/lib/absolute_alt_filepath.rb +0 -0
- data/test/root/lib/alternative_filepath.rb +0 -0
- data/test/root/lib/another_module.rb +0 -0
- data/test/root/lib/nested/some_module.rb +0 -0
- data/test/root/lib/no_module_included.rb +0 -0
- data/test/root/lib/some/module.rb +0 -0
- data/test/root/lib/some_class.rb +0 -0
- data/test/root/lib/some_module.rb +0 -0
- data/test/root/load_path/load_path_module.rb +0 -0
- data/test/root/load_path/skip_module.rb +0 -0
- data/test/root/mtime/older.txt +0 -0
- data/test/root/unload/full_path.rb +0 -0
- data/test/root/unload/loaded_by_nested.rb +0 -0
- data/test/root/unload/nested/nested_load.rb +0 -0
- data/test/root/unload/nested/nested_with_ext.rb +0 -0
- data/test/root/unload/nested/relative_path.rb +0 -0
- data/test/root/unload/older.rb +0 -0
- data/test/root/unload/unload_base.rb +0 -0
- data/test/root/versions/another.yml +0 -0
- data/test/root/versions/file-0.1.2.yml +0 -0
- data/test/root/versions/file-0.1.yml +0 -0
- data/test/root/versions/file.yml +0 -0
- data/test/root_test.rb +0 -0
- data/test/support/aggregator_test.rb +0 -0
- data/test/support/audit_test.rb +0 -0
- data/test/support/batchable_test.rb +0 -0
- data/test/support/class_configuration_test.rb +0 -0
- data/test/{script_test.rb → support/command_line_test.rb} +21 -21
- data/test/support/configurable/config/configured.yml +0 -0
- data/test/support/configurable_test.rb +0 -0
- data/test/support/executable_queue_test.rb +0 -0
- data/test/support/executable_test.rb +0 -0
- data/test/support/logger_test.rb +0 -0
- data/test/support/rake_test.rb +0 -0
- data/test/support/shell_utils_test.rb +0 -0
- data/test/support/tdoc_test.rb +0 -0
- data/test/support/validation_test.rb +0 -0
- data/test/support/versions_test.rb +0 -0
- data/test/tap_test_helper.rb +0 -0
- data/test/tap_test_suite.rb +0 -0
- data/test/task/config/batch.yml +0 -0
- data/test/task/config/batched.yml +0 -0
- data/test/task/config/configured.yml +0 -0
- data/test/task/config/example.yml +0 -0
- data/test/task_base_test.rb +0 -0
- data/test/task_syntax_test.rb +0 -0
- data/test/task_test.rb +0 -0
- data/test/test/env_vars_test.rb +0 -0
- data/test/test/file_methods/test_assert_files/expected/one.txt +0 -0
- data/test/test/file_methods/test_assert_files/expected/two.txt +0 -0
- data/test/test/file_methods/test_assert_files/input/one.txt +0 -0
- data/test/test/file_methods/test_assert_files/input/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_can_have_no_expected_files_if_specified/input/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_can_have_no_expected_files_if_specified/input/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_different_content/expected/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_different_content/expected/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_different_content/input/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_different_content/input/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/expected/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/input/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/input/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/expected/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/expected/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/input/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/input/two.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_no_expected_files/input/one.txt +0 -0
- data/test/test/file_methods/test_assert_files_fails_for_no_expected_files/input/two.txt +0 -0
- data/test/test/file_methods/test_method_glob/expected/file.yml +0 -0
- data/test/test/file_methods/test_method_glob/expected/file_1.txt +0 -0
- data/test/test/file_methods/test_method_glob/expected/file_2.txt +0 -0
- data/test/test/file_methods_doc/test_sub/expected/one.txt +0 -0
- data/test/test/file_methods_doc/test_sub/expected/two.txt +0 -0
- data/test/test/file_methods_doc/test_sub/input/one.txt +0 -0
- data/test/test/file_methods_doc/test_sub/input/two.txt +0 -0
- data/test/test/file_methods_doc_test.rb +0 -0
- data/test/test/file_methods_test.rb +0 -0
- data/test/test/subset_methods_test.rb +0 -0
- data/test/test/tap_methods/test_assert_files/expected/task/name/a.txt +0 -0
- data/test/test/tap_methods/test_assert_files/expected/task/name/b.txt +0 -0
- data/test/test/tap_methods/test_assert_files/input/a.txt +0 -0
- data/test/test/tap_methods/test_assert_files/input/b.txt +0 -0
- data/test/test/tap_methods_test.rb +0 -0
- data/test/workflow_test.rb +0 -0
- data/vendor/rails_generator.rb +0 -0
- data/vendor/rails_generator/base.rb +0 -0
- data/vendor/rails_generator/commands.rb +0 -0
- data/vendor/rails_generator/generated_attribute.rb +0 -0
- data/vendor/rails_generator/lookup.rb +0 -0
- data/vendor/rails_generator/manifest.rb +0 -0
- data/vendor/rails_generator/options.rb +0 -0
- data/vendor/rails_generator/scripts.rb +0 -0
- data/vendor/rails_generator/scripts/destroy.rb +0 -0
- data/vendor/rails_generator/scripts/generate.rb +0 -0
- data/vendor/rails_generator/scripts/update.rb +0 -0
- data/vendor/rails_generator/simple_logger.rb +0 -0
- data/vendor/rails_generator/spec.rb +0 -0
- metadata +7 -5
- data/lib/tap/script.rb +0 -96
File without changes
|
File without changes
|
data/History
CHANGED
@@ -29,13 +29,13 @@ Documentation is still patchy, but improving.
|
|
29
29
|
Major update to Tap. Many changes in this release ARE NOT BACKWARD COMPATIBLE.
|
30
30
|
|
31
31
|
* Reworked Task and App such that methods, are
|
32
|
-
enqued and executed. Made the Executable module
|
32
|
+
enqued and executed. Made the Executable module
|
33
33
|
to allow any Method to be enqued and executed.
|
34
34
|
* App now aggregates results for methods that have no
|
35
35
|
on_complete block; enabled access through App#results
|
36
36
|
and App#_results.
|
37
37
|
* Removed iteration from tasks
|
38
|
-
* Task no longer templates app.config_templates. Templating code
|
38
|
+
* Task no longer templates app.config_templates. Templating code
|
39
39
|
removed from this distribution.
|
40
40
|
* Work to improve audit usability and visualization
|
41
41
|
* Removed methods forwarding from Audit to Audit#_current,
|
@@ -46,7 +46,17 @@ Major update to Tap. Many changes in this release ARE NOT BACKWARD COMPATIBLE.
|
|
46
46
|
* Generalized rake support; now supports version 0.8.1
|
47
47
|
* Fixes in generators
|
48
48
|
* Improvements in running of multithread tasks
|
49
|
-
* Removed condition blocks from tasks
|
49
|
+
* Removed condition blocks from tasks
|
50
50
|
* many other things also...
|
51
51
|
|
52
|
-
|
52
|
+
== 0.9.1 / 2008-04-26 revision 253
|
53
|
+
|
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.
|
58
|
+
|
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
File without changes
|
data/README
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/Tutorial
CHANGED
File without changes
|
data/bin/tap
CHANGED
@@ -12,14 +12,12 @@
|
|
12
12
|
|
13
13
|
require File.join( File.dirname(__FILE__), "../lib/tap.rb")
|
14
14
|
|
15
|
-
# setup environment
|
15
|
+
# setup the environment
|
16
16
|
env = Tap::Env.instance
|
17
17
|
app = Tap::App.instance
|
18
18
|
|
19
19
|
env.logger = app.logger
|
20
|
-
if ARGV.delete(
|
21
|
-
env.debug_setup
|
22
|
-
end
|
20
|
+
env.debug_setup if ARGV.delete('-d-')
|
23
21
|
|
24
22
|
before = nil
|
25
23
|
after = nil
|
@@ -36,19 +34,18 @@ def handle_error(err)
|
|
36
34
|
end
|
37
35
|
|
38
36
|
# configure the app to tap.yml if it exists
|
39
|
-
default_config_file =
|
37
|
+
default_config_file = Tap::Env::DEFAULT_CONFIG_FILE
|
40
38
|
begin
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
39
|
+
|
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')
|
46
43
|
|
47
|
-
|
48
|
-
after = config.delete('after')
|
49
|
-
|
50
|
-
app.reconfigure(config)
|
44
|
+
app.reconfigure(non_env_configs)
|
51
45
|
end
|
46
|
+
|
47
|
+
env.discover_gems unless File.exists?(default_config_file)
|
48
|
+
|
52
49
|
rescue(Exception)
|
53
50
|
# catch errors and exit gracefully
|
54
51
|
# (errors usu from gem loading errors)
|
data/lib/tap.rb
CHANGED
@@ -6,6 +6,9 @@ require 'ostruct'
|
|
6
6
|
require 'thread'
|
7
7
|
require 'erb'
|
8
8
|
|
9
|
+
autoload(:GetoptLong, 'getoptlong')
|
10
|
+
autoload(:PP, "pp")
|
11
|
+
|
9
12
|
# Apply version-specific patches
|
10
13
|
case RUBY_VERSION
|
11
14
|
when /^1.9/
|
@@ -36,10 +39,17 @@ end
|
|
36
39
|
|
37
40
|
$:.unshift File.dirname(__FILE__)
|
38
41
|
|
42
|
+
require 'tap/constants'
|
43
|
+
class String # :nodoc:
|
44
|
+
include Tap::Constants
|
45
|
+
end
|
46
|
+
|
39
47
|
require 'tap/support/aggregator'
|
40
48
|
require 'tap/support/audit'
|
49
|
+
require 'tap/support/batchable_methods'
|
41
50
|
require 'tap/support/batchable'
|
42
51
|
require 'tap/support/class_configuration'
|
52
|
+
require 'tap/support/command_line_methods'
|
43
53
|
require 'tap/support/configurable'
|
44
54
|
require 'tap/support/configurable_methods'
|
45
55
|
require 'tap/support/executable'
|
@@ -48,7 +58,6 @@ require 'tap/support/logger'
|
|
48
58
|
require 'tap/support/run_error'
|
49
59
|
require 'tap/support/shell_utils'
|
50
60
|
require 'tap/support/validation'
|
51
|
-
require 'tap/constants'
|
52
61
|
require 'tap/env'
|
53
62
|
require 'tap/app'
|
54
63
|
require 'tap/task'
|
data/lib/tap/app.rb
CHANGED
data/lib/tap/cmd/console.rb
CHANGED
@@ -6,8 +6,6 @@
|
|
6
6
|
# in tap.yml. Access the Tap::App.instance through 'app'
|
7
7
|
#
|
8
8
|
|
9
|
-
require 'tap/script'
|
10
|
-
|
11
9
|
#
|
12
10
|
# handle options
|
13
11
|
#
|
@@ -15,12 +13,10 @@ require 'tap/script'
|
|
15
13
|
opts = [
|
16
14
|
['--help', '-h', GetoptLong::NO_ARGUMENT, "Print this help."]]
|
17
15
|
|
18
|
-
Tap::
|
16
|
+
Tap::Support::CommandLine.handle_options(*opts) do |opt, value|
|
19
17
|
case opt
|
20
18
|
when '--help'
|
21
|
-
puts Tap::
|
22
|
-
puts
|
23
|
-
puts Tap::Script.usage_options(opts)
|
19
|
+
puts Tap::Support::CommandLine.command_help(__FILE__, opts)
|
24
20
|
exit
|
25
21
|
|
26
22
|
end
|
data/lib/tap/cmd/destroy.rb
CHANGED
File without changes
|
data/lib/tap/cmd/generate.rb
CHANGED
File without changes
|
data/lib/tap/cmd/run.rb
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
# tap run -- task --help Prints help for task
|
7
7
|
#
|
8
8
|
|
9
|
-
require 'tap/script'
|
10
9
|
env = Tap::Env.instance
|
11
10
|
app = Tap::App.instance
|
12
11
|
|
@@ -20,13 +19,10 @@ opts = [
|
|
20
19
|
['--force', '-f', GetoptLong::NO_ARGUMENT, "Force execution at checkpoints"],
|
21
20
|
['--quiet', '-q', GetoptLong::NO_ARGUMENT, "Suppress logging"]]
|
22
21
|
|
23
|
-
Tap::
|
22
|
+
Tap::Support::CommandLine.handle_options(*opts) do |opt, value|
|
24
23
|
case opt
|
25
24
|
when '--help'
|
26
|
-
puts Tap::
|
27
|
-
puts
|
28
|
-
puts "Options:"
|
29
|
-
puts Tap::Script.usage_options(opts)
|
25
|
+
puts Tap::Support::CommandLine.command_help(__FILE__, opts)
|
30
26
|
exit
|
31
27
|
|
32
28
|
when '--quiet', '--force', '--debug'
|
@@ -40,70 +36,69 @@ end
|
|
40
36
|
#
|
41
37
|
# handle options for each specified task
|
42
38
|
#
|
43
|
-
rounds = Tap::
|
44
|
-
argv.each do |args|
|
45
|
-
ARGV.clear
|
46
|
-
ARGV.concat(args)
|
47
|
-
|
48
|
-
td = Tap::
|
49
|
-
case td
|
50
|
-
when 'rake', nil
|
51
|
-
# remove --help as this will print the Rake help
|
52
|
-
ARGV.delete_if do |arg|
|
53
|
-
if arg == "--help"
|
54
|
-
env.log(:warn, "ignoring --help config for rake command")
|
55
|
-
true
|
56
|
-
else
|
57
|
-
false
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
ARGV.
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
rounds.
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
39
|
+
rounds = Tap::Support::CommandLine.split_argv(ARGV).collect do |argv|
|
40
|
+
argv.each do |args|
|
41
|
+
ARGV.clear
|
42
|
+
ARGV.concat(args)
|
43
|
+
|
44
|
+
td = Tap::Support::CommandLine.next_arg(ARGV)
|
45
|
+
case td
|
46
|
+
when 'rake', nil
|
47
|
+
# remove --help as this will print the Rake help
|
48
|
+
ARGV.delete_if do |arg|
|
49
|
+
if arg == "--help"
|
50
|
+
env.log(:warn, "ignoring --help config for rake command")
|
51
|
+
true
|
52
|
+
else
|
53
|
+
false
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
rake = env.rake_setup
|
58
|
+
|
59
|
+
# takes the place of rake.top_level
|
60
|
+
if rake.options.show_tasks
|
61
|
+
rake.display_tasks_and_comments
|
62
|
+
exit
|
63
|
+
elsif rake.options.show_prereqs
|
64
|
+
rake.display_prerequisites
|
65
|
+
exit
|
66
|
+
else
|
67
|
+
rake.top_level_tasks.each do |task_name|
|
68
|
+
app.task(task_name).enq
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
else
|
73
|
+
begin
|
74
|
+
# attempt lookup the task class
|
75
|
+
task_class = app.task_class(td)
|
76
|
+
rescue(Tap::App::LookupError)
|
77
|
+
end
|
78
|
+
|
79
|
+
# unless a Tap::Task was found, treat the
|
80
|
+
# args as a specification for Rake.
|
81
|
+
if task_class == nil || !task_class.include?(Tap::Support::Configurable)
|
82
|
+
args.unshift('rake')
|
83
|
+
redo
|
84
|
+
end
|
85
|
+
|
86
|
+
# now let the class handle the argv
|
87
|
+
ARGV.collect! {|str| Tap::Support::CommandLine.parse_yaml(str) }
|
88
|
+
ARGV.unshift(td)
|
89
|
+
task_class.argv_enq(app)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
app.queue.clear
|
94
|
+
end
|
95
|
+
ARGV.clear
|
96
|
+
|
97
|
+
rounds.delete_if {|round| round.empty? }
|
98
|
+
if rounds.empty?
|
99
|
+
puts "no task specified"
|
100
|
+
exit
|
101
|
+
end
|
107
102
|
|
108
103
|
#
|
109
104
|
# set signals
|
@@ -145,12 +140,12 @@ if signals.include?("INT")
|
|
145
140
|
|
146
141
|
puts "ctl-c interupts execution"
|
147
142
|
end
|
148
|
-
|
149
|
-
#
|
150
|
-
# enque tasks and run!
|
143
|
+
|
144
|
+
#
|
145
|
+
# enque tasks and run!
|
151
146
|
#
|
152
147
|
puts "beginning run..."
|
153
|
-
rounds.each_with_index do |queue, i|
|
154
|
-
app.queue.concat(queue)
|
155
|
-
app.run
|
156
|
-
end
|
148
|
+
rounds.each_with_index do |queue, i|
|
149
|
+
app.queue.concat(queue)
|
150
|
+
app.run
|
151
|
+
end
|
data/lib/tap/constants.rb
CHANGED
@@ -1,4 +1,35 @@
|
|
1
1
|
module Tap
|
2
|
-
|
2
|
+
MAJOR = 0
|
3
|
+
MINOR = 9
|
4
|
+
TINY = 1
|
5
|
+
|
6
|
+
VERSION="#{MAJOR}.#{MINOR}.#{TINY}"
|
3
7
|
WEBSITE="http://tap.rubyforge.org"
|
4
|
-
|
8
|
+
|
9
|
+
# Under Construction
|
10
|
+
module Constants
|
11
|
+
def try_constantize
|
12
|
+
begin
|
13
|
+
constantize
|
14
|
+
rescue(NameError)
|
15
|
+
yield
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def constants_split
|
20
|
+
camel_cased_word = camelize
|
21
|
+
unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word
|
22
|
+
raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!"
|
23
|
+
end
|
24
|
+
|
25
|
+
constants = $1.split(/::/)
|
26
|
+
current = Object
|
27
|
+
while !constants.empty?
|
28
|
+
break unless current.const_defined?(constants[0])
|
29
|
+
current = current.const_get(constants.shift)
|
30
|
+
end
|
31
|
+
|
32
|
+
[current, constants]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/tap/dump.rb
CHANGED
File without changes
|
data/lib/tap/env.rb
CHANGED
@@ -92,7 +92,6 @@ module Tap
|
|
92
92
|
def initialize
|
93
93
|
@config = nil
|
94
94
|
@logger = nil
|
95
|
-
# @on_handle_unknown_configs = nil
|
96
95
|
reset
|
97
96
|
end
|
98
97
|
|
@@ -177,7 +176,7 @@ module Tap
|
|
177
176
|
# Configuration paths are expanded relative to the parent directory
|
178
177
|
# of the loaded file. Raises an error if non-env configuration are
|
179
178
|
# found (as determined by Tap::Env::Configurtion::ENV_CONFIG_KEYS).
|
180
|
-
def load_config(path, root=Tap::Root.new, &block)
|
179
|
+
def load_config(path, root=Tap::Root.new, &block) # :yields: non_env_configs
|
181
180
|
path = File.join(path, DEFAULT_CONFIG_FILE) if File.directory?(path)
|
182
181
|
path = File.expand_path(path)
|
183
182
|
|
@@ -192,17 +191,12 @@ module Tap
|
|
192
191
|
config = read_config(path)
|
193
192
|
config['root'] = File.dirname(path) unless config['root']
|
194
193
|
|
195
|
-
configure(config, root
|
196
|
-
if block_given?
|
197
|
-
yield(configured_root, path, other_configs)
|
198
|
-
else
|
199
|
-
log(:warn, "ignoring configs: #{path} (#{other_configs.keys.join(',')})", Logger::WARN)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
194
|
+
configure(config, root, &block)
|
203
195
|
end
|
204
196
|
|
205
|
-
|
197
|
+
#--
|
198
|
+
# Note: always yields to the block, even if non_env_configs is empty
|
199
|
+
def configure(config, root=Tap::Root.new, &block) # :yields: non_env_configs
|
206
200
|
root_configs, env_configs, other_configs = partition_configs(config, ['root', 'directories', 'absolute_paths'], DEFAULT_CONFIG.keys)
|
207
201
|
env_configs = join_configs(DEFAULT_CONFIG, env_configs)
|
208
202
|
|
@@ -214,20 +208,19 @@ module Tap
|
|
214
208
|
|
215
209
|
# handle unknown configs (handle before setting
|
216
210
|
# env configs in case the configs modify root)
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
end
|
211
|
+
case
|
212
|
+
when block_given?
|
213
|
+
yield(other_configs)
|
214
|
+
when !other_configs.empty?
|
215
|
+
log(:warn, "ignoring non-env configs: #{other_configs.keys.join(',')}", Logger::DEBUG)
|
223
216
|
end
|
224
|
-
|
217
|
+
|
225
218
|
# load gems and configurations
|
226
219
|
gem_paths = env_configs.delete('gems').collect do |gem_name|
|
227
220
|
full_gem_path(gem_name)
|
228
221
|
end
|
229
222
|
config_paths = env_configs.delete('config_paths') + gem_paths
|
230
|
-
config_paths.each {|path| load_config(root[path]
|
223
|
+
config_paths.each {|path| load_config(root[path]) }
|
231
224
|
|
232
225
|
# assign env configs
|
233
226
|
env_configs.each_pair do |key, value|
|
@@ -239,7 +232,7 @@ module Tap
|
|
239
232
|
when /_paths$/
|
240
233
|
assign_paths(root, value, self.config[key])
|
241
234
|
else
|
242
|
-
|
235
|
+
handle_unknown_env_config(root, key, value)
|
243
236
|
end
|
244
237
|
end
|
245
238
|
|
@@ -266,10 +259,36 @@ module Tap
|
|
266
259
|
spec.full_gem_path
|
267
260
|
end
|
268
261
|
|
262
|
+
# Loads the config for the specified gem. A gem version can be
|
263
|
+
# specified in the name, see full_gem_path.
|
269
264
|
def load_gem(gem_name)
|
270
265
|
load_config(full_gem_path(gem_name))
|
271
266
|
end
|
272
267
|
|
268
|
+
# Returns the path to all DEFAULT_CONFIG_FILEs for installed gems.
|
269
|
+
# If latest==true, then only the config files for the latest gem
|
270
|
+
# specs will be returned (ie for the most current version of a
|
271
|
+
# gem).
|
272
|
+
def gem_config_files(latest=true)
|
273
|
+
if latest
|
274
|
+
Gem.source_index.latest_specs.collect do |spec|
|
275
|
+
config_file = File.join(spec.full_gem_path, DEFAULT_CONFIG_FILE)
|
276
|
+
File.exists?(config_file) ? config_file : nil
|
277
|
+
end.compact
|
278
|
+
else
|
279
|
+
Gem.path.collect do |dir|
|
280
|
+
Dir.glob( File.join(dir, "gems/*", DEFAULT_CONFIG_FILE) )
|
281
|
+
end.flatten.uniq
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# Loads the config files discovered by gem_config_files(true).
|
286
|
+
def discover_gems
|
287
|
+
gem_config_files.collect do |config_file|
|
288
|
+
load_config(config_file)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
273
292
|
# Searches for and returns all .rb files under each of the command_paths
|
274
293
|
# as well as the default tap commands. Commands with conflicting names
|
275
294
|
# raise an error; however, user commands are allowed to override the
|
@@ -309,7 +328,7 @@ module Tap
|
|
309
328
|
end
|
310
329
|
end
|
311
330
|
|
312
|
-
def
|
331
|
+
def handle_unknown_env_config(key, value)
|
313
332
|
raise "unknown env config: #{key}"
|
314
333
|
end
|
315
334
|
end
|