arrow 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/ChangeLog +1590 -0
  2. data/LICENSE +28 -0
  3. data/README +75 -0
  4. data/Rakefile +366 -0
  5. data/Rakefile.local +63 -0
  6. data/data/arrow/applets/TEMPLATE.rb.tpl +53 -0
  7. data/data/arrow/applets/args.rb +50 -0
  8. data/data/arrow/applets/config.rb +55 -0
  9. data/data/arrow/applets/error.rb +63 -0
  10. data/data/arrow/applets/files.rb +46 -0
  11. data/data/arrow/applets/inspect.rb +46 -0
  12. data/data/arrow/applets/nosuchapplet.rb +31 -0
  13. data/data/arrow/applets/status.rb +92 -0
  14. data/data/arrow/applets/test.rb +133 -0
  15. data/data/arrow/applets/tutorial/counter.rb +96 -0
  16. data/data/arrow/applets/tutorial/dingus.rb +67 -0
  17. data/data/arrow/applets/tutorial/hello.rb +34 -0
  18. data/data/arrow/applets/tutorial/hello2.rb +73 -0
  19. data/data/arrow/applets/tutorial/imgtext.rb +90 -0
  20. data/data/arrow/applets/tutorial/imgtext2.rb +286 -0
  21. data/data/arrow/applets/tutorial/index.rb +36 -0
  22. data/data/arrow/applets/tutorial/logo.rb +98 -0
  23. data/data/arrow/applets/tutorial/memcache.rb +61 -0
  24. data/data/arrow/applets/tutorial/missing.rb +37 -0
  25. data/data/arrow/applets/tutorial/protected.rb +100 -0
  26. data/data/arrow/applets/tutorial/redirector.rb +52 -0
  27. data/data/arrow/applets/tutorial/rndimages.rb +159 -0
  28. data/data/arrow/applets/tutorial/sharenotes.rb +83 -0
  29. data/data/arrow/applets/tutorial/subclassed-hello.rb +32 -0
  30. data/data/arrow/applets/tutorial/superhello.rb +72 -0
  31. data/data/arrow/applets/tutorial/timeclock.rb +78 -0
  32. data/data/arrow/applets/view-applet.rb +123 -0
  33. data/data/arrow/applets/view-template.rb +85 -0
  34. data/data/arrow/applets/wiki.rb +274 -0
  35. data/data/arrow/templates/TEMPLATE.tmpl.tpl +36 -0
  36. data/data/arrow/templates/applet-status.tmpl +153 -0
  37. data/data/arrow/templates/args-display.tmpl +120 -0
  38. data/data/arrow/templates/config/display-table.tmpl +36 -0
  39. data/data/arrow/templates/config/display.tmpl +36 -0
  40. data/data/arrow/templates/counter-deleted.tmpl +33 -0
  41. data/data/arrow/templates/counter.tmpl +59 -0
  42. data/data/arrow/templates/dingus.tmpl +55 -0
  43. data/data/arrow/templates/enumtable.tmpl +8 -0
  44. data/data/arrow/templates/error-display.tmpl +92 -0
  45. data/data/arrow/templates/filemap.tmpl +89 -0
  46. data/data/arrow/templates/hello-world-src.tmpl +34 -0
  47. data/data/arrow/templates/hello-world.tmpl +60 -0
  48. data/data/arrow/templates/imgtext/fontlist.tmpl +46 -0
  49. data/data/arrow/templates/imgtext/form.tmpl +70 -0
  50. data/data/arrow/templates/imgtext/reload-error.tmpl +40 -0
  51. data/data/arrow/templates/imgtext/reload.tmpl +55 -0
  52. data/data/arrow/templates/inspect/display.tmpl +80 -0
  53. data/data/arrow/templates/loginform.tmpl +64 -0
  54. data/data/arrow/templates/logout.tmpl +32 -0
  55. data/data/arrow/templates/memcache/display.tmpl +41 -0
  56. data/data/arrow/templates/navbar.incl +27 -0
  57. data/data/arrow/templates/nosuchapplet.tmpl +32 -0
  58. data/data/arrow/templates/printsource.tmpl +35 -0
  59. data/data/arrow/templates/protected.tmpl +36 -0
  60. data/data/arrow/templates/rndimages.tmpl +38 -0
  61. data/data/arrow/templates/service-response.tmpl +13 -0
  62. data/data/arrow/templates/sharenotes/display.tmpl +38 -0
  63. data/data/arrow/templates/status.tmpl +120 -0
  64. data/data/arrow/templates/templateviewer.tmpl +43 -0
  65. data/data/arrow/templates/test/harness.tmpl +57 -0
  66. data/data/arrow/templates/test/list.tmpl +48 -0
  67. data/data/arrow/templates/test/problem.tmpl +42 -0
  68. data/data/arrow/templates/tutorial/index.tmpl +37 -0
  69. data/data/arrow/templates/tutorial/missingapplet.tmpl +29 -0
  70. data/data/arrow/templates/view-applet-nosuch.tmpl +32 -0
  71. data/data/arrow/templates/view-applet.tmpl +40 -0
  72. data/data/arrow/templates/view-template.tmpl +83 -0
  73. data/data/arrow/templates/wiki/formerror.tmpl +47 -0
  74. data/data/arrow/templates/wiki/markup_help.incl +6 -0
  75. data/data/arrow/templates/wiki/new.tmpl +56 -0
  76. data/data/arrow/templates/wiki/new_system.tmpl +122 -0
  77. data/data/arrow/templates/wiki/sectionlist.tmpl +43 -0
  78. data/data/arrow/templates/wiki/show.tmpl +34 -0
  79. data/docs/manual/layouts/default.page +43 -0
  80. data/docs/manual/lib/api-filter.rb +81 -0
  81. data/docs/manual/lib/editorial-filter.rb +64 -0
  82. data/docs/manual/lib/examples-filter.rb +244 -0
  83. data/docs/manual/lib/links-filter.rb +117 -0
  84. data/lib/apache/fakerequest.rb +448 -0
  85. data/lib/apache/logger.rb +33 -0
  86. data/lib/arrow.rb +51 -0
  87. data/lib/arrow/acceptparam.rb +207 -0
  88. data/lib/arrow/applet.rb +725 -0
  89. data/lib/arrow/appletmixins.rb +218 -0
  90. data/lib/arrow/appletregistry.rb +590 -0
  91. data/lib/arrow/applettestcase.rb +503 -0
  92. data/lib/arrow/broker.rb +255 -0
  93. data/lib/arrow/cache.rb +176 -0
  94. data/lib/arrow/config-loaders/yaml.rb +75 -0
  95. data/lib/arrow/config.rb +615 -0
  96. data/lib/arrow/constants.rb +24 -0
  97. data/lib/arrow/cookie.rb +359 -0
  98. data/lib/arrow/cookieset.rb +108 -0
  99. data/lib/arrow/dispatcher.rb +368 -0
  100. data/lib/arrow/dispatcherloader.rb +50 -0
  101. data/lib/arrow/exceptions.rb +61 -0
  102. data/lib/arrow/fallbackhandler.rb +48 -0
  103. data/lib/arrow/formvalidator.rb +631 -0
  104. data/lib/arrow/htmltokenizer.rb +343 -0
  105. data/lib/arrow/logger.rb +488 -0
  106. data/lib/arrow/logger/apacheoutputter.rb +69 -0
  107. data/lib/arrow/logger/arrayoutputter.rb +63 -0
  108. data/lib/arrow/logger/coloroutputter.rb +111 -0
  109. data/lib/arrow/logger/fileoutputter.rb +96 -0
  110. data/lib/arrow/logger/htmloutputter.rb +54 -0
  111. data/lib/arrow/logger/outputter.rb +123 -0
  112. data/lib/arrow/mixins.rb +425 -0
  113. data/lib/arrow/monkeypatches.rb +94 -0
  114. data/lib/arrow/object.rb +117 -0
  115. data/lib/arrow/path.rb +196 -0
  116. data/lib/arrow/service.rb +447 -0
  117. data/lib/arrow/session.rb +289 -0
  118. data/lib/arrow/session/dbstore.rb +100 -0
  119. data/lib/arrow/session/filelock.rb +160 -0
  120. data/lib/arrow/session/filestore.rb +132 -0
  121. data/lib/arrow/session/id.rb +98 -0
  122. data/lib/arrow/session/lock.rb +253 -0
  123. data/lib/arrow/session/md5id.rb +42 -0
  124. data/lib/arrow/session/nulllock.rb +42 -0
  125. data/lib/arrow/session/posixlock.rb +166 -0
  126. data/lib/arrow/session/sha1id.rb +54 -0
  127. data/lib/arrow/session/store.rb +366 -0
  128. data/lib/arrow/session/usertrackid.rb +52 -0
  129. data/lib/arrow/spechelpers.rb +73 -0
  130. data/lib/arrow/template.rb +713 -0
  131. data/lib/arrow/template/attr.rb +31 -0
  132. data/lib/arrow/template/call.rb +31 -0
  133. data/lib/arrow/template/comment.rb +33 -0
  134. data/lib/arrow/template/container.rb +118 -0
  135. data/lib/arrow/template/else.rb +41 -0
  136. data/lib/arrow/template/elsif.rb +44 -0
  137. data/lib/arrow/template/escape.rb +53 -0
  138. data/lib/arrow/template/export.rb +87 -0
  139. data/lib/arrow/template/for.rb +145 -0
  140. data/lib/arrow/template/if.rb +78 -0
  141. data/lib/arrow/template/import.rb +119 -0
  142. data/lib/arrow/template/include.rb +206 -0
  143. data/lib/arrow/template/iterator.rb +208 -0
  144. data/lib/arrow/template/nodes.rb +734 -0
  145. data/lib/arrow/template/parser.rb +571 -0
  146. data/lib/arrow/template/prettyprint.rb +53 -0
  147. data/lib/arrow/template/render.rb +191 -0
  148. data/lib/arrow/template/selectlist.rb +94 -0
  149. data/lib/arrow/template/set.rb +87 -0
  150. data/lib/arrow/template/timedelta.rb +81 -0
  151. data/lib/arrow/template/unless.rb +78 -0
  152. data/lib/arrow/template/urlencode.rb +51 -0
  153. data/lib/arrow/template/yield.rb +139 -0
  154. data/lib/arrow/templatefactory.rb +125 -0
  155. data/lib/arrow/testcase.rb +567 -0
  156. data/lib/arrow/transaction.rb +608 -0
  157. data/rake/191_compat.rb +26 -0
  158. data/rake/dependencies.rb +76 -0
  159. data/rake/documentation.rb +114 -0
  160. data/rake/helpers.rb +502 -0
  161. data/rake/hg.rb +282 -0
  162. data/rake/manual.rb +787 -0
  163. data/rake/packaging.rb +129 -0
  164. data/rake/publishing.rb +278 -0
  165. data/rake/style.rb +62 -0
  166. data/rake/svn.rb +668 -0
  167. data/rake/testing.rb +187 -0
  168. data/rake/verifytask.rb +64 -0
  169. data/spec/arrow/acceptparam_spec.rb +157 -0
  170. data/spec/arrow/applet_spec.rb +575 -0
  171. data/spec/arrow/appletmixins_spec.rb +409 -0
  172. data/spec/arrow/appletregistry_spec.rb +294 -0
  173. data/spec/arrow/broker_spec.rb +153 -0
  174. data/spec/arrow/config_spec.rb +224 -0
  175. data/spec/arrow/cookieset_spec.rb +164 -0
  176. data/spec/arrow/dispatcher_spec.rb +137 -0
  177. data/spec/arrow/dispatcherloader_spec.rb +65 -0
  178. data/spec/arrow/formvalidator_spec.rb +781 -0
  179. data/spec/arrow/logger_spec.rb +346 -0
  180. data/spec/arrow/mixins_spec.rb +120 -0
  181. data/spec/arrow/service_spec.rb +645 -0
  182. data/spec/arrow/session_spec.rb +121 -0
  183. data/spec/arrow/template/iterator_spec.rb +222 -0
  184. data/spec/arrow/templatefactory_spec.rb +185 -0
  185. data/spec/arrow/transaction_spec.rb +319 -0
  186. data/spec/arrow_spec.rb +37 -0
  187. data/spec/lib/appletmatchers.rb +281 -0
  188. data/spec/lib/constants.rb +77 -0
  189. data/spec/lib/helpers.rb +41 -0
  190. data/spec/lib/matchers.rb +44 -0
  191. data/tests/cookie.tests.rb +310 -0
  192. data/tests/path.tests.rb +157 -0
  193. data/tests/session.tests.rb +111 -0
  194. data/tests/session_id.tests.rb +82 -0
  195. data/tests/session_lock.tests.rb +191 -0
  196. data/tests/session_store.tests.rb +53 -0
  197. data/tests/template.tests.rb +1360 -0
  198. metadata +339 -0
@@ -0,0 +1,129 @@
1
+ #####################################################################
2
+ ### P A C K A G I N G T A S K S
3
+ #####################################################################
4
+
5
+ require 'rbconfig'
6
+ require 'pathname'
7
+ require 'rubygems/package_task'
8
+
9
+
10
+ include Config
11
+
12
+ ### Task: prerelease
13
+ desc "Append the package build number to package versions"
14
+ task :prerelease do
15
+ GEMSPEC.version.version << ".#{PKG_BUILD}"
16
+ Rake::Task[:gem].clear
17
+
18
+ Gem::PackageTask.new( GEMSPEC ) do |pkg|
19
+ pkg.need_zip = true
20
+ pkg.need_tar = true
21
+ end
22
+ end
23
+
24
+
25
+ ### Task: gem
26
+ ### Task: package
27
+ Rake::PackageTask.new( PKG_NAME, PKG_VERSION ) do |task|
28
+ task.need_tar_gz = true
29
+ task.need_tar_bz2 = true
30
+ task.need_zip = true
31
+ task.package_dir = PKGDIR.to_s
32
+ task.package_files = RELEASE_FILES.collect {|f| f.to_s }
33
+ end
34
+ task :package => [:gem]
35
+
36
+
37
+ Gem::PackageTask.new( GEMSPEC ) do |pkg|
38
+ pkg.need_zip = true
39
+ pkg.need_tar = true
40
+ end
41
+
42
+
43
+ ### Task: install
44
+ desc "Install #{PKG_NAME} as a conventional library"
45
+ task :install => "spec:quiet" do
46
+ log "Installing #{PKG_NAME} as a conventional library"
47
+ sitelib = Pathname.new( CONFIG['sitelibdir'] )
48
+ sitearch = Pathname.new( CONFIG['sitearchdir'] )
49
+ Dir.chdir( LIBDIR ) do
50
+ LIB_FILES.collect {|path| Pathname(path) }.each do |libfile|
51
+ relpath = libfile.relative_path_from( LIBDIR )
52
+ target = sitelib + relpath
53
+ FileUtils.mkpath target.dirname,
54
+ :mode => 0755, :verbose => true, :noop => $dryrun unless target.dirname.directory?
55
+ FileUtils.install relpath, target,
56
+ :mode => 0644, :verbose => true, :noop => $dryrun
57
+ end
58
+ end
59
+ if EXTDIR.exist?
60
+ trace " looking for a binary extension (%s)" % [ EXTDIR + "*.#{Config::CONFIG['DLEXT']}" ]
61
+ Dir.chdir( EXTDIR ) do
62
+ Pathname.glob( "*.#{Config::CONFIG['DLEXT']}" ) do |dl|
63
+ trace " found: #{dl}"
64
+ target = sitearch + dl.basename
65
+ FileUtils.install dl, target,
66
+ :mode => 0755, :verbose => true, :noop => $dryrun
67
+ end
68
+ end
69
+ end
70
+ end
71
+
72
+
73
+
74
+ ### Task: install_gem
75
+ desc "Install #{PKG_NAME} from a locally-built gem"
76
+ task :install_gem => [:package] do
77
+ $stderr.puts
78
+ installer = Gem::Installer.new( %{pkg/#{PKG_FILE_NAME}.gem} )
79
+ installer.install
80
+ end
81
+
82
+
83
+ ### Task: uninstall
84
+ desc "Uninstall #{PKG_NAME} if it's been installed as a conventional library"
85
+ task :uninstall do
86
+ log "Uninstalling conventionally-installed #{PKG_NAME} library files"
87
+ sitelib = Pathname.new( CONFIG['sitelibdir'] )
88
+ sitearch = Pathname.new( CONFIG['sitearchdir'] )
89
+
90
+ Dir.chdir( LIBDIR ) do
91
+ LIB_FILES.collect {|path| Pathname(path) }.each do |libfile|
92
+ relpath = libfile.relative_path_from( LIBDIR )
93
+ target = sitelib + relpath
94
+ FileUtils.rm_f target, :verbose => true, :noop => $dryrun
95
+ FileUtils.rm_rf( target.dirname, :verbose => true, :noop => $dryrun ) if
96
+ target.dirname.entries.empty?
97
+ end
98
+ end
99
+ if EXTDIR.exist?
100
+ trace " looking for a binary extension (%s)" % [ EXTDIR + "*.#{Config::CONFIG['DLEXT']}" ]
101
+ Dir.chdir( EXTDIR ) do
102
+ Pathname.glob( "*.#{Config::CONFIG['DLEXT']}" ) do |dl|
103
+ trace " found: #{dl}"
104
+ target = sitearch + dl.basename
105
+ FileUtils.rm target, :verbose => true, :noop => $dryrun
106
+ end
107
+ end
108
+ end
109
+ end
110
+
111
+
112
+ ### Task: uninstall_gem
113
+ desc "Install the #{PKG_NAME} gem"
114
+ task :uninstall_gem => [:clean] do
115
+ uninstaller = Gem::Uninstaller.new( PKG_FILE_NAME )
116
+ uninstaller.uninstall
117
+ end
118
+
119
+
120
+
121
+ desc "Add development depdendencies to the gemspec -- this is meant to be chained " +
122
+ "together with :gem"
123
+ task :include_dev_dependencies do
124
+ DEVELOPMENT_DEPENDENCIES.each do |name, version|
125
+ version = '>= 0' if version.length.zero?
126
+ GEMSPEC.add_development_dependency( name, version )
127
+ end
128
+ end
129
+
@@ -0,0 +1,278 @@
1
+ #####################################################################
2
+ ### P U B L I C A T I O N T A S K S
3
+ #####################################################################
4
+
5
+ RELEASE_NOTES_FILE = 'release.notes'
6
+ RELEASE_ANNOUNCE_FILE = 'release.ann'
7
+
8
+ require 'net/smtp'
9
+ require 'net/protocol'
10
+ require 'openssl'
11
+
12
+ $publish_privately = false
13
+
14
+ ### Add SSL to Net::SMTP
15
+ class Net::SMTP
16
+ def ssl_start( helo='localhost.localdomain', user=nil, secret=nil, authtype=nil )
17
+ if block_given?
18
+ begin
19
+ do_ssl_start( helo, user, secret, authtype )
20
+ return yield( self )
21
+ ensure
22
+ do_finish
23
+ end
24
+ else
25
+ do_ssl_start( helo, user, secret, authtype )
26
+ return self
27
+ end
28
+ end
29
+
30
+
31
+ #######
32
+ private
33
+ #######
34
+
35
+ def do_ssl_start( helodomain, user, secret, authtype )
36
+ raise IOError, 'SMTP session already started' if @started
37
+ if user or secret
38
+ if self.method( :check_auth_args ).arity == 3
39
+ check_auth_args( user, secret, authtype )
40
+ else
41
+ check_auth_args( user, secret )
42
+ end
43
+ end
44
+
45
+ # Open the connection
46
+ @debug_output << "opening connection to #{@address}...\n" if @debug_output
47
+ sock = timeout( @open_timeout ) { TCPsocket.new(@address, @port) }
48
+
49
+ # Wrap it in the SSL layer
50
+ ssl_context = OpenSSL::SSL::SSLContext.new
51
+ ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
52
+ ssl_sock = OpenSSL::SSL::SSLSocket.new( sock, ssl_context )
53
+ ssl_sock.sync_close = true
54
+ ssl_sock.connect
55
+
56
+ # Wrap it in the message-oriented IO layer
57
+ sslmsgio = Net::InternetMessageIO.new( ssl_sock )
58
+ sslmsgio.read_timeout = @read_timeout
59
+ sslmsgio.debug_output = @debug_output
60
+
61
+ @socket = sslmsgio
62
+
63
+ check_response(critical { recv_response() })
64
+ begin
65
+ if @esmtp
66
+ ehlo helodomain
67
+ else
68
+ helo helodomain
69
+ end
70
+ rescue ProtocolError
71
+ if @esmtp
72
+ @esmtp = false
73
+ @error_occured = false
74
+ retry
75
+ end
76
+ raise
77
+ end
78
+ authenticate user, secret, authtype if user
79
+ @started = true
80
+ ensure
81
+ @socket.close if not @started and @socket and not @socket.closed?
82
+ end
83
+ end
84
+
85
+
86
+ begin
87
+ gem 'text-format'
88
+
89
+ require 'time'
90
+ require 'rake/tasklib'
91
+ require 'tmail'
92
+ require 'net/smtp'
93
+ require 'etc'
94
+ require 'socket'
95
+ require 'text/format'
96
+
97
+ ### Generate a valid RFC822 message-id
98
+ def gen_message_id
99
+ return "<%s.%s@%s>" % [
100
+ (Time.now.to_f * 10000).to_i.to_s( 36 ),
101
+ (rand( 2 ** 64 - 1 )).to_s( 36 ),
102
+ Socket.gethostname
103
+ ]
104
+ end
105
+
106
+
107
+ namespace :release do
108
+ task :default => [ :prep_release, :upload, :publish, :announce ]
109
+
110
+ desc "Re-publish the release with the current version number"
111
+ task :rerelease => [ :upload, :publish, :announce ]
112
+
113
+ desc "Re-run the publication tasks, but send notifications to debugging address"
114
+ task :test do
115
+ trace "Will publish privately"
116
+ $publish_privately = true
117
+ Rake::Task['release:rerelease'].invoke
118
+ end
119
+
120
+
121
+ desc "Generate the release notes"
122
+ task :notes => [RELEASE_NOTES_FILE]
123
+ file RELEASE_NOTES_FILE do |task|
124
+ last_tag = MercurialHelpers.get_tags.grep( /\d+\.\d+\.\d+/ ).
125
+ collect {|ver| vvec(ver) }.sort.last.unpack( 'N*' ).join('.')
126
+
127
+ File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
128
+ fh.puts "Release Notes for #{PKG_VERSION}",
129
+ "--------------------------------", '', ''
130
+ end
131
+
132
+ edit task.name
133
+ end
134
+ CLOBBER.include( RELEASE_NOTES_FILE )
135
+
136
+
137
+ desc "Upload project documentation and packages to #{PROJECT_HOST}"
138
+ task :upload => [ :upload_docs, :upload_packages ]
139
+ task :project => :upload # the old name
140
+
141
+ desc "Publish the project docs to #{PROJECT_HOST}"
142
+ task :upload_docs => [ :apidocs ] do
143
+ when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
144
+ log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
145
+ run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
146
+ run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
147
+ end
148
+ end
149
+
150
+ desc "Publish the project packages to #{PROJECT_HOST}"
151
+ task :upload_packages => [ :package ] do
152
+ when_writing( "Uploading packages") do
153
+ pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
154
+ log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
155
+ pkgs.each do |pkgfile|
156
+ run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
157
+ end
158
+ end
159
+ end
160
+
161
+
162
+ file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
163
+ relnotes = File.read( RELEASE_NOTES_FILE )
164
+ announce_body = %{
165
+
166
+ Version #{PKG_VERSION} of #{PKG_NAME} has been released.
167
+
168
+ #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
169
+
170
+ == Project Page
171
+
172
+ #{GEMSPEC.homepage}
173
+
174
+ == Installation
175
+
176
+ Via gems:
177
+
178
+ $ sudo gem install #{GEMSPEC.name}
179
+
180
+ or from source:
181
+
182
+ $ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
183
+ $ tar -xzvf #{PKG_FILE_NAME}.tar.gz
184
+ $ cd #{PKG_FILE_NAME}
185
+ $ sudo rake install
186
+
187
+ == Changes
188
+ #{relnotes}
189
+ }.gsub( /^\t+/, '' )
190
+
191
+ File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
192
+ fh.print( announce_body )
193
+ end
194
+
195
+ edit task.name
196
+ end
197
+ CLOBBER.include( RELEASE_ANNOUNCE_FILE )
198
+
199
+
200
+ desc 'Send out a release announcement'
201
+ task :announce => [RELEASE_ANNOUNCE_FILE] do
202
+ email = TMail::Mail.new
203
+
204
+ if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
205
+ trace "Sending private announce mail"
206
+ email.to = 'rubymage@gmail.com'
207
+ else
208
+ trace "Sending public announce mail"
209
+ email.to = RELEASE_ANNOUNCE_ADDRESSES
210
+ email.bcc = 'rubymage@gmail.com'
211
+ end
212
+
213
+ from = prompt_with_default( "Send announcement as:",
214
+ 'Michael Granger <ged@FaerieMUD.org>' ) or fail
215
+
216
+ email.from = from
217
+ email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
218
+ email.body = File.read( RELEASE_ANNOUNCE_FILE )
219
+ email.date = Time.new
220
+
221
+ email.message_id = gen_message_id()
222
+
223
+ log "About to send the following email:"
224
+ puts '---',
225
+ email.to_s,
226
+ '---'
227
+
228
+ ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
229
+ pwent = Etc.getpwuid( Process.euid )
230
+ curuser = pwent ? pwent.name : 'unknown'
231
+ username = prompt_with_default( "SMTP user", curuser )
232
+ password = prompt_for_password()
233
+
234
+ trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
235
+ smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
236
+ smtp.set_debug_output( $stdout )
237
+ smtp.esmtp = true
238
+
239
+ trace "connecting..."
240
+ smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
241
+ trace "sending message..."
242
+ smtp.send_message( email.to_s, email.from, email.to )
243
+ end
244
+ trace "done."
245
+ end
246
+ end
247
+
248
+
249
+ desc 'Publish the new release to Gemcutter'
250
+ task :publish => [:clean, :gem, :notes] do |task|
251
+ ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
252
+ gempath = PKGDIR + GEM_FILE_NAME
253
+ sh 'gem', 'push', gempath
254
+ end
255
+ end
256
+ end
257
+
258
+ rescue LoadError => err
259
+ if !Object.const_defined?( :Gem )
260
+ require 'rubygems'
261
+ retry
262
+ end
263
+
264
+ task :no_release_tasks do
265
+ fail "Release tasks not defined: #{err.message}"
266
+ end
267
+
268
+ task :release => :no_release_tasks
269
+ task "release:announce" => :no_release_tasks
270
+ task "release:publish" => :no_release_tasks
271
+ task "release:notes" => :no_release_tasks
272
+ end
273
+
274
+ desc "Package up a release, publish it, and send out notifications"
275
+ task :release => 'release:default'
276
+ task :rerelease => 'release:rerelease'
277
+ task :testrelease => 'release:test'
278
+
@@ -0,0 +1,62 @@
1
+ #
2
+ # Style Fixup Rake Tasks
3
+
4
+ #
5
+ # Authors:
6
+ # * Michael Granger <ged@FaerieMUD.org>
7
+ #
8
+
9
+
10
+ ### Coding style checks and fixes
11
+ namespace :style do
12
+
13
+ BLANK_LINE = /^\s*$/
14
+ GOOD_INDENT = /^(\t\s*)?\S/
15
+
16
+ # A list of the files that have legitimate leading whitespace, etc.
17
+ PROBLEM_FILES = [ SPECDIR + 'config_spec.rb' ]
18
+
19
+ desc "Check source files for inconsistent indent and fix them"
20
+ task :fix_indent do
21
+ files = LIB_FILES + SPEC_FILES
22
+
23
+ badfiles = Hash.new {|h,k| h[k] = [] }
24
+
25
+ trace "Checking files for indentation"
26
+ files.each do |file|
27
+ if PROBLEM_FILES.include?( file )
28
+ trace " skipping problem file #{file}..."
29
+ next
30
+ end
31
+
32
+ trace " #{file}"
33
+ linecount = 0
34
+ file.each_line do |line|
35
+ linecount += 1
36
+
37
+ # Skip blank lines
38
+ next if line =~ BLANK_LINE
39
+
40
+ # If there's a line with incorrect indent, note it and skip to the
41
+ # next file
42
+ if line !~ GOOD_INDENT
43
+ trace " Bad line %d: %p" % [ linecount, line ]
44
+ badfiles[file] << [ linecount, line ]
45
+ end
46
+ end
47
+ end
48
+
49
+ if badfiles.empty?
50
+ log "No indentation problems found."
51
+ else
52
+ log "Found incorrect indent in #{badfiles.length} files:\n "
53
+ badfiles.each do |file, badlines|
54
+ log " #{file}:\n" +
55
+ " " + badlines.collect {|badline| "%5d: %p" % badline }.join( "\n " )
56
+ end
57
+ end
58
+ end
59
+
60
+ end
61
+
62
+