reap 9.2.1 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/CHANGES +4 -0
  2. data/COPYING +675 -674
  3. data/MANIFEST +37 -44
  4. data/NOTES +4 -4
  5. data/Rakefile +1486 -0
  6. data/data/reap/base/COPYING +674 -674
  7. data/data/reap/base/README +23 -2
  8. data/data/reap/base/Rakefile +1486 -0
  9. data/data/reap/base/test/template.rb +16 -0
  10. data/data/reap/init/meta/project.yaml +19 -14
  11. data/lib/reap/default.yaml +57 -45
  12. data/lib/reap/extensions/file.rb +8 -0
  13. data/lib/reap/extensions/net/smtp_tls.rb +108 -0
  14. data/lib/reap/extensions.rb +2 -0
  15. data/lib/reap/metadata.rb +3 -2
  16. data/lib/reap/{manager → project}/announce.rb +3 -3
  17. data/lib/reap/{manager → project}/check.rb +1 -1
  18. data/lib/reap/{manager → project}/clean.rb +1 -1
  19. data/lib/reap/{manager → project}/gem.rb +5 -5
  20. data/lib/reap/{manager → project}/html.rb +25 -24
  21. data/lib/reap/{manager → project}/log.rb +19 -9
  22. data/lib/reap/{manager → project}/make.rb +29 -36
  23. data/lib/reap/{manager → project}/package.rb +4 -8
  24. data/lib/reap/{manager → project}/publish.rb +3 -3
  25. data/lib/reap/{manager → project}/rdoc.rb +13 -30
  26. data/lib/reap/{manager → project}/release.rb +5 -5
  27. data/lib/reap/{manager → project}/rubyforge.rb +7 -6
  28. data/lib/reap/{manager → project}/scaffold.rb +7 -2
  29. data/lib/reap/{manager → project}/scm.rb +3 -3
  30. data/lib/reap/{manager → project}/site.rb +1 -1
  31. data/lib/reap/{manager → project}/spec.rb +1 -1
  32. data/lib/reap/{manager → project}/stamp.rb +14 -11
  33. data/lib/reap/{manager → project}/stats.rb +1 -1
  34. data/lib/reap/{manager → project}/svn.rb +1 -1
  35. data/lib/reap/{manager → project}/test.rb +2 -20
  36. data/lib/reap/project.rb +34 -2
  37. data/lib/reap/systems/rubyforge.rb +5 -12
  38. data/lib/reap/systems/subversion.rb +4 -6
  39. data/lib/reap/{utilities/fileutils.rb → utilities.rb} +148 -60
  40. data/log/Changelog.txt +118 -0
  41. data/log/Fixme.txt +26 -0
  42. data/log/Todo.txt +94 -0
  43. data/meta/VERSION +1 -1
  44. data/meta/project.yaml +1 -1
  45. data/meta/unixname +1 -0
  46. data/test/unit/lib/reap/extensions/test_array.rb +12 -0
  47. metadata +44 -46
  48. data/data/reap/build/rake/Rakefile +0 -130
  49. data/data/reap/build/rake/setup.rb +0 -1616
  50. data/data/reap/build/rake-lite/install.rb +0 -79
  51. data/data/reap/build/tasks/task/rdoc +0 -211
  52. data/data/reap/build/tasks/task/setup +0 -1616
  53. data/data/reap/build/tasks/task/test +0 -38
  54. data/lib/reap/manager.rb +0 -75
  55. data/lib/reap/utilities/netutils.rb +0 -221
  56. data/lib/reap/utilities/setuputils.rb +0 -124
  57. data/lib/reap/utilities/shellutils.rb +0 -175
  58. data/log/FIXME.txt +0 -25
  59. data/log/TODO.txt +0 -72
  60. data/task/man +0 -14
  61. data/task/rdoc +0 -20
  62. data/task/setup +0 -1616
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Run unit tests
4
-
5
- def test
6
- live = ARGV.include?('--live')
7
-
8
- unless live
9
- $LOAD_PATH.unshift(File.expand_path('lib/core'))
10
- $LOAD_PATH.unshift(File.expand_path('lib/more'))
11
- end
12
-
13
- puts "Ruby Version: #{RUBY_VERSION}"
14
-
15
- if find = ARGV.select{|e| e !~ /^[-]/ }[0]
16
- unless file?(find)
17
- find = File.join(find, '**', 'test_*.rb')
18
- end
19
- else
20
- find = 'test/**/test_*.rb'
21
- end
22
-
23
- files = Dir.glob(find)
24
- files.each do |file|
25
- next if File.directory?(file)
26
- begin
27
- puts "Loading: #{file}" if $DEBUG
28
- load(file)
29
- rescue LoadError
30
- puts "Error loading: #{file}"
31
- end
32
- end
33
- end
34
-
35
- # Go!
36
- if $0 == __FILE__
37
- test
38
- end
data/lib/reap/manager.rb DELETED
@@ -1,75 +0,0 @@
1
- require 'yaml'
2
- require 'rbconfig' # replace with facets/system?
3
-
4
- require 'reap/extensions'
5
- require 'reap/utilities/fileutils'
6
- require 'reap/utilities/shellutils'
7
- require 'reap/utilities/netutils'
8
-
9
- module Reap
10
-
11
- class Manager
12
- # Default constant is used my various tools
13
- # to soter the defualts for options. By using this
14
- # it easy to dump a complete list of built-in
15
- # defaults. Defaults should be patterned after the
16
- # configuration file agsint which they will be used.
17
-
18
- DEFAULT = {}
19
-
20
- include Utilities::ShellUtils
21
- include Utilities::FileUtils
22
- include Utilities::NetUtils
23
- end
24
-
25
- #class Project < Manager; end
26
-
27
- end
28
-
29
- # Load up all the tools
30
- require "reap/manager/announce.rb"
31
- require "reap/manager/check.rb"
32
- require "reap/manager/clean.rb"
33
- require "reap/manager/gem.rb"
34
- require "reap/manager/html.rb"
35
- require "reap/manager/log.rb"
36
- require "reap/manager/make.rb"
37
- require "reap/manager/package.rb"
38
- require "reap/manager/publish.rb"
39
- require "reap/manager/rdoc.rb"
40
- require "reap/manager/release.rb"
41
- require "reap/manager/scaffold.rb"
42
- require "reap/manager/site.rb"
43
- require "reap/manager/spec.rb"
44
- require "reap/manager/stats.rb"
45
- require "reap/manager/stamp.rb"
46
- require "reap/manager/scm.rb"
47
- require "reap/manager/svn.rb"
48
- require "reap/manager/test.rb"
49
-
50
-
51
- #def html
52
- # config = configuration['rd2html']
53
- # webmaker = RD2Html.new(config)
54
- # webmaker.rd2html
55
- #end
56
-
57
- # Update release "stamp" (.roll) file.
58
-
59
- #def stamp
60
- # # You can change these via the command line.
61
- # version = commandline['version'] || release.version
62
- # status = commandline['status'] || release.status
63
- #
64
- # if version != release.version or status != release.status
65
- # Stamp.new(
66
- # :version => version,
67
- # :status => status,
68
- # :file => release.file,
69
- # :name => release.name,
70
- # :default => release.default,
71
- # :libpath => release.libpath
72
- # ).stamp
73
- # end
74
- #end
75
-
@@ -1,221 +0,0 @@
1
- # = TITLE:
2
- #
3
- # Networking Utility Functions
4
- #
5
- # = COPYING:
6
- #
7
- # Copyright (c) 2007,2008 Tiger Ops
8
- #
9
- # This file is part of the Reap program.
10
- #
11
- # Reap is free software: you can redistribute it and/or modify
12
- # it under the terms of the GNU General Public License as published by
13
- # the Free Software Foundation, either version 3 of the License, or
14
- # (at your option) any later version.
15
- #
16
- # Reap is distributed in the hope that it will be useful,
17
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- # GNU General Public License for more details.
20
- #
21
- # You should have received a copy of the GNU General Public License
22
- # along with Reap. If not, see <http://www.gnu.org/licenses/>.
23
-
24
- require 'net/smtp'
25
- require 'timeout'
26
- begin
27
- require 'openssl'
28
- rescue LoadError
29
- end
30
-
31
- #
32
- module Reap
33
- module Utilities
34
-
35
- module NetUtils
36
-
37
- # Email function to easily send out an email.
38
- #
39
- # Settings:
40
- #
41
- # subject Subject of email message.
42
- # from Message FROM address [email].
43
- # to Email address to send announcemnt.
44
- # server Email server to route message.
45
- # port Email server's port.
46
- # port_secure Email server's port.
47
- # domain Email server's domain name.
48
- # account Email account name if needed.
49
- # password Password for login..
50
- # login Login type: plain, cram_md5 or login [plain].
51
- # secure Uses TLS security, true or false? [false]
52
- # message Mesage to send -or-
53
- # file File that contains message.
54
-
55
- def email(message, settings)
56
- settings ||= {}
57
- settings.rekey
58
-
59
- server = settings[:server]
60
- account = settings[:account] || ENV['EMAIL_ACCOUNT']
61
- passwd = settings[:password] || ENV['EMAIL_PASSWORD']
62
- login = settings[:login]
63
- subject = settings[:subject]
64
- mail_to = settings[:to] || settings[:mail_to]
65
- mail_from = settings[:from] || settings[:mail_from]
66
- secure = settings[:secure]
67
- domain = settings[:domain] || server
68
-
69
- port = (settings[:port_secure] || 465) if secure
70
- port = (settings[:port] || 25) unless secure
71
-
72
- account ||= mail_from
73
- login ||= :plain
74
-
75
- login = login.to_sym
76
-
77
- #mail_to = nil if mail_to.empty?
78
-
79
- raise ArgumentError, "missing email field -- server" unless server
80
- raise ArgumentError, "missing email field -- account" unless account
81
- raise ArgumentError, "missing email field -- subject" unless subject
82
- raise ArgumentError, "missing email field -- to" unless mail_to
83
- raise ArgumentError, "missing email field -- from" unless mail_from
84
-
85
- passwd ||= password("#{account} password:")
86
-
87
- mail_to = [mail_to].flatten.compact
88
-
89
- msg = ""
90
- msg << "From: #{mail_from}\n"
91
- msg << "To: #{mail_to.join(';')}\n"
92
- msg << "Subject: #{subject}\n"
93
- msg << ""
94
- msg << message
95
-
96
- if secure
97
- Net::SMTP.send(:include, Net::SMTP::TLS)
98
- Net::SMTP.enable_tls #if secure #if Net::SMTP.respond_to?(:enable_tls) and secure
99
- end
100
-
101
- begin
102
- Net::SMTP.start(server, port, domain, account, passwd, login) do |smtp|
103
- smtp.send_message(msg, mail_from, mail_to)
104
- end
105
- puts "Email sent successfully to #{mail_to.join(';')}."
106
- return true
107
- rescue => e
108
- if trace?
109
- raise e
110
- else
111
- abort "Email delivery failed."
112
- end
113
- end
114
- end
115
-
116
- end
117
-
118
- end
119
- end
120
-
121
-
122
- module Net #:nodoc: all
123
- class SMTP
124
- module TLS
125
-
126
- def self.included(base)
127
- base.extend(ClassMethods)
128
-
129
- @usetls = base.use_tls?
130
- end
131
-
132
- module ClassMethods
133
- def self.extended(base)
134
- base.disable_tls
135
- end
136
-
137
- def enable_tls()
138
- @@usetls = true
139
- end
140
-
141
- def disable_tls()
142
- @@usetls = false
143
- end
144
-
145
- def use_tls?()
146
- @@usetls
147
- end
148
- end
149
-
150
- def use_tls?()
151
- @usetls
152
- end
153
-
154
- def enable_tls()
155
- @usetls = true
156
- end
157
-
158
- def disable_tls()
159
- @usetls = false
160
- end
161
-
162
- def use_tls?()
163
- @usetls
164
- end
165
-
166
- private
167
- def do_start(helodomain, user, secret, authtype)
168
- raise IOError('SMTP session already started') if @started
169
- check_auth_args user, secret, authtype if user or secret
170
-
171
- sock = timeout(@open_timeout) {TCPSocket.open(@address, @port) }
172
- @socket = Net::InternetMessageIO.new(sock)
173
- @socket.read_timeout = @read_timeout
174
- @socket.debug_output = STDERR
175
-
176
- check_response(critical {recv_response() } )
177
- do_helo(helodomain)
178
-
179
- if @@usetls
180
- raise 'openssl is not installed' unless defined?(OpenSSL)
181
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
182
- starttls
183
- ssl.sync_close = true
184
- ssl.connect
185
-
186
- @socket = Net::InternetMessageIO.new(ssl)
187
- @socket.read_timeout = @read_timeout
188
- @socket.debug_output = STDERR
189
- do_helo(helodomain)
190
- end
191
-
192
- authenticate user, secret, authtype if user
193
- @started = true
194
- ensure
195
- @socket.close if not @started and @socket and not @socket.closed?
196
- end
197
-
198
- def do_helo(helodomain)
199
- begin
200
- if @esmtp
201
- ehlo helodomain
202
- else
203
- helo helodomain
204
- end
205
- rescue Net::ProtocolError
206
- if @esmtp
207
- @esmtp = false
208
- @error_occured = false
209
- retry
210
- end
211
- raise
212
- end
213
- end
214
-
215
- def starttls
216
- getok('STARTTLS')
217
- end
218
- end
219
-
220
- end
221
- end
@@ -1,124 +0,0 @@
1
- # = TITLE:
2
- #
3
- # Setup DSL
4
- #
5
- # = SYNOPSIS:
6
- #
7
- # Mixen used to setup a package, eg. a manual install.
8
- #
9
- # = COPYING:
10
- #
11
- # Copyright (c) 2007,2008 Tiger Ops
12
- #
13
- # This file is part of the Reap program.
14
- #
15
- # Reap is free software: you can redistribute it and/or modify
16
- # it under the terms of the GNU General Public License as published by
17
- # the Free Software Foundation, either version 3 of the License, or
18
- # (at your option) any later version.
19
- #
20
- # Reap is distributed in the hope that it will be useful,
21
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- # GNU General Public License for more details.
24
- #
25
- # You should have received a copy of the GNU General Public License
26
- # along with Reap. If not, see <http://www.gnu.org/licenses/>.
27
-
28
- #
29
- module Reap
30
- module Utilities
31
-
32
- # = Setup DSL
33
- #
34
- # Setup utilities provides a convenient way to install
35
- # a ruby project via setup.rb.
36
-
37
- module SetupUtils
38
-
39
- # Installation to a prefix destination using setup.rb.
40
- # Some package types may need this.
41
-
42
- def prefix_install(prefix)
43
- mkdir_p(prefix)
44
-
45
- unless setup_rb
46
- raise "Setup.rb is missing. Forced to abort."
47
- end
48
- # mock install
49
- cmd = ''
50
- cmd << 'ruby setup.rb '
51
- cmd << '-q ' unless project.verbose?
52
- cmd << 'config --installdirs=std ; '
53
- cmd << 'ruby setup.rb '
54
- cmd << '-q ' unless project.verbose?
55
- cmd << "install --prefix=#{prefix}"
56
- sh cmd
57
- end
58
-
59
- # If setup.rb is not found add a copy to the project.
60
- # FIXME
61
-
62
- def setup_rb
63
- unless File.exist?('setup.rb')
64
- f = File.join(libdir,'vendor','setup.rb')
65
- if File.exist?(f)
66
- cp(f,'.')
67
- else
68
- raise "setup.rb is not avaialble"
69
- end
70
- end
71
- true
72
- end
73
-
74
- # # Setup and install. This builds and installs a project
75
- # # using setup.rb or install.rb. If neither exist setup.rb
76
- # # will be created for the purpose.
77
- # #
78
- # # options Command line options to add to shell command.
79
- # # script Install script, default is install.rb or setup.rb
80
- # #--
81
- # # source Location of source. (Defaults to current directory)
82
- # #++
83
- #
84
- # def setup(keys={})
85
- #
86
- # options = keys['options']
87
- # script = keys['script']
88
- # #source = keys.source || Dir.pwd
89
- #
90
- # options = [options].flatten.compact
91
- #
92
- # if script
93
- # exe = script + ' '
94
- # exe << options.join(' ')
95
- # elsif File.exist?('install.rb')
96
- # exe = 'ruby install.rb '
97
- # exe << options.join(' ')
98
- # elsif File.exist?('setup.rb') or setup_rb
99
- # exe = 'ruby setup.rb '
100
- # exe << '-q ' unless verbose?
101
- # exe << options.join(' ')
102
- # exe << ' all'
103
- # else
104
- # puts "Script setup.rb or install.rb is missing."
105
- # return nil
106
- # end
107
- #
108
- # # SHELLS OUT!
109
- #
110
- # #Dir.chdir(source) do
111
- # #begin
112
- # success = sh(exe)
113
- # puts "Installation complete!" if success
114
- # #rescue Errno::EACCES
115
- # # puts "Permission denied"
116
- # # exit -1
117
- # #end
118
- # #end
119
- # end
120
-
121
- end
122
-
123
- end
124
- end
@@ -1,175 +0,0 @@
1
- # = TITLE:
2
- #
3
- # ShellUtils
4
- #
5
- # = COPYING:
6
- #
7
- # Copyright (c) 2007,2008 Tiger Ops
8
- #
9
- # This file is part of the Reap program.
10
- #
11
- # Reap is free software: you can redistribute it and/or modify
12
- # it under the terms of the GNU General Public License as published by
13
- # the Free Software Foundation, either version 3 of the License, or
14
- # (at your option) any later version.
15
- #
16
- # Reap is distributed in the hope that it will be useful,
17
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- # GNU General Public License for more details.
20
- #
21
- # You should have received a copy of the GNU General Public License
22
- # along with Reap. If not, see <http://www.gnu.org/licenses/>.
23
-
24
- require 'reap/extensions'
25
-
26
- module Reap
27
- module Utilities
28
-
29
- module OptionUtils
30
- attr_accessor :dryrun
31
- attr_accessor :trace
32
- attr_accessor :force
33
- attr_accessor :verbose
34
-
35
- def dryrun? ; @dryrun ; end
36
- def trace? ; @trace ; end
37
- def force? ; @force ; end
38
- def verbose? ; @verbose ; end
39
- end
40
-
41
- #
42
-
43
- module ShellUtils
44
- include OptionUtils
45
-
46
- # Internal status report.
47
- # Only output if dryrun or trace mode.
48
-
49
- def status(message)
50
- puts message if dryrun? or trace?
51
- end
52
-
53
- # Shell runner.
54
-
55
- def sh(cmd)
56
- if dryrun?
57
- puts cmd
58
- true
59
- else
60
- puts "--> system call: #{cmd}" if trace?
61
- system(cmd)
62
- end
63
- end
64
-
65
- # Convenient method to get simple console reply.
66
-
67
- def ask(question, answers=nil)
68
- print "#{question}"
69
- print " [#{answers}] " if answers
70
- until inp = $stdin.gets ; sleep 1 ; end
71
- inp.strip
72
- end
73
-
74
- # Ask for a password. (FIXME: only for unix so far)
75
-
76
- def password(prompt=nil)
77
- msg ||= "Enter Password: "
78
- inp = ''
79
-
80
- print "#{prompt} "
81
-
82
- begin
83
- #system "stty -echo"
84
- #inp = gets.chomp
85
- until inp = $stdin.gets
86
- sleep 1
87
- end
88
- ensure
89
- #system "stty echo"
90
- end
91
-
92
- return inp.chomp
93
- end
94
-
95
- # # No fuss access to ARGV. This shows up as #commandline in the reap api.
96
- # #
97
- # # Ratch uses '=' for parameterized flags b/c this make parsing stupid simple
98
- # # and that's a good thing!!! However you can use value! if need be.
99
- #
100
- # def commandline
101
- # @commandline ||= ArgVector.new(ARGV)
102
- # end
103
- #
104
- # alias_method :argument_vector, :commandline
105
- #
106
- # # Duplicate of ARGV.
107
- #
108
- # def argv
109
- # @argv ||= ARGV.dup
110
- # end
111
- #
112
- # # Convert command line argv to args.
113
- # #
114
- # # TODO Is this implmented as expected?
115
- #
116
- # def command_parameters
117
- # argv.to_params
118
- # end
119
-
120
- # # Debug mode.
121
- #
122
- # def debug?
123
- # @debug ||= %w{--debug}.any?{|a| argv.delete(a)}
124
- # end
125
- #
126
- # #
127
- #
128
- # def verbose?
129
- # @verbose ||= %w{--verbose}.any?{|a| argv.delete(a)}
130
- # end
131
- #
132
- # #
133
- #
134
- # def verbose!
135
- # @verbose = true
136
- # end
137
- #
138
- # #
139
- #
140
- # def trace?
141
- # @trace ||= %w{--trace}.any?{|a| argv.delete(a)}
142
- # end
143
- #
144
- # #
145
- #
146
- # def trace!
147
- # @trace = true
148
- # end
149
- #
150
- # #
151
- #
152
- # def noharm?
153
- # @noharm ||= %w{--dryrun --dry-run --noharm}.any?{|a| argv.delete(a)}
154
- # end
155
- # alias_method :dryrun?, :noharm? ; module_function :dryrun?
156
- #
157
- # #
158
- #
159
- # def noharm!
160
- # @noharm = true
161
- # end
162
- # alias_method :dryrun!, :noharm! ; module_function :dryrun!
163
- #
164
- # # Force mode.
165
- #
166
- # def force?
167
- # @force ||= %w{--force}.any?{|a| argv.delete(a)}
168
- # end
169
- #
170
- # def force! ; @force = true ; end
171
-
172
- end
173
-
174
- end
175
- end
data/log/FIXME.txt DELETED
@@ -1,25 +0,0 @@
1
-
2
- = FIXME
3
-
4
- file://lib/reap/manager/check.rb
5
- * FIXME: This isn't routing output to dev/null as expected. (60)
6
-
7
- file://lib/reap/manager/gem.rb
8
- * FIXME (156)
9
-
10
- file://lib/reap/manager/log.rb
11
- * FIXME Should each label of note be written to it's own file? (22)
12
-
13
- file://lib/reap/manager/pack.rb
14
- * FIXME: will type, name and version always be right? (155)
15
- * FIXME: will type, name and version always be right? (170)
16
- * FIXME: Not yet ready for use. (129)
17
-
18
- file://lib/reap/manager/prefab.rb
19
- * FIXME: RubyGems has a new way to do this. Use that instead and fix Rolls to use it too. (97)
20
- * FIXME: Make safer (currently this is not available) (66)
21
- * FIXME: This doesn't yet work b/c reap doesn't work unless
22
- a project file is already in place. (28)
23
-
24
- file://lib/reap/utilities/setuputils.rb
25
- * FIXME (60)