tap 0.12.4 → 0.17.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 +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,99 +0,0 @@
|
|
1
|
-
require 'tap/test/env_vars'
|
2
|
-
|
3
|
-
module Tap
|
4
|
-
module Test
|
5
|
-
|
6
|
-
# Class methods extending tests which include SubsetTest.
|
7
|
-
module SubsetTestClass
|
8
|
-
include Tap::Test::EnvVars
|
9
|
-
|
10
|
-
# Passes conditions to subclass
|
11
|
-
def inherited(child) # :nodoc:
|
12
|
-
super
|
13
|
-
dup = {}
|
14
|
-
conditions.each_pair {|key, value| dup[key] = value.dup }
|
15
|
-
child.instance_variable_set(:@conditions, dup)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Initialize conditions.
|
19
|
-
def self.extended(base) # :nodoc:
|
20
|
-
base.instance_variable_set(:@conditions, {})
|
21
|
-
end
|
22
|
-
|
23
|
-
# A hash of [name, [msg, condition_block]] pairs defined by condition.
|
24
|
-
attr_reader :conditions
|
25
|
-
|
26
|
-
# Defines a condition block and associated message.
|
27
|
-
# Raises an error if no condition block is given.
|
28
|
-
def condition(name, msg=nil, &block)
|
29
|
-
raise ArgumentError, "no condition block given" unless block_given?
|
30
|
-
conditions[name] = [msg, block]
|
31
|
-
end
|
32
|
-
|
33
|
-
# Returns true if the all blocks for the specified conditions return true.
|
34
|
-
#
|
35
|
-
# condition(:is_true) { true }
|
36
|
-
# condition(:is_false) { false }
|
37
|
-
# satisfied?(:is_true) # => true
|
38
|
-
# satisfied?(:is_true, :is_false) # => false
|
39
|
-
#
|
40
|
-
# Yields the name and message for each unsatisfied condition to the
|
41
|
-
# block, if given.
|
42
|
-
def satisfied?(*names) # :yields: name-of-unsatisfied-condition, msg
|
43
|
-
unsatisfied = unsatisfied_conditions(*names)
|
44
|
-
|
45
|
-
unsatisfied.each do |name|
|
46
|
-
yield(name, condition[name][0])
|
47
|
-
end if block_given?
|
48
|
-
|
49
|
-
unsatisfied.empty?
|
50
|
-
end
|
51
|
-
|
52
|
-
# Returns an array of the unsatified conditions. Raises
|
53
|
-
# an error if a condition has not been defined.
|
54
|
-
#
|
55
|
-
# condition(:is_true) { true }
|
56
|
-
# condition(:is_false) { false }
|
57
|
-
# unsatisfied_conditions(:is_true, :is_false) # => [:is_false]
|
58
|
-
#
|
59
|
-
def unsatisfied_conditions(*condition_names)
|
60
|
-
condition_names = conditions.keys if condition_names.empty?
|
61
|
-
unsatified = []
|
62
|
-
condition_names.each do |name|
|
63
|
-
unless condition = conditions[name]
|
64
|
-
raise ArgumentError, "Unknown condition: #{name}"
|
65
|
-
end
|
66
|
-
|
67
|
-
unsatified << name unless condition.last.call
|
68
|
-
end
|
69
|
-
unsatified
|
70
|
-
end
|
71
|
-
|
72
|
-
# Returns true if RUBY_PLATFORM matches one of the specfied
|
73
|
-
# platforms. Use the prefix 'non_' to specify any plaform
|
74
|
-
# except the specified platform (ex: 'non_mswin'). Returns
|
75
|
-
# true if no platforms are specified.
|
76
|
-
#
|
77
|
-
# Some common platforms:
|
78
|
-
# mswin Windows
|
79
|
-
# darwin Mac
|
80
|
-
def match_platform?(*platforms)
|
81
|
-
platforms.each do |platform|
|
82
|
-
platform.to_s =~ /^(non_)?(.*)/
|
83
|
-
|
84
|
-
non = true if $1
|
85
|
-
match_platform = !RUBY_PLATFORM.index($2).nil?
|
86
|
-
return false unless (non && !match_platform) || (!non && match_platform)
|
87
|
-
end
|
88
|
-
|
89
|
-
true
|
90
|
-
end
|
91
|
-
|
92
|
-
# Returns true if the subset type or 'ALL' is specified in ENV
|
93
|
-
def run_subset?(type)
|
94
|
-
env_true?(type) || env_true?("ALL") ? true : false
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
data/lib/tap/test/tap_test.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'tap'
|
2
|
-
|
3
|
-
module Tap
|
4
|
-
module Test
|
5
|
-
|
6
|
-
# Tap-specific testing methods to help with testing Tasks, such as the
|
7
|
-
# checking of audits and test-specific modification of application
|
8
|
-
# configuration.
|
9
|
-
#
|
10
|
-
# === Class Methods
|
11
|
-
#
|
12
|
-
# See {Test::Unit::TestCase}[link:classes/Test/Unit/TestCase.html] for documentation of the class methods added by TapTest.
|
13
|
-
module TapTest
|
14
|
-
|
15
|
-
# Returns the test-method-specific application.
|
16
|
-
attr_reader :app
|
17
|
-
|
18
|
-
# Setup creates a test-method-specific application that is initialized
|
19
|
-
# to the method_root, and uses the relative and absolute paths from
|
20
|
-
# trs (the test root structure, see Tap::Test::FileTest).
|
21
|
-
#
|
22
|
-
# Also makes sure Tap::App.instance returns the test method app.
|
23
|
-
def setup
|
24
|
-
super
|
25
|
-
@app = Tap::App.new(app_config)
|
26
|
-
Tap::App.instance = @app
|
27
|
-
end
|
28
|
-
|
29
|
-
# Asserts that an array of audits are all equal, basically feeding
|
30
|
-
# each pair of audits to assert_audit_equal.
|
31
|
-
def assert_audits_equal(expected, audits, msg=nil, &block)
|
32
|
-
assert_equal expected.length, audits.length, "expected <#{expected.length}> audits, but was <#{audits.length}>"
|
33
|
-
Utils.each_pair_with_index(expected, audits) do |exp, audit, index|
|
34
|
-
assert_audit_equal(exp, audit, &block)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Asserts that an audit trail matches the expected trail. By default
|
39
|
-
# the expected trail should be composed of [key, value] arrays
|
40
|
-
# representing each audit, but a block may be provided to collect other
|
41
|
-
# attributes.
|
42
|
-
#
|
43
|
-
# Simple assertion:
|
44
|
-
#
|
45
|
-
# a = Audit.new(:a, 'a')
|
46
|
-
# b = Audit.new(:b, 'b', a)
|
47
|
-
#
|
48
|
-
# e = [[:a, 'a'], [:b, 'b']]
|
49
|
-
# assert_audit_equal(e, b)
|
50
|
-
#
|
51
|
-
# Assertion with merge:
|
52
|
-
#
|
53
|
-
# a = Audit.new(:a, 'a')
|
54
|
-
# b = Audit.new(:b, 'b', a)
|
55
|
-
#
|
56
|
-
# c = Audit.new(:c, 'c')
|
57
|
-
# d = Audit.new(:d, 'd', c)
|
58
|
-
#
|
59
|
-
# e = Audit.new(:e, 'e')
|
60
|
-
# f = Audit.new(:f, 'f', [b,d])
|
61
|
-
#
|
62
|
-
# eb = [[:a, "a"], [:b, "b"]]
|
63
|
-
# ed = [[:c, "c"], [:d, "d"]]
|
64
|
-
# e = [[eb, ed], [:e, "e"], [:f, "f"]]
|
65
|
-
#
|
66
|
-
# assert_audit_equal(e, c)
|
67
|
-
#
|
68
|
-
def assert_audit_equal(expected, audit, msg=nil, &block)
|
69
|
-
block = lambda {|a| [a.key, a.value] } unless block
|
70
|
-
actual = audit.trail(&block)
|
71
|
-
assert_equal(expected, actual, msg)
|
72
|
-
end
|
73
|
-
|
74
|
-
# The configurations used to initialize self.app
|
75
|
-
def app_config
|
76
|
-
{:quiet => true, :debug => true}
|
77
|
-
end
|
78
|
-
|
79
|
-
# Reconfigures app with the input configurations for the
|
80
|
-
# duration of the block.
|
81
|
-
#
|
82
|
-
# app = Tap::App.new(:quiet => true, :debug => false)
|
83
|
-
# with_config({:quiet => false}, app) do
|
84
|
-
# app.quiet # => false
|
85
|
-
# app.debug # => false
|
86
|
-
# end
|
87
|
-
#
|
88
|
-
# app.quiet # => true
|
89
|
-
# app.debug # => false
|
90
|
-
#
|
91
|
-
def with_config(config={}, app=self.app, &block)
|
92
|
-
begin
|
93
|
-
hold = app.config.to_hash
|
94
|
-
|
95
|
-
app.reconfigure(config)
|
96
|
-
|
97
|
-
yield block if block_given?
|
98
|
-
ensure
|
99
|
-
app.send(:initialize_config, hold)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
data/lib/tap/test/utils.rb
DELETED
@@ -1,231 +0,0 @@
|
|
1
|
-
require 'tap/root'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'tempfile'
|
4
|
-
|
5
|
-
module Tap
|
6
|
-
module Support
|
7
|
-
autoload(:Templater, 'tap/support/templater')
|
8
|
-
end
|
9
|
-
|
10
|
-
module Test
|
11
|
-
module Utils
|
12
|
-
module_function
|
13
|
-
|
14
|
-
# Generates an array of [source, reference] pairs mapping source
|
15
|
-
# files to reference files under the source and reference dirs,
|
16
|
-
# respectively. Only files under source dir matching the pattern
|
17
|
-
# will be mapped. Mappings are either (in this order):
|
18
|
-
#
|
19
|
-
# - the path under reference_dir contained in the source file
|
20
|
-
# - a direct translation of the source file from the source to
|
21
|
-
# the reference dir, minus the extname
|
22
|
-
#
|
23
|
-
# Notes:
|
24
|
-
# - Source files may contain comments but should otherwise
|
25
|
-
# consist only of indentation (which is stripped) and
|
26
|
-
# the reference path.
|
27
|
-
# - If a mapped path cannot be found, dereference raises
|
28
|
-
# a DereferenceError.
|
29
|
-
#
|
30
|
-
# === example
|
31
|
-
#
|
32
|
-
# root
|
33
|
-
# |- input
|
34
|
-
# | |- dir.ref
|
35
|
-
# | |- ignored.txt
|
36
|
-
# | |- one.txt.ref
|
37
|
-
# | `- two.txt.ref
|
38
|
-
# `- ref
|
39
|
-
# |- dir
|
40
|
-
# |- one.txt
|
41
|
-
# `- path
|
42
|
-
# `- to
|
43
|
-
# `- two.txt
|
44
|
-
#
|
45
|
-
# The 'two.txt.ref' file contains a reference path:
|
46
|
-
#
|
47
|
-
# File.read('/root/input/two.txt.ref') # => 'path/to/two.txt'
|
48
|
-
#
|
49
|
-
# Now:
|
50
|
-
#
|
51
|
-
# reference_map('/root/input', '/root/ref')
|
52
|
-
# # => [
|
53
|
-
# # ['/root/input/dir.ref', '/root/ref/dir'],
|
54
|
-
# # ['/root/input/one.txt.ref', '/root/ref/one.txt'],
|
55
|
-
# # ['/root/input/two.txt.ref', '/root/ref/path/to/two.txt']]
|
56
|
-
#
|
57
|
-
# And since no path matches 'ignored.txt':
|
58
|
-
#
|
59
|
-
# reference_map('/root/input', '/root/ref', '**/*.txt')
|
60
|
-
# # !> DereferenceError
|
61
|
-
#
|
62
|
-
def reference_map(source_dir, reference_dir, pattern='**/*.ref')
|
63
|
-
Dir.glob(File.join(source_dir, pattern)).sort.collect do |source|
|
64
|
-
# use the path specified in the source file
|
65
|
-
relative_path = File.read(source).gsub(/#.*$/, "").strip
|
66
|
-
|
67
|
-
# use the relative filepath of the source file to the
|
68
|
-
# source dir (minus the extname) if no path is specified
|
69
|
-
if relative_path.empty?
|
70
|
-
relative_path = Tap::Root.relative_filepath(source_dir, source).chomp(File.extname(source))
|
71
|
-
end
|
72
|
-
|
73
|
-
reference = File.join(reference_dir, relative_path)
|
74
|
-
|
75
|
-
# raise an error if no reference file is found
|
76
|
-
unless File.exists?(reference)
|
77
|
-
raise DereferenceError, "no reference found for: #{source}"
|
78
|
-
end
|
79
|
-
|
80
|
-
[source, reference]
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Dereferences source files with reference files for the duration
|
85
|
-
# of the block. The mappings of source to reference files are
|
86
|
-
# determined using reference_map; dereferenced files are at the
|
87
|
-
# same location as the source files, but with the '.ref' extname
|
88
|
-
# removed.
|
89
|
-
#
|
90
|
-
# Notes:
|
91
|
-
# - The reference extname is implicitly specified in pattern;
|
92
|
-
# the final extname of the source file is removed during
|
93
|
-
# dereferencing regardless of what it is.
|
94
|
-
#
|
95
|
-
def dereference(source_dirs, reference_dir, pattern='**/*.ref', tempdir=Dir::tmpdir)
|
96
|
-
mapped_paths = []
|
97
|
-
begin
|
98
|
-
[*source_dirs].each do |source_dir|
|
99
|
-
reference_map(source_dir, reference_dir, pattern).each do |source, reference|
|
100
|
-
|
101
|
-
# move the source file to a temporary location
|
102
|
-
tempfile = Tempfile.new(File.basename(source), tempdir)
|
103
|
-
tempfile.close
|
104
|
-
FileUtils.mv(source, tempfile.path)
|
105
|
-
|
106
|
-
# copy the reference to the target
|
107
|
-
target = source.chomp(File.extname(source))
|
108
|
-
FileUtils.cp_r(reference, target)
|
109
|
-
|
110
|
-
mapped_paths << [target, source, tempfile]
|
111
|
-
end
|
112
|
-
end unless reference_dir == nil
|
113
|
-
|
114
|
-
yield
|
115
|
-
|
116
|
-
ensure
|
117
|
-
mapped_paths.each do |target, source, tempfile|
|
118
|
-
# remove the target and restore the original source file
|
119
|
-
FileUtils.rm_r(target) if File.exists?(target)
|
120
|
-
FileUtils.mv(tempfile.path, source)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
# Uses a Tap::Support::Templater to template and replace the contents of path,
|
126
|
-
# for the duration of the block. The attributes will be available in the
|
127
|
-
# template context.
|
128
|
-
def template(paths, attributes={}, tempdir=Dir::tmpdir)
|
129
|
-
mapped_paths = []
|
130
|
-
begin
|
131
|
-
[*paths].each do |path|
|
132
|
-
# move the source file to a temporary location
|
133
|
-
tempfile = Tempfile.new(File.basename(path), tempdir)
|
134
|
-
tempfile.close
|
135
|
-
FileUtils.cp(path, tempfile.path)
|
136
|
-
|
137
|
-
# template the source file
|
138
|
-
content = File.read(path)
|
139
|
-
File.open(path, "wb") do |file|
|
140
|
-
file << Support::Templater.new(content, attributes).build
|
141
|
-
end
|
142
|
-
|
143
|
-
mapped_paths << [path, tempfile]
|
144
|
-
end
|
145
|
-
|
146
|
-
yield
|
147
|
-
|
148
|
-
ensure
|
149
|
-
mapped_paths.each do |path, tempfile|
|
150
|
-
# restore the original source file
|
151
|
-
FileUtils.rm(path) if File.exists?(path)
|
152
|
-
FileUtils.mv(tempfile.path, path)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
# Yields to the input block for each pair of entries in the input
|
158
|
-
# arrays. An error is raised if the input arrays do not have equal
|
159
|
-
# numbers of entries.
|
160
|
-
def each_pair(a, b, &block) # :yields: entry_a, entry_b,
|
161
|
-
each_pair_with_index(a,b) do |entry_a, entry_b, index|
|
162
|
-
yield(entry_a, entry_b)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
# Same as each_pair but yields the index of the entries as well.
|
167
|
-
def each_pair_with_index(a, b, error_msg=nil, &block) # :yields: entry_a, entry_b, index
|
168
|
-
a = [a] unless a.kind_of?(Array)
|
169
|
-
b = [b] unless b.kind_of?(Array)
|
170
|
-
|
171
|
-
unless a.length == b.length
|
172
|
-
raise ArgumentError, (error_msg || "The input arrays must have an equal number of entries.")
|
173
|
-
end
|
174
|
-
|
175
|
-
0.upto(a.length-1) do |index|
|
176
|
-
yield(a[index], b[index], index)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
# Attempts to recursively remove the specified method directory and all
|
181
|
-
# files within it. Raises an error if the removal does not succeed.
|
182
|
-
def clear_dir(dir)
|
183
|
-
# clear out the folder if it exists
|
184
|
-
FileUtils.rm_r(dir) if File.exists?(dir)
|
185
|
-
end
|
186
|
-
|
187
|
-
# Attempts to remove the specified directory. The root
|
188
|
-
# will not be removed if the directory does not exist, or
|
189
|
-
# is not empty.
|
190
|
-
def try_remove_dir(dir)
|
191
|
-
# Remove the directory if possible
|
192
|
-
begin
|
193
|
-
FileUtils.rmdir(dir) if File.exists?(dir) && Dir.glob(File.join(dir, "*")).empty?
|
194
|
-
rescue
|
195
|
-
# rescue cases where there is a hidden file, for example .svn
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
# Sets ARGV to the input argv for the duration of the block.
|
200
|
-
def with_argv(argv=[])
|
201
|
-
current_argv = ARGV.dup
|
202
|
-
begin
|
203
|
-
ARGV.clear
|
204
|
-
ARGV.concat(argv)
|
205
|
-
|
206
|
-
yield
|
207
|
-
|
208
|
-
ensure
|
209
|
-
ARGV.clear
|
210
|
-
ARGV.concat(current_argv)
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
def whitespace_escape(str)
|
215
|
-
str.to_s.gsub(/\s/) do |match|
|
216
|
-
case match
|
217
|
-
when "\n" then "\\n\n"
|
218
|
-
when "\t" then "\\t"
|
219
|
-
when "\r" then "\\r"
|
220
|
-
when "\f" then "\\f"
|
221
|
-
else match
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
# Raised when no reference can be found for a reference path.
|
227
|
-
class DereferenceError < StandardError
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|