bahuvrihi-tap 0.10.7 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/MIT-LICENSE +0 -2
  2. data/README +20 -31
  3. data/bin/rap +18 -8
  4. data/cgi/run.rb +47 -37
  5. data/cmd/console.rb +1 -1
  6. data/cmd/destroy.rb +3 -3
  7. data/cmd/generate.rb +3 -3
  8. data/cmd/manifest.rb +61 -53
  9. data/cmd/run.rb +1 -1
  10. data/doc/Class Reference +119 -110
  11. data/doc/Command Reference +76 -123
  12. data/doc/Syntax Reference +290 -0
  13. data/doc/Tutorial +307 -237
  14. data/lib/tap.rb +1 -12
  15. data/lib/tap/app.rb +46 -71
  16. data/lib/tap/constants.rb +1 -1
  17. data/lib/tap/declarations.rb +110 -100
  18. data/lib/tap/env.rb +141 -173
  19. data/lib/tap/exe.rb +5 -5
  20. data/lib/tap/file_task.rb +2 -2
  21. data/lib/tap/generator/base.rb +0 -4
  22. data/lib/tap/generator/destroy.rb +8 -12
  23. data/lib/tap/generator/generate.rb +19 -14
  24. data/lib/tap/generator/generators/command/command_generator.rb +1 -1
  25. data/lib/tap/generator/generators/config/config_generator.rb +3 -3
  26. data/lib/tap/generator/generators/file_task/file_task_generator.rb +1 -1
  27. data/lib/tap/generator/generators/generator/generator_generator.rb +27 -0
  28. data/lib/tap/generator/generators/generator/templates/task.erb +27 -0
  29. data/lib/tap/generator/generators/root/root_generator.rb +12 -12
  30. data/lib/tap/generator/generators/root/templates/Rakefile +1 -2
  31. data/lib/tap/generator/generators/root/templates/tapfile +11 -8
  32. data/lib/tap/generator/generators/task/task_generator.rb +1 -3
  33. data/lib/tap/generator/generators/task/templates/test.erb +1 -3
  34. data/lib/tap/root.rb +4 -2
  35. data/lib/tap/support/aggregator.rb +16 -3
  36. data/lib/tap/support/assignments.rb +10 -9
  37. data/lib/tap/support/audit.rb +58 -62
  38. data/lib/tap/support/class_configuration.rb +32 -43
  39. data/lib/tap/support/combinator.rb +7 -7
  40. data/lib/tap/support/configurable.rb +13 -14
  41. data/lib/tap/support/configurable_class.rb +6 -30
  42. data/lib/tap/support/configuration.rb +36 -9
  43. data/lib/tap/support/constant.rb +75 -13
  44. data/lib/tap/support/constant_manifest.rb +115 -0
  45. data/lib/tap/support/dependencies.rb +27 -67
  46. data/lib/tap/support/dependency.rb +44 -0
  47. data/lib/tap/support/executable.rb +78 -109
  48. data/lib/tap/support/executable_queue.rb +1 -1
  49. data/lib/tap/support/gems.rb +6 -0
  50. data/lib/tap/support/gems/rack.rb +197 -84
  51. data/lib/tap/support/instance_configuration.rb +29 -3
  52. data/lib/tap/support/intern.rb +46 -0
  53. data/lib/tap/support/join.rb +67 -11
  54. data/lib/tap/support/joins.rb +2 -0
  55. data/lib/tap/support/joins/fork.rb +1 -0
  56. data/lib/tap/support/joins/merge.rb +3 -1
  57. data/lib/tap/support/joins/sequence.rb +2 -2
  58. data/lib/tap/support/joins/switch.rb +3 -1
  59. data/lib/tap/support/joins/sync_merge.rb +6 -0
  60. data/lib/tap/support/lazy_attributes.rb +16 -1
  61. data/lib/tap/support/lazydoc.rb +21 -21
  62. data/lib/tap/support/lazydoc/comment.rb +59 -55
  63. data/lib/tap/support/lazydoc/definition.rb +36 -0
  64. data/lib/tap/support/lazydoc/document.rb +37 -13
  65. data/lib/tap/support/manifest.rb +120 -131
  66. data/lib/tap/support/minimap.rb +90 -0
  67. data/lib/tap/support/node.rb +4 -6
  68. data/lib/tap/support/parser.rb +63 -6
  69. data/lib/tap/support/schema.rb +11 -2
  70. data/lib/tap/support/shell_utils.rb +3 -5
  71. data/lib/tap/support/string_ext.rb +60 -0
  72. data/lib/tap/support/tdoc.rb +2 -2
  73. data/lib/tap/support/templater.rb +29 -15
  74. data/lib/tap/support/validation.rb +22 -11
  75. data/lib/tap/task.rb +155 -156
  76. data/lib/tap/tasks/load.rb +95 -8
  77. data/lib/tap/test/extensions.rb +2 -1
  78. data/lib/tap/test/script_tester.rb +7 -1
  79. data/template/index.erb +39 -32
  80. metadata +13 -13
  81. data/lib/tap/generator/generators/root/templates/test/tapfile_test.rb +0 -15
  82. data/lib/tap/patches/rake/rake_test_loader.rb +0 -8
  83. data/lib/tap/patches/rake/testtask.rb +0 -57
  84. data/lib/tap/patches/ruby19/backtrace_filter.rb +0 -51
  85. data/lib/tap/patches/ruby19/parsedate.rb +0 -16
  86. data/lib/tap/spec.rb +0 -42
  87. data/lib/tap/spec/adapter.rb +0 -25
  88. data/lib/tap/spec/inheritable_class_test_root.rb +0 -9
  89. data/lib/tap/support/constant_utils.rb +0 -127
  90. data/lib/tap/support/summary.rb +0 -30
@@ -1,16 +0,0 @@
1
- require 'date/format'
2
-
3
- # Taken directly from the Ruby 1.8.6 standard library. Ruby 1.9 has apparently
4
- # eliminated this class, but it is currently (2008-02-08) required by ActiveSupport.
5
- #
6
- # Making this file available to ActiveSupport allows testing under Ruby 1.9,
7
- # but this patch should be unnecessary when ActiveSupport upgrades and becomes
8
- # compatible with Ruby 1.9
9
- module ParseDate # :nodoc:
10
- def parsedate(str, comp=false)
11
- Date._parse(str, comp).
12
- values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
13
- end
14
-
15
- module_function :parsedate
16
- end
@@ -1,42 +0,0 @@
1
- require 'tap/test/extensions'
2
- require 'tap/spec/adapter'
3
- require 'tap/spec/inheritable_class_test_root'
4
-
5
- module Spec
6
- module Example
7
- class ExampleGroup
8
- extend Tap::Test::Extensions
9
- include Tap::Spec::Adapter
10
-
11
- class << self
12
- def acts_as_file_test(*args)
13
- super
14
- extend Tap::Spec::InheritableClassTestRoot
15
- end
16
-
17
- private
18
-
19
- # Infers the test root directory from the calling file.
20
- # 'some_class.rb' => 'some_class'
21
- # 'some_class_test.rb' => 'some_class'
22
- def test_root_dir # :nodoc:
23
- # caller[2] is considered the calling file (which should be the test case)
24
- # note that caller entries are like this:
25
- # ./path/to/file.rb:10
26
- # ./path/to/file.rb:10:in 'method'
27
-
28
- calling_file = caller[2].gsub(/:\d+(:in .*)?$/, "")
29
- calling_file.chomp(File.extname(calling_file)).chomp("_spec")
30
- end
31
- end
32
-
33
- before(:each) do
34
- setup
35
- end
36
-
37
- after(:each) do
38
- teardown
39
- end
40
- end
41
- end
42
- end
@@ -1,25 +0,0 @@
1
- module Tap
2
- module Spec
3
- module Adapter
4
- def setup
5
- end
6
-
7
- def teardown
8
- end
9
-
10
- def method_name
11
- self.description.strip.gsub(/\s+/, "_")
12
- end
13
-
14
- # Maps flunk to violated.
15
- def flunk(msg)
16
- violated(msg)
17
- end
18
-
19
- # Maps assert_equal to actual.should.equal expected.
20
- def assert_equal(expected, actual, msg=nil)
21
- actual.should == expected
22
- end
23
- end
24
- end
25
- end
@@ -1,9 +0,0 @@
1
- module Tap
2
- module Spec
3
- module InheritableClassTestRoot
4
- def class_test_root
5
- @class_test_root ||= (superclass.respond_to?(:class_test_root) ? superclass.class_test_root : nil)
6
- end
7
- end
8
- end
9
- end
@@ -1,127 +0,0 @@
1
- module Tap
2
- module Support
3
-
4
- # ConstantUtils provides methods for transforming strings into constants.
5
- # Several methods are directly taken from or based heavily on the
6
- # ActiveSupport {Inflections}[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/String/Inflections.html]
7
- # module and should not cause conflicts if ActiveSupport is loaded
8
- # alongside Tap.
9
- #
10
- # ActiveSupport is distributed with an MIT-LICENSE:
11
- #
12
- # Copyright (c) 2004-2008 David Heinemeier Hansson
13
- #
14
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
15
- # associated documentation files (the "Software"), to deal in the Software without restriction,
16
- # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
- # and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
18
- # subject to the following conditions:
19
- #
20
- # The above copyright notice and this permission notice shall be included in all copies or substantial
21
- # portions of the Software.
22
- #
23
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24
- # LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
25
- # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26
- # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27
- # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- #
29
- module ConstantUtils
30
-
31
- # camelize converts self to UpperCamelCase. If the argument to
32
- # camelize is set to :lower then camelize produces lowerCamelCase.
33
- # camelize will also convert '/' to '::' which is useful for
34
- # converting paths to namespaces.
35
- def camelize(first_letter = :upper)
36
- case first_letter
37
- when :upper then self.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
38
- when :lower then self.first + camelize[1..-1]
39
- end
40
- end
41
-
42
- # The reverse of camelize. Makes an underscored, lowercase form
43
- # from self. underscore will also change '::' to '/' to convert
44
- # namespaces to paths.
45
- def underscore
46
- self.gsub(/::/, '/').
47
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
48
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
49
- tr("-", "_").
50
- downcase
51
- end
52
-
53
- # constantize tries to find a declared constant with the name specified
54
- # by self. It raises a NameError when the name is not in CamelCase
55
- # or is not initialized.
56
- def constantize
57
- case RUBY_VERSION
58
- when /^1.9/
59
-
60
- # a check is necessary to maintain the 1.8 behavior
61
- # in 1.9, where ancestor constants may be returned
62
- # by a direct evaluation
63
- const_name.split("::").inject(Object) do |current, const|
64
- const = const.to_sym
65
-
66
- current.const_get(const).tap do |c|
67
- unless current.const_defined?(const, false)
68
- raise NameError.new("uninitialized constant #{const_name}")
69
- end
70
- end
71
- end
72
-
73
- else
74
- Object.module_eval("::#{const_name}", __FILE__, __LINE__)
75
- end
76
- end
77
-
78
- # Tries to constantize self; if a NameError is raised, try_constantize
79
- # passes control to the block. Control is only passed if the NameError
80
- # is for one of the constants in self.
81
- def try_constantize
82
- begin
83
- constantize
84
- rescue(NameError)
85
- error_name = $!.name.to_s
86
- missing_const = const_name.split(/::/).inject(Object) do |current, const|
87
- if current.const_defined?(const)
88
- current.const_get(const)
89
- else
90
- break(const)
91
- end
92
- end
93
-
94
- # check that the error_name is the first missing constant
95
- raise $! unless missing_const == error_name
96
- yield(const_name)
97
- end
98
- end
99
-
100
- def constants_split
101
- camel_cased_word = camelize
102
- unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ camel_cased_word
103
- raise NameError, "#{camel_cased_word.inspect} is not a valid constant name!"
104
- end
105
-
106
- constants = $1.split(/::/)
107
- current = Object
108
- while !constants.empty?
109
- break unless current.const_defined?(constants[0])
110
- current = current.const_get(constants.shift)
111
- end
112
-
113
- [current, constants]
114
- end
115
-
116
- protected
117
-
118
- def const_name
119
- unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ self
120
- raise NameError, "#{inspect} is not a valid constant name!"
121
- end
122
- $1
123
- end
124
-
125
- end
126
- end
127
- end
@@ -1,30 +0,0 @@
1
- module Tap
2
- module Support
3
- class Summary
4
- def initialize
5
- @map = []
6
- @width = 10
7
- end
8
-
9
- def add(env_key, env, map)
10
- unless map.empty?
11
- @map << [env_key, env, map]
12
- map.each {|(key, path)| @width = key.length if @width < key.length }
13
- end
14
- end
15
-
16
- def lines
17
- lines = []
18
- @map.each do |(env_lookup, env, map)|
19
- lines << "#{env_lookup}:" if @map.length > 1
20
- map.each do |(key, path)|
21
- desc = block_given? ? (yield(path) || '') : ''
22
- desc = " # #{desc}" unless desc.empty?
23
- lines << (" %-#{@width}s%s" % [key, desc])
24
- end
25
- end
26
- lines
27
- end
28
- end
29
- end
30
- end