reap 4.3.1 → 4.3.2

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/ChangeLog CHANGED
@@ -1,25 +1 @@
1
-
2
1
  = Reap ChangeLog
3
-
4
- == 04
5
-
6
- * Killed the Rake idea. Now a fully independent project,
7
- and better than before.
8
-
9
- == 03
10
-
11
- * Major overhaul. Reap is no longer an independent project.
12
- Rather, it is now an extension of Rake. All Reap tasks are
13
- now a subclass of Rake::TaskLib.
14
-
15
- == 02
16
-
17
- * Improved test task. Each test now runs in its own process.
18
- Output is summarized and in YAML.
19
- * Improved configuration loading a bit.
20
- * Wrote some basic docs on how to write a Reap task.
21
- * Adjusted for Nano upgrade (was Facets).
22
-
23
- == 01
24
-
25
- * Alpha Development
data/ProjectInfo CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  TITLE : Reap
4
4
  NAME : reap
5
- VERSION : '4.3.1'
5
+ VERSION : '4.3.2'
6
6
  DATE : '2006-02-01'
7
7
  STATUS : 'beta/stable'
8
8
 
data/bin/reap CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'reap/bin/reap'
3
+ require 'reap/bin/reap.rb'
4
4
 
5
5
  ReapCommand.new.go
data/bin/rubytest ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'reap/bin/rubytest.rb'
4
+
5
+ RubyCommentTester.new.go
data/lib/reap/bin/reap.rb CHANGED
@@ -1,8 +1,9 @@
1
1
 
2
2
  # Support libraries
3
3
  require 'rbconfig'
4
+
4
5
  require 'facets'
5
- require 'calibre/consoleapp'
6
+ require 'facet/consoleapp'
6
7
 
7
8
  # Reap support
8
9
  require 'reap/projectinfo'
@@ -72,23 +73,40 @@ class ReapCommand < Console::Application
72
73
  # Commands
73
74
 
74
75
  # default action
76
+
75
77
  def default
76
78
  tasks
77
79
  end
78
80
 
79
81
  # display version
82
+
80
83
  def version
81
84
  puts "Reap v.#{Reap::Version}"
82
85
  exit 0
83
86
  end
84
87
 
85
88
  # display help
86
- def help
87
- puts HELP
89
+
90
+ def help(*args)
91
+ unless args.empty?
92
+ t = Reap.tasks[args[0]]
93
+ s = "\n"
94
+ s << "#{args[0]}: "
95
+ s << t.task_desc.sub(/^\n+/, '').rstrip
96
+ s << "\n\n"
97
+ if thelp = t.task_help
98
+ s << thelp.sub(/^\n+/, '').rstrip
99
+ end
100
+ s << "\n\n"
101
+ puts s
102
+ else
103
+ puts HELP
104
+ end
88
105
  exit 0
89
106
  end
90
107
 
91
108
  # list available tasks
109
+
92
110
  def tasks
93
111
  #Reap.initialize #_all
94
112
  puts
@@ -101,6 +119,7 @@ class ReapCommand < Console::Application
101
119
  alias_method :ls, :tasks
102
120
 
103
121
  # copy the file from lib/data to the current dir.
122
+
104
123
  def template
105
124
  if INFO_FILES.any?{ |f| File.exists?(f) }
106
125
  puts "Project file already exists."
@@ -0,0 +1,45 @@
1
+
2
+ require 'test/unit'
3
+ require 'facet/consoleapp'
4
+
5
+ class RubyCommentTester < Console::Application
6
+
7
+ RETEST = /^=begin\s+test.*?\n(.*)\n=end/mi
8
+
9
+ # option to display help
10
+ def __verbose ; $VERBOSE = true ; end
11
+ alias_method :_v, :__verbose
12
+
13
+ # option to display help
14
+ def __help
15
+ puts HELP
16
+ exit 0
17
+ end
18
+ alias_method :_h, :__help
19
+
20
+ def main( *filepaths )
21
+ filepaths.each { |fp|
22
+ run_comment_test( fp )
23
+ }
24
+ end
25
+
26
+ private
27
+
28
+ def run_comment_test( filepath )
29
+ code = File.read( filepath )
30
+ md = RETEST.match( code )
31
+ test_code = md[1]
32
+ unless test_code
33
+ puts "No test found for #{filepath}."
34
+ return nil
35
+ end
36
+
37
+ require filepath
38
+ eval test_code, TOPLEVEL_BINDING
39
+ end
40
+
41
+ end
42
+
43
+ HELP = <<-EOS
44
+ rubytest filename [filename ...]
45
+ EOS
@@ -19,14 +19,16 @@ class ProjectInfo
19
19
  # @self[name]
20
20
  #end
21
21
 
22
- attr_reader :info, :info_stream
22
+ attr_reader :info, :info_stream, :info_dir
23
23
 
24
24
  def initialize( info_file=nil )
25
25
  unless info_file
26
26
  Dir.ascend(Dir.pwd) do |d|
27
27
  Dir.chdir(d)
28
28
  info_file = INFO_FILES.find{ |f| File.file?( f ) }
29
- break if info_file
29
+ if info_file
30
+ @info_dir = d; break
31
+ end
30
32
  end
31
33
  end
32
34
  if info_file
@@ -34,9 +36,11 @@ class ProjectInfo
34
36
  @info = YAML::load( @info_stream ).traverse{ |k,v| [k.downcase, v] }
35
37
  puts "(in #{Dir.pwd})" #unless dir == Dir.pwd
36
38
  else
37
- @info_stream = ""
38
- @info = {}
39
- puts "(without a project information file)"
39
+ puts "Aborted. No project information file found."
40
+ exit 1
41
+ #@info_stream = ""
42
+ #@info = {}
43
+ #puts "(without a project information file)"
40
44
  end
41
45
  end
42
46