tap 0.12.4 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History +34 -0
- data/README +62 -41
- data/bin/tap +36 -40
- data/cmd/console.rb +14 -6
- data/cmd/manifest.rb +62 -58
- data/cmd/run.rb +49 -31
- data/doc/API +84 -0
- data/doc/Class Reference +83 -115
- data/doc/Examples/Command Line +36 -0
- data/doc/Examples/Workflow +40 -0
- data/lib/tap/app.rb +293 -214
- data/lib/tap/app/node.rb +43 -0
- data/lib/tap/app/queue.rb +77 -0
- data/lib/tap/app/stack.rb +16 -0
- data/lib/tap/app/state.rb +22 -0
- data/lib/tap/constants.rb +2 -2
- data/lib/tap/env.rb +400 -314
- data/lib/tap/env/constant.rb +227 -0
- data/lib/tap/env/gems.rb +63 -0
- data/lib/tap/env/manifest.rb +89 -0
- data/lib/tap/env/minimap.rb +292 -0
- data/lib/tap/{support → env}/string_ext.rb +2 -2
- data/lib/tap/exe.rb +113 -125
- data/lib/tap/join.rb +175 -0
- data/lib/tap/joins.rb +9 -0
- data/lib/tap/joins/switch.rb +44 -0
- data/lib/tap/joins/sync.rb +99 -0
- data/lib/tap/root.rb +100 -491
- data/lib/tap/root/utils.rb +220 -0
- data/lib/tap/{support → root}/versions.rb +31 -29
- data/lib/tap/schema.rb +248 -0
- data/lib/tap/schema/parser.rb +413 -0
- data/lib/tap/schema/utils.rb +82 -0
- data/lib/tap/support/intern.rb +19 -6
- data/lib/tap/support/templater.rb +8 -3
- data/lib/tap/task.rb +175 -171
- data/lib/tap/tasks/dump.rb +58 -0
- data/lib/tap/tasks/load.rb +62 -0
- metadata +30 -73
- data/cmd/destroy.rb +0 -27
- data/cmd/generate.rb +0 -27
- data/doc/Command Reference +0 -105
- data/doc/Syntax Reference +0 -234
- data/doc/Tutorial +0 -348
- data/lib/tap/dump.rb +0 -142
- data/lib/tap/file_task.rb +0 -384
- data/lib/tap/generator/arguments.rb +0 -13
- data/lib/tap/generator/base.rb +0 -176
- data/lib/tap/generator/destroy.rb +0 -60
- data/lib/tap/generator/generate.rb +0 -93
- data/lib/tap/generator/generators/command/command_generator.rb +0 -21
- data/lib/tap/generator/generators/command/templates/command.erb +0 -32
- data/lib/tap/generator/generators/config/config_generator.rb +0 -98
- data/lib/tap/generator/generators/generator/generator_generator.rb +0 -37
- data/lib/tap/generator/generators/generator/templates/task.erb +0 -27
- data/lib/tap/generator/generators/generator/templates/test.erb +0 -26
- data/lib/tap/generator/generators/root/root_generator.rb +0 -84
- data/lib/tap/generator/generators/root/templates/MIT-LICENSE +0 -22
- data/lib/tap/generator/generators/root/templates/README +0 -14
- data/lib/tap/generator/generators/root/templates/Rakefile +0 -84
- data/lib/tap/generator/generators/root/templates/Rapfile +0 -11
- data/lib/tap/generator/generators/root/templates/gemspec +0 -27
- data/lib/tap/generator/generators/root/templates/test/tap_test_helper.rb +0 -3
- data/lib/tap/generator/generators/task/task_generator.rb +0 -25
- data/lib/tap/generator/generators/task/templates/task.erb +0 -14
- data/lib/tap/generator/generators/task/templates/test.erb +0 -19
- data/lib/tap/generator/manifest.rb +0 -20
- data/lib/tap/generator/preview.rb +0 -69
- data/lib/tap/load.rb +0 -64
- data/lib/tap/spec.rb +0 -41
- data/lib/tap/support/aggregator.rb +0 -65
- data/lib/tap/support/audit.rb +0 -333
- data/lib/tap/support/constant.rb +0 -143
- data/lib/tap/support/constant_manifest.rb +0 -126
- data/lib/tap/support/dependencies.rb +0 -54
- data/lib/tap/support/dependency.rb +0 -44
- data/lib/tap/support/executable.rb +0 -198
- data/lib/tap/support/executable_queue.rb +0 -125
- data/lib/tap/support/gems.rb +0 -43
- data/lib/tap/support/join.rb +0 -144
- data/lib/tap/support/joins.rb +0 -12
- data/lib/tap/support/joins/switch.rb +0 -27
- data/lib/tap/support/joins/sync_merge.rb +0 -38
- data/lib/tap/support/manifest.rb +0 -171
- data/lib/tap/support/minimap.rb +0 -90
- data/lib/tap/support/node.rb +0 -176
- data/lib/tap/support/parser.rb +0 -450
- data/lib/tap/support/schema.rb +0 -385
- data/lib/tap/support/shell_utils.rb +0 -67
- data/lib/tap/test.rb +0 -77
- data/lib/tap/test/assertions.rb +0 -38
- data/lib/tap/test/env_vars.rb +0 -29
- data/lib/tap/test/extensions.rb +0 -73
- data/lib/tap/test/file_test.rb +0 -362
- data/lib/tap/test/file_test_class.rb +0 -15
- data/lib/tap/test/regexp_escape.rb +0 -87
- data/lib/tap/test/script_test.rb +0 -46
- data/lib/tap/test/script_tester.rb +0 -115
- data/lib/tap/test/subset_test.rb +0 -260
- data/lib/tap/test/subset_test_class.rb +0 -99
- data/lib/tap/test/tap_test.rb +0 -109
- data/lib/tap/test/utils.rb +0 -231
@@ -1,60 +0,0 @@
|
|
1
|
-
module Tap
|
2
|
-
module Generator
|
3
|
-
|
4
|
-
# A mixin defining how to run manifest actions in reverse.
|
5
|
-
module Destroy
|
6
|
-
|
7
|
-
# Iterates over the actions in reverse, and collects the results.
|
8
|
-
def iterate(actions)
|
9
|
-
results = []
|
10
|
-
actions.reverse_each {|action| results << yield(action) }
|
11
|
-
results
|
12
|
-
end
|
13
|
-
|
14
|
-
# Removes the target directory if it exists. Missing, non-directory and
|
15
|
-
# non-empty targets are simply logged and not removed. When pretend is
|
16
|
-
# true, removal is logged but does not actually happen.
|
17
|
-
#
|
18
|
-
# No options currently affect the behavior of this method.
|
19
|
-
def directory(target, options={})
|
20
|
-
target = File.expand_path(target)
|
21
|
-
|
22
|
-
case
|
23
|
-
when !File.exists?(target)
|
24
|
-
log_relative :missing, target
|
25
|
-
when !File.directory?(target)
|
26
|
-
log_relative 'not a directory', target
|
27
|
-
when !Root.empty?(target)
|
28
|
-
log_relative 'not empty', target
|
29
|
-
else
|
30
|
-
log_relative :rm, target
|
31
|
-
FileUtils.rmdir(target) unless pretend
|
32
|
-
end
|
33
|
-
|
34
|
-
target
|
35
|
-
end
|
36
|
-
|
37
|
-
# Removes the target file if it exists. Missing and non-file and targets
|
38
|
-
# are simply logged and not removed. When pretend is true, removal is
|
39
|
-
# logged but does not actually happen.
|
40
|
-
#
|
41
|
-
# No options currently affect the behavior of this method.
|
42
|
-
def file(target, options={})
|
43
|
-
target = File.expand_path(target)
|
44
|
-
|
45
|
-
case
|
46
|
-
when File.file?(target)
|
47
|
-
log_relative :rm, target
|
48
|
-
FileUtils.rm(target) unless pretend
|
49
|
-
when File.directory?(target)
|
50
|
-
log_relative 'not a file', target
|
51
|
-
else
|
52
|
-
log_relative :missing, target
|
53
|
-
end
|
54
|
-
|
55
|
-
target
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
autoload(:Tempfile, 'tempfile')
|
2
|
-
|
3
|
-
module Tap
|
4
|
-
module Generator
|
5
|
-
|
6
|
-
# A mixin defining how to run manifest actions.
|
7
|
-
module Generate
|
8
|
-
|
9
|
-
# Creates the target directory if it doesn't exist. When pretend is
|
10
|
-
# true, creation is logged but does not actually happen.
|
11
|
-
#
|
12
|
-
# No options currently affect the behavior of this method.
|
13
|
-
def directory(target, options={})
|
14
|
-
target = File.expand_path(target)
|
15
|
-
|
16
|
-
case
|
17
|
-
when File.exists?(target)
|
18
|
-
log_relative :exists, target
|
19
|
-
else
|
20
|
-
log_relative :create, target
|
21
|
-
FileUtils.mkdir_p(target) unless pretend
|
22
|
-
end
|
23
|
-
|
24
|
-
target
|
25
|
-
end
|
26
|
-
|
27
|
-
# Creates the target file; content may be added to the file by providing
|
28
|
-
# block. If the target file already exists, the new and existing content
|
29
|
-
# is compared and the user will be prompted for how to handle collisions.
|
30
|
-
# All activity is logged. When pretend is true, creation is logged but
|
31
|
-
# does not actually happen.
|
32
|
-
#
|
33
|
-
# No options currently affect the behavior of this method.
|
34
|
-
def file(target, options={})
|
35
|
-
source_file = Tempfile.new('generate')
|
36
|
-
yield(source_file) if block_given?
|
37
|
-
source_file.close
|
38
|
-
|
39
|
-
source = source_file.path
|
40
|
-
target = File.expand_path(target)
|
41
|
-
|
42
|
-
copy_file = true
|
43
|
-
msg = case
|
44
|
-
when !File.exists?(target)
|
45
|
-
:create
|
46
|
-
when FileUtils.cmp(source, target)
|
47
|
-
:exists
|
48
|
-
when force_file_collision?(target)
|
49
|
-
:force
|
50
|
-
else
|
51
|
-
copy_file = false
|
52
|
-
:skip
|
53
|
-
end
|
54
|
-
|
55
|
-
log_relative msg, target
|
56
|
-
if copy_file && !pretend
|
57
|
-
dir = File.dirname(target)
|
58
|
-
FileUtils.mkdir_p(dir) unless File.exists?(dir)
|
59
|
-
FileUtils.mv(source, target, :force => true)
|
60
|
-
end
|
61
|
-
|
62
|
-
target
|
63
|
-
end
|
64
|
-
|
65
|
-
protected
|
66
|
-
|
67
|
-
# Ask the user interactively whether to force collision.
|
68
|
-
def force_file_collision?(target)
|
69
|
-
return false if skip
|
70
|
-
return true if force
|
71
|
-
|
72
|
-
prompt_out.print "overwrite #{target}? [Ynaiq] "
|
73
|
-
prompt_out.flush
|
74
|
-
case prompt_in.gets.strip
|
75
|
-
when /^y(es)?$/i
|
76
|
-
true
|
77
|
-
when /^n(o)?$/i
|
78
|
-
false
|
79
|
-
when /^a(ll)?$/i
|
80
|
-
self.force = true
|
81
|
-
true
|
82
|
-
when /^i(gnore)?$/i
|
83
|
-
self.skip = true
|
84
|
-
false
|
85
|
-
when /^q(uit)?$/i
|
86
|
-
prompt_out.puts "aborting"
|
87
|
-
raise SystemExit
|
88
|
-
else force_file_collision?(target)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Tap::Generator::Generators
|
2
|
-
|
3
|
-
# :startdoc: Tap::Generator::Generators::CommandGenerator::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 path('cmd')
|
14
|
-
|
15
|
-
template_files do |source, target|
|
16
|
-
m.template path('cmd', "#{command_name}.rb"), source, :command_name => command_name
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# tap <%= command_name %> {options} ARGS...
|
2
|
-
#
|
3
|
-
# The default command simply prints the input arguments
|
4
|
-
# and application information, then exits.
|
5
|
-
#
|
6
|
-
|
7
|
-
env = Tap::Env.instance
|
8
|
-
app = Tap::App.instance
|
9
|
-
|
10
|
-
#
|
11
|
-
# handle options
|
12
|
-
#
|
13
|
-
|
14
|
-
ConfigParser.new do |opts|
|
15
|
-
opts.separator ""
|
16
|
-
opts.separator "options:"
|
17
|
-
|
18
|
-
opts.on("-h", "--help", "Show this message") do
|
19
|
-
puts Lazydoc.usage(__FILE__)
|
20
|
-
puts opts
|
21
|
-
exit
|
22
|
-
end
|
23
|
-
|
24
|
-
end.parse!(ARGV)
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
# add your script code here
|
29
|
-
#
|
30
|
-
|
31
|
-
puts "Received: #{ARGV.join(', ')}"
|
32
|
-
puts app.info
|
@@ -1,98 +0,0 @@
|
|
1
|
-
module Tap::Generator::Generators
|
2
|
-
|
3
|
-
# :startdoc: Tap::Generator::Generators::ConfigGenerator::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
|
-
# Dumps a nested configuration.
|
10
|
-
DUMP_DELEGATES = lambda do |leader, delegate, block|
|
11
|
-
nested_delegates = delegate.default(false).delegates
|
12
|
-
indented_dump = Configurable::Utils.dump(nested_delegates, &block).gsub(/^/, " ")
|
13
|
-
"#{leader}: \n#{indented_dump}"
|
14
|
-
end
|
15
|
-
|
16
|
-
# Dumps configurations as YAML with documentation,
|
17
|
-
# used when the doc config is true.
|
18
|
-
DOC_FORMAT = lambda do |key, delegate|
|
19
|
-
# get the description
|
20
|
-
desc = delegate.attributes[:desc]
|
21
|
-
doc = desc.to_s
|
22
|
-
doc = desc.comment if doc.empty?
|
23
|
-
|
24
|
-
# wrap as lines
|
25
|
-
lines = Lazydoc::Utils.wrap(doc, 50).collect {|line| "# #{line}"}
|
26
|
-
lines << "" unless lines.empty?
|
27
|
-
|
28
|
-
if delegate.is_nest?
|
29
|
-
leader = "#{lines.join("\n")}#{key}"
|
30
|
-
DUMP_DELEGATES[leader, delegate, DOC_FORMAT]
|
31
|
-
else
|
32
|
-
default = delegate.default
|
33
|
-
|
34
|
-
# setup formatting
|
35
|
-
leader = default == nil ? '# ' : ''
|
36
|
-
config = YAML.dump({key => default})[5..-1]
|
37
|
-
"#{lines.join("\n")}#{leader}#{config.strip}\n\n"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# Dumps configurations as YAML without documentation,
|
42
|
-
# used when the doc config is false.
|
43
|
-
NODOC_FORMAT = lambda do |key, delegate|
|
44
|
-
if delegate.is_nest?
|
45
|
-
DUMP_DELEGATES[key, delegate, NODOC_FORMAT]
|
46
|
-
else
|
47
|
-
default = delegate.default
|
48
|
-
|
49
|
-
# setup formatting
|
50
|
-
leader = default == nil ? '# ' : ''
|
51
|
-
config = YAML.dump({key => default})[5..-1]
|
52
|
-
"#{leader}#{config.strip}\n"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
config :doc, true, &c.switch # include documentation in the config
|
57
|
-
config :nest, false, &c.switch # generate nested config files
|
58
|
-
config :blanks, true, &c.switch # allow generation of empty config files
|
59
|
-
|
60
|
-
# Lookup the named task class. Lookup happens through the active Env
|
61
|
-
# instance, specifically using:
|
62
|
-
#
|
63
|
-
# Env.instance.tasks.search(name)
|
64
|
-
#
|
65
|
-
# Raises an error if the name cannot be resolved to a task.
|
66
|
-
def lookup(name)
|
67
|
-
const = Tap::Env.instance.tasks.search(name) or raise "unknown task: #{name}"
|
68
|
-
const.constantize
|
69
|
-
end
|
70
|
-
|
71
|
-
def manifest(m, name, config_name=nil)
|
72
|
-
# setup
|
73
|
-
tasc = lookup(name)
|
74
|
-
config_name ||= tasc.default_name
|
75
|
-
config_file = path('config', config_name)
|
76
|
-
config_file += ".yml" if File.extname(config_file).empty?
|
77
|
-
|
78
|
-
# generate the dumps
|
79
|
-
dumps = Configurable::Utils.dump_file(tasc.configurations, config_file, nest, true, &format_block)
|
80
|
-
|
81
|
-
# now put the dumps to the manifest
|
82
|
-
m.directory(path('config'))
|
83
|
-
|
84
|
-
dumps.each do |path, content|
|
85
|
-
next if content.empty? && !blanks
|
86
|
-
m.file(path) do |file|
|
87
|
-
file << content
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
# A hook to set a formatting block. By default format_blocks
|
93
|
-
# returns DOC_FORMAT or NODOC_FORMAT as per the doc config.
|
94
|
-
def format_block
|
95
|
-
doc ? DOC_FORMAT : NODOC_FORMAT
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Tap::Generator::Generators
|
2
|
-
|
3
|
-
# :startdoc: Tap::Generator::Generators::GeneratorGenerator::generator a generator task and test
|
4
|
-
#
|
5
|
-
# Generates a new generator.
|
6
|
-
class GeneratorGenerator < Tap::Generator::Base
|
7
|
-
|
8
|
-
config :test, true, &c.switch # specifies creation of a test file
|
9
|
-
|
10
|
-
def manifest(m, const_name)
|
11
|
-
const = Tap::Support::Constant.new(const_name.camelize)
|
12
|
-
dir = path('lib', const.path)
|
13
|
-
|
14
|
-
# make the directory
|
15
|
-
m.directory dir
|
16
|
-
|
17
|
-
# make the generator
|
18
|
-
m.template path(dir, "#{const.basename}_generator.rb"), "task.erb", :const => const
|
19
|
-
|
20
|
-
# make the templates directory
|
21
|
-
m.directory path(dir, 'templates')
|
22
|
-
|
23
|
-
# make a template file
|
24
|
-
# (note it's easier to do this as a file since erb is
|
25
|
-
# added, and would have to be escaped in a template)
|
26
|
-
m.file path(dir, 'templates', 'template_file.erb') do |file|
|
27
|
-
file << "# A sample template file.\nkey: <%= key %>\n"
|
28
|
-
end
|
29
|
-
|
30
|
-
if test
|
31
|
-
test_path = path('test', "#{const.path}_generator_test.rb")
|
32
|
-
m.directory File.dirname(test_path)
|
33
|
-
m.template test_path, "test.erb", :const => const
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<% redirect do |target| %># <%= const.name %>::generator <replace with manifest summary>
|
2
|
-
# <replace with command line description>
|
3
|
-
|
4
|
-
# <%= const.const_name %> Documentation
|
5
|
-
class <%= const.const_name %>Generator < Tap::Generator::Base
|
6
|
-
|
7
|
-
config :key, 'value' # a sample config
|
8
|
-
|
9
|
-
# The generator will receive the inputs on the command line, and
|
10
|
-
# m, a Manifest object that records the actions of this method.
|
11
|
-
def manifest(m, *inputs)
|
12
|
-
|
13
|
-
# make a directory
|
14
|
-
# m.directory path
|
15
|
-
|
16
|
-
# make a file
|
17
|
-
# m.file path do |file|
|
18
|
-
# file << contents
|
19
|
-
# end
|
20
|
-
|
21
|
-
# template a file in the templates directory using ERB.
|
22
|
-
# The (key, value) pairs will be available in the
|
23
|
-
# template as local variables.
|
24
|
-
m.template "<%= const.const_name.underscore %>_file.txt", "template_file.erb", config.to_hash
|
25
|
-
|
26
|
-
end
|
27
|
-
end <% module_nest(const.nesting, ' ') { target } end %>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '<%= '../' * const.nesting_depth %>tap_test_helper.rb')
|
2
|
-
require '<%= const.path %>'
|
3
|
-
require 'tap/generator/preview.rb'
|
4
|
-
|
5
|
-
class <%= const.name %>Test < Test::Unit::TestCase
|
6
|
-
|
7
|
-
# Preview fakes out a generator for testing
|
8
|
-
Preview = Tap::Generator::Preview
|
9
|
-
|
10
|
-
acts_as_tap_test
|
11
|
-
|
12
|
-
def test_<%= const.basename %>
|
13
|
-
g = <%= const.name %>.new.extend Preview
|
14
|
-
|
15
|
-
# check the files and directories
|
16
|
-
assert_equal %w{
|
17
|
-
<%= const.const_name.underscore %>_file.txt
|
18
|
-
}, g.process
|
19
|
-
|
20
|
-
# check the content as necessary
|
21
|
-
assert_equal %q{
|
22
|
-
# A sample template file.
|
23
|
-
key: value
|
24
|
-
}, "\n" + g.builds['<%= const.const_name.underscore %>_file.txt']
|
25
|
-
end
|
26
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'tap/generator/base'
|
2
|
-
|
3
|
-
module Tap::Generator::Generators
|
4
|
-
|
5
|
-
# :startdoc: Tap::Generator::Generators::RootGenerator::generator a basic tap directory structure
|
6
|
-
#
|
7
|
-
# Generates a tap root directory structure. Use the switches to turn on or
|
8
|
-
# off the creation of various files:
|
9
|
-
#
|
10
|
-
# project
|
11
|
-
# |- MIT-LICENSE
|
12
|
-
# |- README
|
13
|
-
# |- Rakefile
|
14
|
-
# |- lib
|
15
|
-
# |- project.gemspec
|
16
|
-
# |- tap.yml
|
17
|
-
# `- test
|
18
|
-
# `- tap_test_helper.rb
|
19
|
-
#
|
20
|
-
class RootGenerator < Tap::Generator::Base
|
21
|
-
|
22
|
-
config :config_file, false, &c.switch # Create a full tap.yml file
|
23
|
-
config :license, true, &c.switch # Create an MIT-LICENSE
|
24
|
-
config :history, true, &c.switch # Create History file
|
25
|
-
config :rapfile, false, &c.switch # Create a Rapfile
|
26
|
-
|
27
|
-
# ::args ROOT, PROJECT_NAME=basename(ROOT)
|
28
|
-
def manifest(m, root, project_name=nil)
|
29
|
-
r = Tap::Root.new(root)
|
30
|
-
project_name = File.basename(r.root) if project_name == nil
|
31
|
-
|
32
|
-
m.directory r.root
|
33
|
-
m.directory r['lib']
|
34
|
-
m.directory r['test']
|
35
|
-
|
36
|
-
template_files do |source, target|
|
37
|
-
case
|
38
|
-
when File.directory?(source)
|
39
|
-
m.directory r[target]
|
40
|
-
next
|
41
|
-
when source =~ /gemspec$/
|
42
|
-
m.template r[project_name + '.gemspec'], source, {
|
43
|
-
:project_name => project_name,
|
44
|
-
:config_file => config_file,
|
45
|
-
:license => license,
|
46
|
-
:history => history
|
47
|
-
}
|
48
|
-
next
|
49
|
-
when source =~ /Rapfile$/
|
50
|
-
next unless rapfile
|
51
|
-
when source =~ /MIT-LICENSE$/
|
52
|
-
next unless license
|
53
|
-
end
|
54
|
-
|
55
|
-
m.template r[target], source, :project_name => project_name, :license => license
|
56
|
-
end
|
57
|
-
|
58
|
-
m.file(r['History']) if history
|
59
|
-
m.file(r['tap.yml']) do |file|
|
60
|
-
Configurable::Utils.dump(Tap::Env.configurations, file) do |key, delegate|
|
61
|
-
default = delegate.default(false)
|
62
|
-
|
63
|
-
# get the description
|
64
|
-
desc = delegate.attributes[:desc]
|
65
|
-
doc = desc.to_s
|
66
|
-
doc = desc.comment if doc.empty?
|
67
|
-
|
68
|
-
# wrap as lines
|
69
|
-
lines = Lazydoc::Utils.wrap(doc, 78).collect {|line| "# #{line}"}
|
70
|
-
lines << "" unless lines.empty?
|
71
|
-
|
72
|
-
# note: this causes order to be lost...
|
73
|
-
default = default.to_hash if delegate.is_nest?
|
74
|
-
|
75
|
-
# setup formatting
|
76
|
-
leader = key == 'root' || default == nil ? '# ' : ''
|
77
|
-
config = YAML.dump({key => default})[5..-1].strip.gsub(/\n+/, "\n#{leader}")
|
78
|
-
"#{lines.join("\n")}#{leader}#{config}\n\n"
|
79
|
-
end if config_file
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
end
|