tap 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History +37 -30
- data/MIT-LICENSE +1 -1
- data/README +92 -44
- data/bin/tap +62 -75
- data/cmd/console.rb +42 -0
- data/cmd/destroy.rb +16 -0
- data/cmd/generate.rb +16 -0
- data/cmd/run.rb +126 -0
- data/doc/Class Reference +362 -0
- data/doc/Command Reference +153 -0
- data/doc/Tutorial +237 -0
- data/lib/tap.rb +6 -45
- data/lib/tap/app.rb +126 -500
- data/lib/tap/constants.rb +2 -29
- data/lib/tap/env.rb +555 -250
- data/lib/tap/file_task.rb +60 -103
- data/lib/tap/generator/base.rb +109 -0
- data/lib/tap/generator/destroy.rb +37 -0
- data/lib/tap/generator/generate.rb +61 -0
- data/lib/tap/generator/generators/command/command_generator.rb +16 -12
- data/lib/tap/generator/generators/command/templates/command.erb +13 -19
- data/lib/tap/generator/generators/config/config_generator.rb +18 -27
- data/lib/tap/generator/generators/config/templates/doc.erb +12 -0
- data/lib/tap/generator/generators/config/templates/nodoc.erb +8 -0
- data/lib/tap/generator/generators/file_task/file_task_generator.rb +16 -11
- data/lib/tap/generator/generators/file_task/templates/file.txt +11 -2
- data/lib/tap/generator/generators/file_task/templates/result.yml +6 -0
- data/lib/tap/generator/generators/file_task/templates/task.erb +24 -31
- data/lib/tap/generator/generators/file_task/templates/test.erb +18 -22
- data/lib/tap/generator/generators/root/root_generator.rb +45 -31
- data/lib/tap/generator/generators/root/templates/Rakefile +64 -41
- data/lib/tap/generator/generators/root/templates/gemspec +27 -0
- data/lib/tap/generator/generators/root/templates/tapfile +8 -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 +1 -1
- data/lib/tap/generator/generators/root/templates/test/tapfile_test.rb +15 -0
- data/lib/tap/generator/generators/task/task_generator.rb +21 -28
- data/lib/tap/generator/generators/task/templates/task.erb +13 -23
- data/lib/tap/generator/generators/task/templates/test.erb +15 -18
- data/lib/tap/generator/manifest.rb +14 -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 +260 -21
- data/lib/tap/support/aggregator.rb +11 -11
- data/lib/tap/support/assignments.rb +172 -0
- data/lib/tap/support/audit.rb +20 -18
- data/lib/tap/support/batchable.rb +21 -10
- data/lib/tap/support/batchable_class.rb +107 -0
- data/lib/tap/support/class_configuration.rb +154 -239
- data/lib/tap/support/command_line.rb +97 -102
- data/lib/tap/support/comment.rb +270 -0
- data/lib/tap/support/configurable.rb +86 -65
- data/lib/tap/support/configurable_class.rb +296 -0
- data/lib/tap/support/configuration.rb +122 -0
- data/lib/tap/support/constant.rb +70 -0
- data/lib/tap/support/constant_utils.rb +127 -0
- data/lib/tap/support/declarations.rb +111 -0
- data/lib/tap/support/executable.rb +30 -17
- data/lib/tap/support/executable_queue.rb +0 -0
- data/lib/tap/support/framework.rb +71 -0
- data/lib/tap/support/framework_class.rb +199 -0
- data/lib/tap/support/instance_configuration.rb +147 -0
- data/lib/tap/support/lazydoc.rb +428 -0
- data/lib/tap/support/manifest.rb +89 -0
- data/lib/tap/support/run_error.rb +0 -0
- data/lib/tap/support/shell_utils.rb +33 -9
- data/lib/tap/support/summary.rb +30 -0
- data/lib/tap/support/tdoc.rb +339 -134
- 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/templater.rb +180 -0
- data/lib/tap/support/validation.rb +409 -76
- data/lib/tap/support/versions.rb +5 -3
- data/lib/tap/task.rb +78 -174
- data/lib/tap/tasks/dump.rb +56 -0
- data/lib/tap/tasks/rake.rb +93 -0
- data/lib/tap/test.rb +3 -3
- data/lib/tap/test/env_vars.rb +2 -2
- data/lib/tap/test/file_methods.rb +19 -20
- data/lib/tap/test/script_methods.rb +144 -0
- data/lib/tap/test/subset_methods.rb +1 -1
- data/lib/tap/test/tap_methods.rb +28 -62
- data/lib/tap/workflow.rb +22 -39
- metadata +48 -179
- data/Basic Overview +0 -151
- data/Command Reference +0 -99
- data/Rakefile +0 -127
- data/Tutorial +0 -287
- data/lib/tap/cmd/console.rb +0 -31
- data/lib/tap/cmd/destroy.rb +0 -20
- data/lib/tap/cmd/generate.rb +0 -20
- data/lib/tap/cmd/run.rb +0 -151
- data/lib/tap/dump.rb +0 -57
- data/lib/tap/generator.rb +0 -91
- data/lib/tap/generator/generators/command/USAGE +0 -6
- data/lib/tap/generator/generators/config/USAGE +0 -21
- data/lib/tap/generator/generators/config/templates/config.erb +0 -1
- data/lib/tap/generator/generators/file_task/USAGE +0 -3
- data/lib/tap/generator/generators/file_task/templates/file.yml +0 -3
- data/lib/tap/generator/generators/generator/USAGE +0 -0
- data/lib/tap/generator/generators/generator/generator_generator.rb +0 -21
- data/lib/tap/generator/generators/generator/templates/generator.erb +0 -32
- data/lib/tap/generator/generators/generator/templates/usage.erb +0 -1
- data/lib/tap/generator/generators/root/USAGE +0 -0
- data/lib/tap/generator/generators/root/templates/ReadMe.txt +0 -0
- data/lib/tap/generator/generators/root/templates/tap.yml +0 -80
- data/lib/tap/generator/generators/task/USAGE +0 -3
- data/lib/tap/generator/generators/workflow/USAGE +0 -0
- data/lib/tap/generator/generators/workflow/templates/task.erb +0 -16
- data/lib/tap/generator/generators/workflow/templates/test.erb +0 -7
- data/lib/tap/generator/generators/workflow/workflow_generator.rb +0 -6
- data/lib/tap/generator/options.rb +0 -26
- data/lib/tap/generator/usage.rb +0 -26
- data/lib/tap/support/batchable_methods.rb +0 -34
- data/lib/tap/support/command_line_methods.rb +0 -76
- data/lib/tap/support/configurable_methods.rb +0 -224
- data/lib/tap/support/logger.rb +0 -88
- data/lib/tap/support/rake.rb +0 -43
- data/lib/tap/support/tdoc/config_attr.rb +0 -362
- data/test/app/config/another/task.yml +0 -1
- data/test/app/config/batch.yml +0 -2
- data/test/app/config/empty.yml +0 -0
- data/test/app/config/erb.yml +0 -2
- data/test/app/config/some/task.yml +0 -1
- data/test/app/config/template.yml +0 -2
- data/test/app/config/version-0.1.yml +0 -1
- data/test/app/config/version.yml +0 -1
- data/test/app/lib/app_test_task.rb +0 -3
- data/test/app_test.rb +0 -1849
- data/test/env/test_configure/recurse_a.yml +0 -2
- data/test/env/test_configure/recurse_b.yml +0 -2
- data/test/env/test_configure/tap.yml +0 -23
- data/test/env/test_load_env_config/dir/tap.yml +0 -3
- data/test/env/test_load_env_config/recurse_a.yml +0 -2
- data/test/env/test_load_env_config/recurse_b.yml +0 -2
- data/test/env/test_load_env_config/tap.yml +0 -3
- data/test/env_test.rb +0 -198
- data/test/file_task/config/batch.yml +0 -2
- data/test/file_task/config/configured.yml +0 -1
- 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 -1291
- data/test/root/alt_lib/alt_module.rb +0 -4
- 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 -2
- data/test/root/lib/alternative_filepath.rb +0 -2
- data/test/root/lib/another_module.rb +0 -2
- data/test/root/lib/nested/some_module.rb +0 -4
- data/test/root/lib/no_module_included.rb +0 -0
- data/test/root/lib/some/module.rb +0 -4
- data/test/root/lib/some_class.rb +0 -2
- data/test/root/lib/some_module.rb +0 -3
- data/test/root/load_path/load_path_module.rb +0 -2
- data/test/root/load_path/skip_module.rb +0 -2
- data/test/root/mtime/older.txt +0 -0
- data/test/root/unload/full_path.rb +0 -2
- data/test/root/unload/loaded_by_nested.rb +0 -2
- data/test/root/unload/nested/nested_load.rb +0 -6
- data/test/root/unload/nested/nested_with_ext.rb +0 -4
- data/test/root/unload/nested/relative_path.rb +0 -4
- data/test/root/unload/older.rb +0 -2
- data/test/root/unload/unload_base.rb +0 -9
- 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 -718
- data/test/support/aggregator_test.rb +0 -99
- data/test/support/audit_test.rb +0 -445
- data/test/support/batchable_test.rb +0 -74
- data/test/support/class_configuration_test.rb +0 -331
- data/test/support/command_line_test.rb +0 -58
- data/test/support/configurable/config/configured.yml +0 -2
- data/test/support/configurable_test.rb +0 -295
- data/test/support/executable_queue_test.rb +0 -103
- data/test/support/executable_test.rb +0 -38
- data/test/support/logger_test.rb +0 -31
- data/test/support/rake_test.rb +0 -37
- data/test/support/shell_utils_test.rb +0 -24
- data/test/support/tdoc_test.rb +0 -370
- data/test/support/validation_test.rb +0 -54
- data/test/support/versions_test.rb +0 -103
- data/test/tap_test_helper.rb +0 -57
- data/test/tap_test_suite.rb +0 -7
- data/test/task/config/batch.yml +0 -2
- data/test/task/config/batched.yml +0 -2
- data/test/task/config/configured.yml +0 -1
- data/test/task/config/example.yml +0 -1
- data/test/task_base_test.rb +0 -24
- data/test/task_syntax_test.rb +0 -300
- data/test/task_test.rb +0 -320
- data/test/test/env_vars_test.rb +0 -48
- data/test/test/file_methods/test_assert_files/expected/one.txt +0 -1
- data/test/test/file_methods/test_assert_files/expected/two.txt +0 -1
- data/test/test/file_methods/test_assert_files/input/one.txt +0 -1
- data/test/test/file_methods/test_assert_files/input/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_can_have_no_expected_files_if_specified/input/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_can_have_no_expected_files_if_specified/input/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_different_content/expected/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_different_content/expected/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_different_content/input/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_different_content/input/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/expected/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/input/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_expected_file/input/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/expected/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/expected/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/input/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_missing_output_file/input/two.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_no_expected_files/input/one.txt +0 -1
- data/test/test/file_methods/test_assert_files_fails_for_no_expected_files/input/two.txt +0 -1
- 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 -1
- data/test/test/file_methods_doc/test_sub/expected/two.txt +0 -1
- data/test/test/file_methods_doc/test_sub/input/one.txt +0 -1
- data/test/test/file_methods_doc/test_sub/input/two.txt +0 -1
- data/test/test/file_methods_doc_test.rb +0 -29
- data/test/test/file_methods_test.rb +0 -275
- data/test/test/subset_methods_test.rb +0 -171
- data/test/test/tap_methods/test_assert_files/expected/task/name/a.txt +0 -1
- data/test/test/tap_methods/test_assert_files/expected/task/name/b.txt +0 -1
- data/test/test/tap_methods/test_assert_files/input/a.txt +0 -1
- data/test/test/tap_methods/test_assert_files/input/b.txt +0 -1
- data/test/test/tap_methods_test.rb +0 -399
- data/test/workflow_test.rb +0 -120
- data/vendor/rails_generator.rb +0 -56
- data/vendor/rails_generator/base.rb +0 -263
- data/vendor/rails_generator/commands.rb +0 -581
- data/vendor/rails_generator/generated_attribute.rb +0 -42
- data/vendor/rails_generator/lookup.rb +0 -209
- data/vendor/rails_generator/manifest.rb +0 -53
- data/vendor/rails_generator/options.rb +0 -143
- data/vendor/rails_generator/scripts.rb +0 -83
- data/vendor/rails_generator/scripts/destroy.rb +0 -7
- data/vendor/rails_generator/scripts/generate.rb +0 -7
- data/vendor/rails_generator/scripts/update.rb +0 -12
- data/vendor/rails_generator/simple_logger.rb +0 -46
- data/vendor/rails_generator/spec.rb +0 -44
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
module Tap::Generator::Generators
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
|
|
3
|
+
# :startdoc::generator a new tap command
|
|
4
|
+
#
|
|
5
|
+
# Generates a new tap command under the cmd directory. The
|
|
6
|
+
# new command can be run from the command line using:
|
|
7
|
+
#
|
|
8
|
+
# % tap <command>
|
|
9
|
+
#
|
|
10
|
+
class CommandGenerator < Tap::Generator::Base
|
|
11
|
+
|
|
12
|
+
def manifest(m, command_name)
|
|
13
|
+
m.directory app['cmd']
|
|
14
|
+
|
|
15
|
+
template_files do |source, target|
|
|
16
|
+
m.template app.filepath('cmd', "#{command_name}.rb"), source, :command_name => command_name
|
|
14
17
|
end
|
|
15
18
|
end
|
|
19
|
+
|
|
16
20
|
end
|
|
17
21
|
end
|
|
@@ -1,34 +1,28 @@
|
|
|
1
|
-
#
|
|
2
|
-
# tap <%= file_name %> {options} ARGS...
|
|
1
|
+
# tap <%= command_name %> {options} ARGS...
|
|
3
2
|
#
|
|
4
|
-
# = Description
|
|
5
3
|
# The default command simply prints the input arguments
|
|
6
4
|
# and application information, then exits.
|
|
7
5
|
#
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
app = Tap::App.instance
|
|
7
|
+
env = Tap::Env.instance
|
|
8
|
+
app = Tap::App.instance
|
|
12
9
|
|
|
13
10
|
#
|
|
14
11
|
# handle options
|
|
15
12
|
#
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Tap::Support::CommandLine.handle_options(*opts) do |opt, value|
|
|
22
|
-
case opt
|
|
23
|
-
when '--help'
|
|
24
|
-
puts Tap::Support::CommandLine.command_help(__FILE__, opts)
|
|
25
|
-
exit
|
|
26
|
-
|
|
27
|
-
when '--debug'
|
|
28
|
-
app.options.debug = true
|
|
14
|
+
OptionParser.new do |opts|
|
|
15
|
+
opts.separator ""
|
|
16
|
+
opts.separator "options:"
|
|
29
17
|
|
|
18
|
+
opts.on("-h", "--help", "Show this message") do
|
|
19
|
+
opts.banner = Tap::Support::CommandLine.usage(__FILE__)
|
|
20
|
+
puts opts
|
|
21
|
+
exit
|
|
30
22
|
end
|
|
31
|
-
|
|
23
|
+
|
|
24
|
+
end.parse!(ARGV)
|
|
25
|
+
|
|
32
26
|
|
|
33
27
|
#
|
|
34
28
|
# add your script code here
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
module Tap::Generator::Generators
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
# :startdoc::generator a config file for a task
|
|
4
|
+
#
|
|
5
|
+
# Generates a new config file for a task. The configurations, defaults,
|
|
6
|
+
# and documentation is determined from the task source file.
|
|
7
|
+
class ConfigGenerator < Tap::Generator::Base
|
|
8
|
+
|
|
9
|
+
config :doc, true, &c.switch # include documentation in the config
|
|
10
|
+
|
|
11
|
+
def env
|
|
12
|
+
Tap::Env.instance
|
|
13
|
+
end
|
|
4
14
|
|
|
5
|
-
def
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
argv[0] = name
|
|
15
|
+
def manifest(m, name, config_name=name)
|
|
16
|
+
const = env.search(:tasks, name) or raise "unknown task: #{name}"
|
|
17
|
+
task_class = const.constantize or raise "unknown task: #{name}"
|
|
9
18
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def manifest
|
|
16
|
-
record do |m|
|
|
17
|
-
task = @app.task(class_name)
|
|
18
|
-
self.formatted_yaml = task.class.configurations.format_yaml
|
|
19
|
-
|
|
20
|
-
config_path = @app.relative_filepath(:root, @app[:config])
|
|
21
|
-
|
|
22
|
-
if @version == nil
|
|
23
|
-
# then get the next increment?
|
|
24
|
-
# Tap::App.vglob(File.join(config_path, class_name.underscore + '.yml'))
|
|
25
|
-
end
|
|
26
|
-
version = @version == nil ? '' : "-#{@version}"
|
|
27
|
-
|
|
28
|
-
m.directory File.join(config_path, class_path)
|
|
29
|
-
m.template "config.erb", File.join(config_path, class_name.underscore + "#{version}.yml")
|
|
30
|
-
|
|
19
|
+
m.directory app['config']
|
|
20
|
+
m.file app.filepath('config', config_name + '.yml') do |file|
|
|
21
|
+
task_class.configurations.format_str((doc ? :doc : :nodoc), file)
|
|
31
22
|
end
|
|
32
23
|
end
|
|
33
24
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
# <%= receiver %> configuration<%= configurations.length > 1 ? 's' : '' %>
|
|
3
|
+
###############################################################################
|
|
4
|
+
<% configurations.each do |key, config| %>
|
|
5
|
+
|
|
6
|
+
<% Comment.wrap(config.desc.to_s.split(/\r?\n/), 50, 2).each do |line| %>
|
|
7
|
+
# <%= line %>
|
|
8
|
+
<% end %>
|
|
9
|
+
<%= config.default == nil ? '#' : '' %><%= yamlize({key.to_s => config.default}) %>
|
|
10
|
+
|
|
11
|
+
<% end %>
|
|
12
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
# <%= receiver %> configuration<%= configurations.length > 1 ? 's' : '' %>
|
|
3
|
+
###############################################################################
|
|
4
|
+
<% configurations.each do |key, config| %>
|
|
5
|
+
<%= config.default == nil ? '#' : ''%><%= yamlize({key.to_s => config.default}) %>
|
|
6
|
+
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
require 'tap/generator/generators/task/task_generator'
|
|
2
2
|
|
|
3
3
|
module Tap::Generator::Generators
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
# :startdoc::generator a file_task and test
|
|
6
|
+
#
|
|
7
|
+
# Generates a new Tap::FileTask and associated test files.
|
|
8
|
+
class FileTaskGenerator < TaskGenerator
|
|
5
9
|
|
|
6
|
-
def
|
|
7
|
-
|
|
10
|
+
def manifest(m, const_name)
|
|
11
|
+
const = super
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
if test
|
|
14
|
+
test_dir = app.filepath('test', const.path, "test_#{const.basename}")
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
m.directories test_dir, %W{
|
|
17
|
+
input
|
|
18
|
+
expected
|
|
19
|
+
}
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
m.template File.join(test_dir, 'input/file.txt'), "file.txt", :const => const, :test_dir => test_dir
|
|
22
|
+
m.template File.join(test_dir, 'expected/result.yml'), "result.yml", :const => const, :test_dir => test_dir
|
|
23
|
+
end
|
|
19
24
|
end
|
|
20
25
|
|
|
21
26
|
end
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
absquatulate - verb: This amusing, vivid, and expressive word is a bit of a jocular, contrived slang. To absquatulate is to decamp, to scram, to take off in a hell of a hurry like a fugitive heading into the woods.
|
|
2
|
+
|
|
3
|
+
algorism - noun: This is the name of the Arabic numbering system, using the figures 1 to 9 plus the zero. The derivation is from Middle Latin algorismus, from the Arabic al (the) plus Khuwarizmi, the surname of a ninth-century Arabic mathematician. Algorithm is sometimes used as a synonym, but is also used to designate a set of rules for the solution of a mathematical problem in a finite number of steps. These words are entirely unrelated to algolagnia, with its very different meaning and derivation.
|
|
4
|
+
|
|
5
|
+
defenestration - verb: Defenestration is the act of throwing someone (yes, someone!) or something out of a window. To defenestrate a person or thing is to engage in this activity - a strange one indeed, since these words are more commonly applied to situations where what is thrown out of the window is a person, rather than a thing. It is surprising, in view of what must be the infrequency of this type of activity, that there exists word for it, but then, there exists a word for just about everything.
|
|
6
|
+
|
|
7
|
+
macaronic - adj: This peculiar word, a jocular concoction from macaroni, is applied, in a narrow sense, to language characterized by a mixture of Latin and non-Latin words, or by non-Latin words given phony Latin endings; in a broader sense, to prose or verse composed of any mixture of languages; in its broadest sense, to anything mixed or jumbled.
|
|
8
|
+
|
|
9
|
+
trumpery - noun: Trumpery is worthless stuff.
|
|
10
|
+
|
|
11
|
+
usufruct - noun: Usufruct is a term used in law primarily, to denote one's right to enjoy the use and benefits flowing from the use of another's property, without the ownership of it and without the right to harm or waste or destroy it.
|
|
@@ -1,40 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
1
|
+
<% redirect do |target| %># <%= const.name %>::manifest <replace with manifest summary>
|
|
2
|
+
# <replace with command line description>
|
|
3
|
+
|
|
4
|
+
# <%= const.const_name %> Documentation
|
|
5
|
+
# This example FileTask counts the specified letters
|
|
6
|
+
# in a source file and writes the counts to a target
|
|
7
|
+
# file as YAML.
|
|
7
8
|
#
|
|
8
|
-
class <%=
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
config :key, 'value' # a sample config
|
|
13
|
-
|
|
14
|
-
# process defines what the task does; use the
|
|
15
|
-
# same number of inputs to enque the task
|
|
16
|
-
# as specified here
|
|
17
|
-
def process(filepath)
|
|
9
|
+
class <%= const.const_name %> < Tap::FileTask
|
|
10
|
+
|
|
11
|
+
# <config file documentation>
|
|
12
|
+
config :letters, ['a','e','i','o','u'], &c.array # a list of letters to count
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
# (this is convenient for testing) while changing the
|
|
21
|
-
# basename of filepath to 'yml'. See FileTask#filepath
|
|
22
|
-
# for filepaths based on the task name.
|
|
23
|
-
target = app.filepath(:data, basename(filepath, '.yml') )
|
|
14
|
+
def process(source, target)
|
|
24
15
|
|
|
25
|
-
# prepare ensures the parent directory for
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# in the event of an error
|
|
16
|
+
# prepare ensures the parent directory for target
|
|
17
|
+
# exists and, if necessary, backs up the existing
|
|
18
|
+
# target file (which is restored on error)
|
|
29
19
|
prepare(target)
|
|
30
|
-
|
|
20
|
+
|
|
31
21
|
# now perform the task...
|
|
32
|
-
|
|
22
|
+
str = File.read(source)
|
|
23
|
+
letter_count = letters.collect do |letter|
|
|
24
|
+
str.count(letter)
|
|
25
|
+
end
|
|
26
|
+
|
|
33
27
|
File.open(target, "wb") do |file|
|
|
34
|
-
file <<
|
|
28
|
+
file << letter_count.to_yaml
|
|
35
29
|
end
|
|
36
|
-
|
|
30
|
+
|
|
37
31
|
target
|
|
38
32
|
end
|
|
39
|
-
|
|
40
|
-
end
|
|
33
|
+
end <% module_nest(const.nesting, ' ') { target } end %>
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
require File.join(File.dirname(__FILE__), '<%= '../' *
|
|
2
|
-
require '<%=
|
|
1
|
+
require File.join(File.dirname(__FILE__), '<%= '../' * const.nesting_depth %>tap_test_helper.rb')
|
|
2
|
+
require '<%= const.path %>'
|
|
3
3
|
|
|
4
|
-
class <%=
|
|
4
|
+
class <%= const.name %>Test < Test::Unit::TestCase
|
|
5
5
|
acts_as_tap_test
|
|
6
6
|
|
|
7
|
-
def test_<%=
|
|
8
|
-
#
|
|
9
|
-
# files
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# The output directory is cleaned up by default. To
|
|
17
|
-
# preserve it, set the KEEP_OUTPUTS env variable:
|
|
18
|
-
#
|
|
7
|
+
def test_<%= const.basename %>
|
|
8
|
+
# Use assert_files to test file transform tasks. The block
|
|
9
|
+
# recieves the method input files and compares the results
|
|
10
|
+
# to the method expected files.
|
|
11
|
+
|
|
12
|
+
# Generated files are often placed in method output, as it
|
|
13
|
+
# is cleaned up each test. To keep output files, set the
|
|
14
|
+
# KEEP_OUTPUTS variable:
|
|
19
15
|
# % rake test keep_outputs=true
|
|
20
|
-
|
|
21
|
-
t = <%=
|
|
16
|
+
|
|
17
|
+
t = <%= const.name %>.new
|
|
22
18
|
assert_files do |input_files|
|
|
23
|
-
input_files.each
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
app.run
|
|
19
|
+
input_files.each do |source|
|
|
20
|
+
target = method_filepath(:output, 'result.yml')
|
|
21
|
+
t.enq(source, target)
|
|
27
22
|
end
|
|
28
|
-
|
|
23
|
+
|
|
24
|
+
app.run
|
|
29
25
|
app.results(t)
|
|
30
26
|
end
|
|
31
27
|
end
|
|
@@ -1,41 +1,55 @@
|
|
|
1
1
|
require 'tap/root'
|
|
2
2
|
|
|
3
3
|
module Tap::Generator::Generators
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#m.directory "server/test"
|
|
22
|
-
#m.directory "server/lib/tasks"
|
|
4
|
+
|
|
5
|
+
# :startdoc::generator a basic tap directory structure
|
|
6
|
+
#
|
|
7
|
+
# Generates a tap root directory structure:
|
|
8
|
+
#
|
|
9
|
+
# root
|
|
10
|
+
# |- Rakefile
|
|
11
|
+
# |- lib
|
|
12
|
+
# |- sample.gemspec
|
|
13
|
+
# |- tap.yml
|
|
14
|
+
# |- tapfile.rb
|
|
15
|
+
# `- test
|
|
16
|
+
# |- tap_test_helper.rb
|
|
17
|
+
# |- tap_test_suite.rb
|
|
18
|
+
# `- tapfile_test.rb
|
|
19
|
+
#
|
|
20
|
+
class RootGenerator < Tap::Generator::Base
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# skip server files for now... later
|
|
30
|
-
# the files will simply be removed
|
|
31
|
-
next if fname =~ /server/
|
|
32
|
-
next if fname =~ /config/
|
|
33
|
-
next if fname =~ /process_tap_request/
|
|
22
|
+
# ::args ROOT, PROJECT_NAME=basename(ROOT)
|
|
23
|
+
def manifest(m, root, project_name=File.basename(root))
|
|
24
|
+
project_name = 'project' if project_name == '.'
|
|
25
|
+
r = Tap::Root.new(root)
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
m.directory r.root
|
|
28
|
+
m.directory r['lib']
|
|
29
|
+
|
|
30
|
+
template_files do |source, target|
|
|
31
|
+
case
|
|
32
|
+
when File.directory?(source)
|
|
33
|
+
m.directory r[target]
|
|
34
|
+
when target == 'gemspec'
|
|
35
|
+
m.template r[project_name + '.gemspec'], source, :project_name => project_name
|
|
36
|
+
when target == 'tapfile'
|
|
37
|
+
m.template r['tapfile.rb'], source, :project_name => project_name
|
|
38
|
+
else
|
|
39
|
+
m.template r[target], source, :project_name => project_name
|
|
37
40
|
end
|
|
38
41
|
end
|
|
42
|
+
|
|
43
|
+
# m.file(r['tap.yml']) do |file|
|
|
44
|
+
# Tap::App.configurations.format_str(:doc, file) do |templater|
|
|
45
|
+
# next unless templater.receiver == Tap::Root
|
|
46
|
+
#
|
|
47
|
+
# templater.configurations.each do |(key, config)|
|
|
48
|
+
# config.default = nil if key.to_s == 'root'
|
|
49
|
+
# end
|
|
50
|
+
# end
|
|
51
|
+
# Tap::Env.configurations.format_str(:doc, file)
|
|
52
|
+
# end
|
|
39
53
|
end
|
|
40
54
|
end
|
|
41
55
|
end
|
|
@@ -3,61 +3,84 @@ require 'rake/testtask'
|
|
|
3
3
|
require 'rake/rdoctask'
|
|
4
4
|
require 'rake/gempackagetask'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
task :default => :test
|
|
6
|
+
require 'tap/constants'
|
|
7
|
+
require 'tap/patches/rake/testtask.rb'
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
#
|
|
10
|
+
# Gem specification
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
def gemspec
|
|
14
|
+
data = File.read('<%= project_name %>.gemspec')
|
|
15
|
+
spec = nil
|
|
16
|
+
Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
|
|
17
|
+
spec
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Rake::GemPackageTask.new(gemspec) do |pkg|
|
|
21
|
+
pkg.need_tar = true
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
desc 'Prints the gemspec manifest.'
|
|
25
|
+
task :print_manifest do
|
|
26
|
+
# collect files from the gemspec, labeling
|
|
27
|
+
# with true or false corresponding to the
|
|
28
|
+
# file existing or not
|
|
29
|
+
files = gemspec.files.inject({}) do |files, file|
|
|
30
|
+
files[File.expand_path(file)] = [File.exists?(file), file]
|
|
31
|
+
files
|
|
32
|
+
end
|
|
12
33
|
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
34
|
+
# gather non-rdoc/pkg files for the project
|
|
35
|
+
# and add to the files list if they are not
|
|
36
|
+
# included already (marking by the absence
|
|
37
|
+
# of a label)
|
|
38
|
+
Dir.glob("**/*").each do |file|
|
|
39
|
+
next if file =~ /^(rdoc|pkg)/ || File.directory?(file)
|
|
40
|
+
|
|
41
|
+
path = File.expand_path(file)
|
|
42
|
+
files[path] = ["", file] unless files.has_key?(path)
|
|
43
|
+
end
|
|
19
44
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
45
|
+
# sort and output the results
|
|
46
|
+
files.values.sort_by {|exists, file| file }.each do |entry|
|
|
47
|
+
puts "%-5s : %s" % entry
|
|
48
|
+
end
|
|
23
49
|
end
|
|
24
50
|
|
|
51
|
+
#
|
|
52
|
+
# Documentation tasks
|
|
53
|
+
#
|
|
54
|
+
|
|
25
55
|
desc 'Generate documentation.'
|
|
26
56
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
27
|
-
|
|
28
|
-
require 'tap/support/tdoc'
|
|
29
|
-
rdoc.template = 'tap/support/tdoc/tdoc_html_template'
|
|
30
|
-
rdoc.options << '--fmt' << 'tdoc'
|
|
57
|
+
spec = gemspec
|
|
31
58
|
|
|
32
59
|
rdoc.rdoc_dir = 'rdoc'
|
|
33
|
-
rdoc.title = '<%=
|
|
34
|
-
rdoc.template = 'tap/support/tdoc/tdoc_html_template'
|
|
60
|
+
rdoc.title = '<%= project_name %>'
|
|
35
61
|
rdoc.options << '--line-numbers' << '--inline-source'
|
|
36
|
-
rdoc.rdoc_files.include(
|
|
37
|
-
rdoc.rdoc_files.include(
|
|
62
|
+
rdoc.rdoc_files.include( spec.extra_rdoc_files )
|
|
63
|
+
rdoc.rdoc_files.include( spec.files.select {|file| file =~ /^lib.*\.rb$/} )
|
|
64
|
+
|
|
65
|
+
# Using Tdoc to template your Rdoc will result in configurations being
|
|
66
|
+
# listed with documentation in a subsection following attributes. Not
|
|
67
|
+
# necessary, but nice.
|
|
68
|
+
require 'tap/support/tdoc'
|
|
69
|
+
rdoc.template = 'tap/support/tdoc/tdoc_html_template'
|
|
70
|
+
rdoc.options << '--fmt' << 'tdoc'
|
|
38
71
|
end
|
|
39
72
|
|
|
40
73
|
#
|
|
41
|
-
#
|
|
74
|
+
# Test tasks
|
|
42
75
|
#
|
|
43
76
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
s.files = Dir.glob("{test,lib}/**/*") + ["Rakefile", "ReadMe.txt"]
|
|
53
|
-
s.require_path = "lib"
|
|
54
|
-
s.test_file = "test/tap_test_suite.rb"
|
|
55
|
-
|
|
56
|
-
s.has_rdoc = true
|
|
57
|
-
s.extra_rdoc_files = ["ReadMe.txt"]
|
|
58
|
-
s.add_dependency("tap", ">= <%= Tap::VERSION %>")
|
|
77
|
+
desc 'Default: Run tests.'
|
|
78
|
+
task :default => :test
|
|
79
|
+
|
|
80
|
+
desc 'Run tests.'
|
|
81
|
+
Rake::TestTask.new(:test) do |t|
|
|
82
|
+
t.test_files = Dir.glob( File.join('test', ENV['pattern'] || '**/*_test.rb') )
|
|
83
|
+
t.verbose = true
|
|
84
|
+
t.warning = true
|
|
59
85
|
end
|
|
60
86
|
|
|
61
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
|
62
|
-
pkg.need_tar = true
|
|
63
|
-
end
|