pg 0.9.0.pre156-x86-mswin32

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.
@@ -0,0 +1,123 @@
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
+ end
17
+
18
+
19
+ ### Task: gem
20
+ ### Task: package
21
+ Rake::PackageTask.new( PKG_NAME, PKG_VERSION ) do |task|
22
+ task.need_tar_gz = true
23
+ task.need_tar_bz2 = true
24
+ task.need_zip = true
25
+ task.package_dir = PKGDIR.to_s
26
+ task.package_files = RELEASE_FILES.collect {|f| f.to_s }
27
+ end
28
+ task :package => [:gem]
29
+
30
+
31
+ Gem::PackageTask.new( GEMSPEC ) do |pkg|
32
+ pkg.need_zip = true
33
+ pkg.need_tar = true
34
+ end
35
+
36
+
37
+ ### Task: install
38
+ desc "Install #{PKG_NAME} as a conventional library"
39
+ task :install => "spec:quiet" do
40
+ log "Installing #{PKG_NAME} as a conventional library"
41
+ sitelib = Pathname.new( CONFIG['sitelibdir'] )
42
+ sitearch = Pathname.new( CONFIG['sitearchdir'] )
43
+ Dir.chdir( LIBDIR ) do
44
+ LIB_FILES.collect {|path| Pathname(path) }.each do |libfile|
45
+ relpath = libfile.relative_path_from( LIBDIR )
46
+ target = sitelib + relpath
47
+ FileUtils.mkpath target.dirname,
48
+ :mode => 0755, :verbose => true, :noop => $dryrun unless target.dirname.directory?
49
+ FileUtils.install relpath, target,
50
+ :mode => 0644, :verbose => true, :noop => $dryrun
51
+ end
52
+ end
53
+ if EXTDIR.exist?
54
+ trace " looking for a binary extension (%s)" % [ EXTDIR + "*.#{Config::CONFIG['DLEXT']}" ]
55
+ Dir.chdir( EXTDIR ) do
56
+ Pathname.glob( "*.#{Config::CONFIG['DLEXT']}" ) do |dl|
57
+ trace " found: #{dl}"
58
+ target = sitearch + dl.basename
59
+ FileUtils.install dl, target,
60
+ :mode => 0755, :verbose => true, :noop => $dryrun
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+
67
+
68
+ ### Task: install_gem
69
+ desc "Install #{PKG_NAME} from a locally-built gem"
70
+ task :install_gem => [:package] do
71
+ $stderr.puts
72
+ installer = Gem::Installer.new( %{pkg/#{PKG_FILE_NAME}.gem} )
73
+ installer.install
74
+ end
75
+
76
+
77
+ ### Task: uninstall
78
+ desc "Uninstall #{PKG_NAME} if it's been installed as a conventional library"
79
+ task :uninstall do
80
+ log "Uninstalling conventionally-installed #{PKG_NAME} library files"
81
+ sitelib = Pathname.new( CONFIG['sitelibdir'] )
82
+ sitearch = Pathname.new( CONFIG['sitearchdir'] )
83
+
84
+ Dir.chdir( LIBDIR ) do
85
+ LIB_FILES.collect {|path| Pathname(path) }.each do |libfile|
86
+ relpath = libfile.relative_path_from( LIBDIR )
87
+ target = sitelib + relpath
88
+ FileUtils.rm_f target, :verbose => true, :noop => $dryrun
89
+ FileUtils.rm_rf( target.dirname, :verbose => true, :noop => $dryrun ) if
90
+ target.dirname.entries.empty?
91
+ end
92
+ end
93
+ if EXTDIR.exist?
94
+ trace " looking for a binary extension (%s)" % [ EXTDIR + "*.#{Config::CONFIG['DLEXT']}" ]
95
+ Dir.chdir( EXTDIR ) do
96
+ Pathname.glob( "*.#{Config::CONFIG['DLEXT']}" ) do |dl|
97
+ trace " found: #{dl}"
98
+ target = sitearch + dl.basename
99
+ FileUtils.rm target, :verbose => true, :noop => $dryrun
100
+ end
101
+ end
102
+ end
103
+ end
104
+
105
+
106
+ ### Task: uninstall_gem
107
+ desc "Install the #{PKG_NAME} gem"
108
+ task :uninstall_gem => [:clean] do
109
+ uninstaller = Gem::Uninstaller.new( PKG_FILE_NAME )
110
+ uninstaller.uninstall
111
+ end
112
+
113
+
114
+
115
+ desc "Add development depdendencies to the gemspec -- this is meant to be chained " +
116
+ "together with :gem"
117
+ task :include_dev_dependencies do
118
+ DEVELOPMENT_DEPENDENCIES.each do |name, version|
119
+ version = '>= 0' if version.length.zero?
120
+ GEMSPEC.add_development_dependency( name, version )
121
+ end
122
+ end
123
+
@@ -0,0 +1,274 @@
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 => [ :rdoc ] 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', RDOCDIR, 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
+ email.from = 'Michael Granger <mgranger@laika.com>'
213
+ email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
214
+ email.body = File.read( RELEASE_ANNOUNCE_FILE )
215
+ email.date = Time.new
216
+
217
+ email.message_id = gen_message_id()
218
+
219
+ log "About to send the following email:"
220
+ puts '---',
221
+ email.to_s,
222
+ '---'
223
+
224
+ ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
225
+ pwent = Etc.getpwuid( Process.euid )
226
+ curuser = pwent ? pwent.name : 'unknown'
227
+ username = prompt_with_default( "SMTP user", curuser )
228
+ password = prompt_for_password()
229
+
230
+ trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
231
+ smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
232
+ smtp.set_debug_output( $stdout )
233
+ smtp.esmtp = true
234
+
235
+ trace "connecting..."
236
+ smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
237
+ trace "sending message..."
238
+ smtp.send_message( email.to_s, email.from, email.to )
239
+ end
240
+ trace "done."
241
+ end
242
+ end
243
+
244
+
245
+ desc 'Publish the new release to Gemcutter'
246
+ task :publish => [:clean, :gem, :notes] do |task|
247
+ ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
248
+ gempath = PKGDIR + GEM_FILE_NAME
249
+ sh 'gem', 'push', gempath
250
+ end
251
+ end
252
+ end
253
+
254
+ rescue LoadError => err
255
+ if !Object.const_defined?( :Gem )
256
+ require 'rubygems'
257
+ retry
258
+ end
259
+
260
+ task :no_release_tasks do
261
+ fail "Release tasks not defined: #{err.message}"
262
+ end
263
+
264
+ task :release => :no_release_tasks
265
+ task "release:announce" => :no_release_tasks
266
+ task "release:publish" => :no_release_tasks
267
+ task "release:notes" => :no_release_tasks
268
+ end
269
+
270
+ desc "Package up a release, publish it, and send out notifications"
271
+ task :release => 'release:default'
272
+ task :rerelease => 'release:rerelease'
273
+ task :testrelease => 'release:test'
274
+
@@ -0,0 +1,30 @@
1
+ #
2
+ # RDoc Rake tasks
3
+
4
+ #
5
+
6
+ gem 'rdoc', '>= 2.4.3'
7
+
8
+ require 'rubygems'
9
+ require 'rdoc/rdoc'
10
+ require 'rake/clean'
11
+ require 'rdoc/task'
12
+
13
+ # Append docs/lib to the load path if it exists for a locally-installed Darkfish
14
+ DOCSLIB = DOCSDIR + 'lib'
15
+ $LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
16
+
17
+ # Make relative string paths of all the stuff we need to generate docs for
18
+ DOCFILES = Rake::FileList[ LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files ]
19
+
20
+
21
+ directory RDOCDIR.to_s
22
+ CLOBBER.include( RDOCDIR )
23
+
24
+ desc "Build API documentation in #{RDOCDIR}"
25
+ RDoc::Task.new do |task|
26
+ task.main = "README"
27
+ task.rdoc_files.include( DOCFILES )
28
+ task.rdoc_dir = RDOCDIR.to_s
29
+ task.options = RDOC_OPTIONS
30
+ end
@@ -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
+