sprout 1.0.32.pre → 1.0.35.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprout might be problematic. Click here for more details.

Files changed (208) hide show
  1. data/Gemfile +2 -1
  2. data/Gemfile.lock +4 -2
  3. data/README.textile +12 -13
  4. data/VERSION +1 -0
  5. data/doc/Dir.html +288 -0
  6. data/doc/Rake/Task.html +184 -0
  7. data/doc/Sprout.html +144 -0
  8. data/doc/Sprout/ArchiveUnpacker.html +1246 -0
  9. data/doc/Sprout/Base.html +126 -0
  10. data/doc/Sprout/Base/ClassMethods.html +434 -0
  11. data/doc/Sprout/Concern.html +353 -0
  12. data/doc/Sprout/Daemon.html +166 -0
  13. data/doc/Sprout/Daemon/ClassMethods.html +244 -0
  14. data/doc/Sprout/Daemon/InstanceMethods.html +601 -0
  15. data/doc/Sprout/Errors.html +101 -0
  16. data/doc/Sprout/Errors/ArchiveUnpackerError.html +125 -0
  17. data/doc/Sprout/Errors/DestinationExistsError.html +133 -0
  18. data/doc/Sprout/Errors/DuplicateMemberError.html +132 -0
  19. data/doc/Sprout/Errors/ExecutableError.html +125 -0
  20. data/doc/Sprout/Errors/ExecutableRegistrationError.html +132 -0
  21. data/doc/Sprout/Errors/ExecutionError.html +121 -0
  22. data/doc/Sprout/Errors/GeneratorError.html +125 -0
  23. data/doc/Sprout/Errors/InvalidArgumentError.html +132 -0
  24. data/doc/Sprout/Errors/LoadError.html +121 -0
  25. data/doc/Sprout/Errors/MissingArgumentError.html +132 -0
  26. data/doc/Sprout/Errors/MissingExecutableError.html +132 -0
  27. data/doc/Sprout/Errors/MissingGeneratorError.html +132 -0
  28. data/doc/Sprout/Errors/MissingTemplateError.html +132 -0
  29. data/doc/Sprout/Errors/ProcessRunnerError.html +121 -0
  30. data/doc/Sprout/Errors/RemoteFileLoaderError.html +110 -0
  31. data/doc/Sprout/Errors/SproutError.html +114 -0
  32. data/doc/Sprout/Errors/UnknownArchiveType.html +122 -0
  33. data/doc/Sprout/Errors/UsageError.html +121 -0
  34. data/doc/Sprout/Errors/ValidationError.html +121 -0
  35. data/doc/Sprout/Errors/VersionRequirementNotMetError.html +121 -0
  36. data/doc/Sprout/Executable.html +173 -0
  37. data/doc/Sprout/Executable/Boolean.html +483 -0
  38. data/doc/Sprout/Executable/ClassMethods.html +417 -0
  39. data/doc/Sprout/Executable/CollectionParam.html +483 -0
  40. data/doc/Sprout/Executable/FileParam.html +484 -0
  41. data/doc/Sprout/Executable/Files.html +292 -0
  42. data/doc/Sprout/Executable/InstanceMethods.html +2006 -0
  43. data/doc/Sprout/Executable/Number.html +141 -0
  44. data/doc/Sprout/Executable/Param.html +2818 -0
  45. data/doc/Sprout/Executable/ParameterFactory.html +232 -0
  46. data/doc/Sprout/Executable/Path.html +223 -0
  47. data/doc/Sprout/Executable/Paths.html +253 -0
  48. data/doc/Sprout/Executable/StringParam.html +213 -0
  49. data/doc/Sprout/Executable/Strings.html +167 -0
  50. data/doc/Sprout/Executable/Url.html +160 -0
  51. data/doc/Sprout/Executable/Urls.html +170 -0
  52. data/doc/Sprout/FileTarget.html +1109 -0
  53. data/doc/Sprout/Generator.html +689 -0
  54. data/doc/Sprout/Generator/Base.html +1626 -0
  55. data/doc/Sprout/Generator/Command.html +690 -0
  56. data/doc/Sprout/Generator/DirectoryManifest.html +476 -0
  57. data/doc/Sprout/Generator/FileManifest.html +572 -0
  58. data/doc/Sprout/Generator/Manifest.html +377 -0
  59. data/doc/Sprout/Generator/TemplateManifest.html +196 -0
  60. data/doc/Sprout/GeneratorGenerator.html +1018 -0
  61. data/doc/Sprout/Library.html +1141 -0
  62. data/doc/Sprout/LibraryGenerator.html +309 -0
  63. data/doc/Sprout/Log.html +496 -0
  64. data/doc/Sprout/MXMLC.html +6373 -0
  65. data/doc/Sprout/Platform.html +714 -0
  66. data/doc/Sprout/ProcessRunner.html +1352 -0
  67. data/doc/Sprout/ProgressBar.html +376 -0
  68. data/doc/Sprout/ProgressBarImpl.html +2119 -0
  69. data/doc/Sprout/ProgressBarManager.html +434 -0
  70. data/doc/Sprout/ProgressBarOutputStream.html +416 -0
  71. data/doc/Sprout/RDocParser.html +211 -0
  72. data/doc/Sprout/RemoteFileLoader.html +172 -0
  73. data/doc/Sprout/RemoteFileTarget.html +679 -0
  74. data/doc/Sprout/ReversedProgressBar.html +194 -0
  75. data/doc/Sprout/RubyFeature.html +155 -0
  76. data/doc/Sprout/RubyFeature/ClassMethods.html +1065 -0
  77. data/doc/Sprout/RubyGenerator.html +764 -0
  78. data/doc/Sprout/Specification.html +767 -0
  79. data/doc/Sprout/System.html +191 -0
  80. data/doc/Sprout/System/BaseSystem.html +1455 -0
  81. data/doc/Sprout/System/JavaSystem.html +122 -0
  82. data/doc/Sprout/System/OSXSystem.html +335 -0
  83. data/doc/Sprout/System/ThreadMock.html +193 -0
  84. data/doc/Sprout/System/UnixSystem.html +584 -0
  85. data/doc/Sprout/System/VistaSystem.html +251 -0
  86. data/doc/Sprout/System/WinNixSystem.html +325 -0
  87. data/doc/Sprout/System/WinSystem.html +571 -0
  88. data/doc/Sprout/ToolGenerator.html +931 -0
  89. data/doc/Sprout/VERSION.html +128 -0
  90. data/doc/SproutTestCase.html +1412 -0
  91. data/doc/String.html +286 -0
  92. data/doc/_index.html +1035 -0
  93. data/doc/class_list.html +36 -0
  94. data/doc/css/common.css +1 -0
  95. data/doc/css/full_list.css +53 -0
  96. data/doc/css/style.css +310 -0
  97. data/doc/file.README.html +96 -0
  98. data/doc/file.archive_unpacker.html +288 -0
  99. data/doc/file.base.html +208 -0
  100. data/doc/file.base_system.html +278 -0
  101. data/doc/file.boolean.html +135 -0
  102. data/doc/file.collection_param.html +139 -0
  103. data/doc/file.command.html +126 -0
  104. data/doc/file.concern.html +136 -0
  105. data/doc/file.daemon.html +309 -0
  106. data/doc/file.dir.html +76 -0
  107. data/doc/file.directory_manifest.html +122 -0
  108. data/doc/file.errors.html +147 -0
  109. data/doc/file.executable.html +638 -0
  110. data/doc/file.file_manifest.html +109 -0
  111. data/doc/file.file_param.html +120 -0
  112. data/doc/file.file_target.html +140 -0
  113. data/doc/file.files.html +85 -0
  114. data/doc/file.generator.html +296 -0
  115. data/doc/file.generator_class.html +72 -0
  116. data/doc/file.generator_generator.html +137 -0
  117. data/doc/file.generator_test.html +92 -0
  118. data/doc/file.generator_test_helper.html +67 -0
  119. data/doc/file.java_system.html +62 -0
  120. data/doc/file.library.html +291 -0
  121. data/doc/file.library_generator.html +74 -0
  122. data/doc/file.log.html +100 -0
  123. data/doc/file.manifest.html +67 -0
  124. data/doc/file.mxmlc.html +740 -0
  125. data/doc/file.number.html +67 -0
  126. data/doc/file.osx_system.html +79 -0
  127. data/doc/file.param.html +491 -0
  128. data/doc/file.parameter_factory.html +119 -0
  129. data/doc/file.path.html +81 -0
  130. data/doc/file.paths.html +80 -0
  131. data/doc/file.platform.html +124 -0
  132. data/doc/file.process_runner.html +224 -0
  133. data/doc/file.progress_bar.html +390 -0
  134. data/doc/file.rdoc_parser.html +145 -0
  135. data/doc/file.remote_file_loader.html +117 -0
  136. data/doc/file.remote_file_target.html +176 -0
  137. data/doc/file.ruby_base.html +64 -0
  138. data/doc/file.ruby_feature.html +244 -0
  139. data/doc/file.ruby_generator.html +118 -0
  140. data/doc/file.ruby_input.html +62 -0
  141. data/doc/file.ruby_test_case.html +78 -0
  142. data/doc/file.ruby_test_helper.html +61 -0
  143. data/doc/file.specification.html +248 -0
  144. data/doc/file.sprout.html +64 -0
  145. data/doc/file.sprout_test_case.html +280 -0
  146. data/doc/file.string.html +72 -0
  147. data/doc/file.string_param.html +76 -0
  148. data/doc/file.strings.html +71 -0
  149. data/doc/file.system.html +86 -0
  150. data/doc/file.template_manifest.html +67 -0
  151. data/doc/file.tool.html +92 -0
  152. data/doc/file.tool_generator.html +90 -0
  153. data/doc/file.unix_system.html +128 -0
  154. data/doc/file.url.html +71 -0
  155. data/doc/file.urls.html +70 -0
  156. data/doc/file.version.html +71 -0
  157. data/doc/file.vista_system.html +69 -0
  158. data/doc/file.win_nix_system.html +88 -0
  159. data/doc/file.win_system.html +129 -0
  160. data/doc/file_list.html +230 -0
  161. data/doc/frames.html +13 -0
  162. data/doc/index.html +96 -0
  163. data/doc/js/app.js +202 -0
  164. data/doc/js/full_list.js +149 -0
  165. data/doc/js/jquery.js +154 -0
  166. data/doc/method_list.html +3355 -0
  167. data/doc/top-level-namespace.html +192 -0
  168. data/lib/sprout/archive_unpacker.rb +203 -137
  169. data/lib/sprout/base.rb +38 -11
  170. data/lib/sprout/concern.rb +51 -0
  171. data/lib/sprout/daemon.rb +256 -0
  172. data/lib/sprout/executable.rb +40 -11
  173. data/lib/sprout/executable/boolean.rb +47 -1
  174. data/lib/sprout/executable/collection_param.rb +33 -1
  175. data/lib/sprout/executable/file_param.rb +16 -3
  176. data/lib/sprout/executable/files.rb +5 -0
  177. data/lib/sprout/executable/number.rb +5 -1
  178. data/lib/sprout/executable/param.rb +232 -16
  179. data/lib/sprout/executable/parameter_factory.rb +39 -1
  180. data/lib/sprout/executable/path.rb +7 -1
  181. data/lib/sprout/executable/paths.rb +6 -1
  182. data/lib/sprout/executable/string_param.rb +8 -1
  183. data/lib/sprout/executable/strings.rb +7 -1
  184. data/lib/sprout/executable/url.rb +8 -1
  185. data/lib/sprout/executable/urls.rb +7 -1
  186. data/lib/sprout/file_target.rb +11 -11
  187. data/lib/sprout/generator.rb +244 -0
  188. data/lib/sprout/generator/base.rb +0 -94
  189. data/lib/sprout/generators/generator/generator_generator.rb +35 -1
  190. data/lib/sprout/generators/generator/templates/generator_class.rb +3 -3
  191. data/lib/sprout/library.rb +75 -0
  192. data/lib/sprout/log.rb +11 -12
  193. data/lib/sprout/process_runner.rb +29 -9
  194. data/lib/sprout/remote_file_target.rb +20 -9
  195. data/lib/sprout/system/base_system.rb +11 -3
  196. data/lib/sprout/test/sprout_test_case.rb +1 -0
  197. data/lib/sprout/version.rb +7 -11
  198. data/rakefile.rb +7 -12
  199. data/script/add_param_handler.rb +43 -0
  200. data/sprout.gemspec +2 -3
  201. data/test/fixtures/executable/fdb.rb +764 -0
  202. data/test/fixtures/executable/flex3sdk_gem/fdb +60 -0
  203. data/test/fixtures/executable/mxmlc.rb +9 -11
  204. data/test/unit/daemon_test.rb +61 -0
  205. data/test/unit/process_runner_test.rb +21 -0
  206. data/test/unit/remote_file_target_test.rb +45 -11
  207. data/test/unit/sprout_test_helper.rb +1 -1
  208. metadata +210 -29
@@ -2,14 +2,48 @@
2
2
  module Sprout
3
3
  class GeneratorGenerator < Generator::Base
4
4
 
5
+ ##
6
+ # The default module that classes will be added
7
+ # to.
5
8
  add_param :namespace, String, { :default => ''}
9
+
10
+ ##
11
+ # The name of the folder where external libraries
12
+ # will be installed.
6
13
  add_param :lib, String, { :default => 'lib' }
14
+
15
+ ##
16
+ # The name of the folder where custom generators and templates
17
+ # will be found.
7
18
  add_param :generators, String, { :default => 'generators' }
19
+
20
+ ##
21
+ # The name of the folder where tests should be generated.
8
22
  add_param :test, String, { :default => 'test' }
23
+
24
+ ##
25
+ # The name of the child folder of the test folder where
26
+ # unit tests should be generated.
9
27
  add_param :unit, String, { :default => 'unit' }
28
+
29
+ ##
30
+ # The name of the child folder of the test folder where
31
+ # fixtures should be generated.
10
32
  add_param :fixtures, String, { :default => 'fixtures' }
11
- add_param :vendor, String, { :default => 'vendor' }
33
+
34
+ ##
35
+ # The name of the folder where external source code
36
+ # should be placed.
37
+ add_param :vendor, String, { :default => 'vendor' }
38
+
39
+ ##
40
+ # The name of the folder where binary or executable
41
+ # artifacts should be created by compiler tasks.
12
42
  add_param :bin, String, { :default => 'bin' }
43
+
44
+ ##
45
+ # The default (primary) file extension for generated source
46
+ # files. This should hint at the project type.
13
47
  add_param :extension, String, { :default => '.as' }
14
48
 
15
49
  def manifest
@@ -4,13 +4,13 @@ module Sprout
4
4
 
5
5
  ##
6
6
  # This is how you add a parameter to your generator
7
- # add_param :fwee, String, { :default => "fwee" }
8
-
7
+ #
8
+ # add_param :fwee, String, :default => "fwee"
9
+ #
9
10
  def manifest
10
11
  directory input.snake_case do
11
12
  template "#{input.camel_case}<%= extension %>"
12
13
  end
13
-
14
14
  end
15
15
 
16
16
  end
@@ -1,5 +1,80 @@
1
1
 
2
2
  module Sprout
3
+
4
+ ##
5
+ # Sprout Libraries provide support for sharing and versioning raw or
6
+ # pre-compiled source code across projects.
7
+ #
8
+ # Sprout Libraries give us the ability to include raw (or pre-compiled) source
9
+ # code directly within a Ruby Gem, or to refer to an archive somewhere on
10
+ # the internet.
11
+ #
12
+ # A Sprout Library is made up of two components:
13
+ #
14
+ # * Specification: The description of the library
15
+ # * Source Code: Raw or pre-compiled (swc, jar, abc)
16
+ #
17
+ # = Specification
18
+ # Libraries can be added to local or remote file targets in a
19
+ # Sprout::Specification. When calling add_library, one must provide the
20
+ # library name (symbol that will be used from Rake) and a relative path (or
21
+ # Array of paths) from the Specification to the library file or directory.
22
+ #
23
+ # Following is an example of a Sprout::Specification that registers a SWC
24
+ # that will be distributed directly within a Ruby Gem:
25
+ #
26
+ # Sprout::Specification.new do |s|
27
+ # s.name = "asunit4"
28
+ # s.version = "4.4.2"
29
+ # s.add_file_target do |f|
30
+ # f.add_library :swc, File.join('bin', "AsUnit-4.4.2.swc")
31
+ # end
32
+ # end
33
+ #
34
+ # Following is an example of a Sprout::Specification that registers a ZIP
35
+ # archive that will be distributed separately from the Ruby Gem:
36
+ #
37
+ # Sprout::Specification.new do |s|
38
+ # s.name = "asunit3"
39
+ # s.version = "3.0.0"
40
+ # s.add_remote_file_target do |f|
41
+ # f.url = "https://github.com/patternpark/asunit/tree/3.0.0"
42
+ # f.md5 = "abcdefghijklmnopqrstuvwxyz"
43
+ # f.add_library :swc, "bin/AsUnit-3.0.1.zip"
44
+ # end
45
+ # end
46
+ #
47
+ # Libraries can be consumed from any Rakefile without concern for how
48
+ # the source code is distributed. Following is an example Rake task
49
+ # that uses the AsUnit 4.0 Library:
50
+ #
51
+ # # Define the library Rake::Task:
52
+ # library :asunit4
53
+ #
54
+ # # Add the library as a dependency from another task
55
+ # # that should know how to properly associate the files:
56
+ # mxmlc 'bin/SomeProject.swf' => :asunit4 do |t|
57
+ # t.input = 'src/SomeProject.as'
58
+ # end
59
+ #
60
+ # When the library task is executed, the library should be resolved and
61
+ # expanded into the project. When the mxmlc task is executed, the installed
62
+ # library should be associated with the compilation command.
63
+ #
64
+ # ---
65
+ #
66
+ # Previous Topic: {Sprout::Generator}
67
+ #
68
+ # Next Topic: {Sprout::Executable}
69
+ #
70
+ # ---
71
+ #
72
+ # @see Sprout::Generator
73
+ # @see Sprout::Executable
74
+ # @see Sprout::Specification
75
+ # @see Sprout::RubyFeature
76
+ # @see Sprout::System
77
+ #
3
78
  class Library
4
79
  include RubyFeature
5
80
 
data/lib/sprout/log.rb CHANGED
@@ -1,44 +1,43 @@
1
1
 
2
- module Sprout #:nodoc:
3
-
4
- class Log #:nodoc:
2
+ module Sprout
3
+ class Log
5
4
  @@debug = false
6
5
  @@output = ''
7
6
  @@printout = ''
8
-
7
+
9
8
  def Log.debug=(debug)
10
9
  @@debug = debug
11
10
  end
12
-
11
+
13
12
  def Log.debug
14
13
  return @@debug
15
14
  end
16
-
15
+
17
16
  def Log.puts(msg)
18
17
  @@output << msg + "\n"
19
18
  Log.flush
20
19
  end
21
-
20
+
22
21
  def Log.print(msg)
23
22
  @@printout << msg
24
23
  Log.flush_print
25
24
  end
26
-
25
+
27
26
  def Log.printf(msg)
28
27
  @@printout << msg
29
28
  Log.flush_print
30
29
  end
31
-
30
+
32
31
  def Log.flush_print
33
32
  if(!Log.debug)
34
- $stdout.print @@printout
33
+ $stdout.printf @@printout
35
34
  @@printout = ''
36
35
  end
37
36
  end
38
-
37
+
39
38
  def Log.flush
40
39
  if(!Log.debug)
41
- $stdout.puts @@output
40
+ $stdout.printf @@output
42
41
  @@output = ''
43
42
  end
44
43
  end
@@ -11,10 +11,26 @@ module Sprout #:nodoc:
11
11
  # continuing beligerence of Windows or *nix (depending on
12
12
  # which side of the fence you're on).
13
13
  class ProcessRunner
14
- attr_reader :pid,
15
- :r,
16
- :w,
17
- :e
14
+
15
+ attr_reader :pid
16
+ attr_reader :ruby_version
17
+
18
+ ##
19
+ # Read IO (readable)
20
+ attr_reader :r
21
+
22
+ ##
23
+ # Write IO (writeable)
24
+ attr_reader :w
25
+
26
+ ##
27
+ # Error IO (readable)
28
+ attr_reader :e
29
+
30
+ def initialize
31
+ super
32
+ @ruby_version = RUBY_VERSION
33
+ end
18
34
 
19
35
  # Execute the provided command using the open4.popen4
20
36
  # library. This is generally only used by Cygwin and
@@ -103,18 +119,22 @@ module Sprout #:nodoc:
103
119
  end
104
120
 
105
121
  def io_popen_block *command
106
- if(RUBY_VERSION == '1.8.6' || RUBY_VERSION == '1.8.7')
122
+ if(ruby_version == '1.8.6' || ruby_version == '1.8.7')
107
123
  win32_open3_block *command
108
124
  else
109
- require 'open3'
110
- write, read, error, wait_thread = Open3.popen3(*command)
111
- [wait_thread[:pid], write, read, error]
125
+ open3_popen3_block *command
112
126
  end
113
127
  end
114
128
 
129
+ def open3_popen3_block *command
130
+ require 'open3'
131
+ write, read, error, wait_thread = Open3.popen3(*command)
132
+ [wait_thread[:pid], write, read, error]
133
+ end
134
+
115
135
  def win32_open3_block *command
116
136
  write, read, error, pid = nil
117
- gem 'win32-open3', '0.2.5'
137
+ gem 'win32-open3'
118
138
  require 'win32/open3'
119
139
  Open3.popen3(*command) do |w, r, e, p|
120
140
  pid = p
@@ -21,14 +21,6 @@ module Sprout
21
21
  self
22
22
  end
23
23
 
24
- protected
25
-
26
- def expand_local_path path
27
- File.join unpacked_file, path
28
- end
29
-
30
- private
31
-
32
24
  ##
33
25
  # Do not cache this value...
34
26
  #
@@ -40,9 +32,27 @@ module Sprout
40
32
  end
41
33
 
42
34
  def unpacked_file
43
- @unpacked_file ||= File.join(Sprout.cache, pkg_name, pkg_version)
35
+ upcased_pkg = pkg_name.upcase
36
+ upcased_version = pkg_version.upcase.gsub /\./, '_'
37
+ ENV["SPROUT_#{upcased_pkg}_#{upcased_version}"] ||
38
+ ENV["SPROUT_#{upcased_pkg}"] ||
39
+ ENV["#{upcased_pkg}_#{upcased_version}"] ||
40
+ ENV[upcased_pkg] ||
41
+ File.join(Sprout.cache, pkg_name, pkg_version)
42
+ end
43
+
44
+ protected
45
+
46
+ def logger
47
+ Sprout::Log
44
48
  end
45
49
 
50
+ def expand_local_path path
51
+ File.join unpacked_file, path
52
+ end
53
+
54
+ private
55
+
46
56
  def load_unpack_or_ignore_archive
47
57
  if(!unpacked_files_exist?)
48
58
  if(!File.exists?(downloaded_file))
@@ -101,6 +111,7 @@ module Sprout
101
111
  end
102
112
 
103
113
  def unpack_archive
114
+ logger.puts "Unpacking archive at #{downloaded_file} now. This can take anywhere from a few seconds to many minutes depending on your OS and the size of the archive.\n\nIf you're on windows, consider using this ample time to look into improving the zip utils in Ruby..."
104
115
  FileUtils.mkdir_p unpacked_file
105
116
  unpacker = Sprout::ArchiveUnpacker.new
106
117
  unpacker.unpack downloaded_file, unpacked_file, archive_type
@@ -91,16 +91,24 @@ module Sprout::System
91
91
  # long-lived CLI processes like FCSH or FDB.
92
92
  #
93
93
  def execute_silent(tool, options='')
94
- return get_and_execute_process_runner(tool, options)
94
+ get_and_execute_process_runner(tool, options)
95
95
  end
96
96
 
97
97
  ##
98
98
  # Execute a new process in a separate thread.
99
99
  #
100
100
  def execute_thread(tool, options='')
101
- return Thread.new do
102
- execute(tool, options)
101
+ runner = nil
102
+ Thread.new do
103
+ runner = execute_silent(tool, options)
103
104
  end
105
+ # Wait for the runner to be created
106
+ # before returning a nil reference
107
+ # that never gets populated...
108
+ while runner.nil? do
109
+ sleep(0.1)
110
+ end
111
+ runner
104
112
  end
105
113
 
106
114
  ##
@@ -57,6 +57,7 @@ module SproutTestCase # :nodoc:[all]
57
57
  end
58
58
 
59
59
  def clear_tasks
60
+ CLEAN.delete_if {|a| true }
60
61
  Rake::Task.clear
61
62
  Rake.application.clear
62
63
  end
@@ -1,17 +1,13 @@
1
1
 
2
2
  module Sprout
3
3
  NAME = 'sprout'
4
-
5
- if(!defined? Sprout::VERSION)
6
- module VERSION #:nodoc:
7
- MAJOR = 1
8
- MINOR = 0
9
- TINY = 32
10
- RELEASE = 'pre'
11
-
12
- STRING = [MAJOR, MINOR, TINY, RELEASE].join('.')
13
- MAJOR_MINOR = [MAJOR, MINOR].join('.')
14
- end
4
+ module VERSION #:nodoc:
5
+ STRING = File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION').strip)
6
+ MAJOR = STRING.split('.')[0]
7
+ MINOR = STRING.split('.')[1]
8
+ TINY = STRING.split('.')[2]
9
+ RELEASE = STRING.split('.')[3]
10
+ MAJOR_MINOR = [MAJOR, MINOR].join('.')
15
11
  end
16
12
  end
17
13
 
data/rakefile.rb CHANGED
@@ -3,25 +3,20 @@ require 'bundler'
3
3
 
4
4
  # Hack this dir onto path for Ruby 1.9.2
5
5
  # support:
6
- test_package = File.join(File.dirname(__FILE__), 'test')
6
+ test_package = File.expand_path(File.join(File.dirname(__FILE__), 'test'))
7
7
  $: << test_package unless $:.include? test_package
8
8
 
9
9
  Bundler.require
10
10
 
11
11
  require 'rake/clean'
12
12
  require 'rake/testtask'
13
- require 'rake/rdoctask'
14
13
 
15
- require File.dirname(__FILE__) + '/lib/sprout/version'
16
-
17
- Rake::RDocTask.new do |rdoc|
18
- rdoc.title = "Project Sprouts v.#{Sprout::VERSION::STRING}"
19
- rdoc.rdoc_dir = 'rdoc'
20
- rdoc.main = "Sprout::Sprout"
21
- rdoc.rdoc_files.include("README.textile", "lib/**/*.rb")
22
- end
23
-
24
- CLEAN.add('rdoc')
14
+ ##
15
+ # NOTE, to generate documentation, simply run:
16
+ #
17
+ # bundle install
18
+ # yard
19
+ #
25
20
 
26
21
  namespace :test do
27
22
  Rake::TestTask.new(:units) do |t|
@@ -0,0 +1,43 @@
1
+
2
+ class AddParamHandler < YARD::Handlers::Ruby::MethodHandler
3
+
4
+ handles method_call(:add_param)
5
+
6
+ def process
7
+ name = statement[1][0].source.gsub(/^:/, '')
8
+ class_name = statement[1][1].source
9
+
10
+ case class_name
11
+ when "Strings"
12
+ class_name = "Array<String>"
13
+ when "Files"
14
+ class_name = "Array<String> [Files]"
15
+ when "Paths"
16
+ class_name = "Array<String> [Paths]"
17
+ when "Urls"
18
+ class_name = "Array<String> [Urls]"
19
+ end
20
+
21
+ namespace.attributes[scope][name] ||= SymbolHash[:read => nil, :write => nil]
22
+
23
+ {:read => name, :write => "#{name}="}.each do |type, meth|
24
+ namespace.attributes[scope][name][type] = MethodObject.new(namespace, meth, scope) do |o|
25
+
26
+ o.source = statement.source
27
+ o.signature = method_signature(meth)
28
+ o.docstring = statement.comments
29
+
30
+ if type == :write
31
+ o.parameters = [['value', nil]]
32
+ else
33
+ new_tag = YARD::Tags::Tag.new(:return, "An instance of #{class_name}", class_name)
34
+ o.docstring.add_tag(new_tag)
35
+ end
36
+
37
+ o.visibility = visibility
38
+ end
39
+ end
40
+ end
41
+
42
+ end
43
+