pluginfactory 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/Rakefile +36 -27
- data/lib/pluginfactory.rb +1 -1
- data/rake/documentation.rb +47 -3
- data/rake/helpers.rb +65 -4
- data/rake/hg.rb +15 -3
- data/rake/manual.rb +7 -2
- data/rake/packaging.rb +7 -1
- data/rake/publishing.rb +162 -88
- data/spec/pluginfactory_spec.rb +1 -0
- metadata +35 -15
- metadata.gz.sig +2 -0
data.tar.gz.sig
ADDED
Binary file
|
data/Rakefile
CHANGED
@@ -7,7 +7,6 @@
|
|
7
7
|
# Copyright (c) 2007-2010 The FaerieMUD Consortium
|
8
8
|
#
|
9
9
|
# Authors:
|
10
|
-
# * Martin Chase <stillflame@FaerieMUD.org>
|
11
10
|
# * Michael Granger <ged@FaerieMUD.org>
|
12
11
|
#
|
13
12
|
|
@@ -19,6 +18,7 @@ BEGIN {
|
|
19
18
|
libdir = basedir + "lib"
|
20
19
|
extdir = libdir + Config::CONFIG['sitearch']
|
21
20
|
|
21
|
+
$LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
|
22
22
|
$LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
|
23
23
|
$LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
|
24
24
|
}
|
@@ -77,7 +77,7 @@ elsif VERSION_FILE.exist?
|
|
77
77
|
PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
|
78
78
|
end
|
79
79
|
|
80
|
-
PKG_VERSION
|
80
|
+
PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
|
81
81
|
|
82
82
|
PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
|
83
83
|
GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
|
@@ -92,7 +92,7 @@ EXTCONF = EXTDIR + 'extconf.rb'
|
|
92
92
|
|
93
93
|
ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
|
94
94
|
|
95
|
-
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README LICENSE] )
|
95
|
+
TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
|
96
96
|
BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
|
97
97
|
LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
|
98
98
|
EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
|
@@ -168,34 +168,37 @@ include RakefileHelpers
|
|
168
168
|
|
169
169
|
# Set the build ID if the mercurial executable is available
|
170
170
|
if hg = which( 'hg' )
|
171
|
-
id =
|
172
|
-
PKG_BUILD =
|
171
|
+
id = `#{hg} id -n`.chomp
|
172
|
+
PKG_BUILD = "pre%03d" % [(id.chomp[ /^[[:xdigit:]]+/ ] || '1')]
|
173
173
|
else
|
174
|
-
PKG_BUILD = '
|
174
|
+
PKG_BUILD = 'pre000'
|
175
175
|
end
|
176
176
|
SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
|
177
177
|
SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
|
178
178
|
|
179
179
|
# Documentation constants
|
180
180
|
API_DOCSDIR = DOCSDIR + 'api'
|
181
|
+
README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
|
181
182
|
RDOC_OPTIONS = [
|
182
|
-
'-
|
183
|
-
'-
|
184
|
-
'
|
185
|
-
|
186
|
-
|
187
|
-
'-W', 'http://deveiate.org/projects/PluginFactory/browser/'
|
183
|
+
'--tab-width=4',
|
184
|
+
'--show-hash',
|
185
|
+
'--include', BASEDIR.to_s,
|
186
|
+
"--main=#{README_FILE}",
|
187
|
+
"--title=#{PKG_NAME}",
|
188
188
|
]
|
189
189
|
YARD_OPTIONS = [
|
190
|
-
|
191
|
-
|
190
|
+
'--use-cache',
|
191
|
+
'--no-private',
|
192
|
+
'--protected',
|
193
|
+
'-r', README_FILE,
|
192
194
|
'--exclude', 'extconf\\.rb',
|
193
|
-
|
195
|
+
'--files', 'ChangeLog,LICENSE',
|
194
196
|
'--output-dir', API_DOCSDIR.to_s,
|
197
|
+
'--title', "#{PKG_NAME} #{PKG_VERSION}",
|
195
198
|
]
|
196
199
|
|
197
200
|
# Release constants
|
198
|
-
SMTP_HOST = ""
|
201
|
+
SMTP_HOST = "mail.faeriemud.org"
|
199
202
|
SMTP_PORT = 465 # SMTP + SSL
|
200
203
|
|
201
204
|
# Project constants
|
@@ -205,22 +208,24 @@ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
|
|
205
208
|
PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
|
206
209
|
PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
|
207
210
|
|
211
|
+
GEM_PUBHOST = 'rubygems.org'
|
212
|
+
|
208
213
|
# Gem dependencies: gemname => version
|
209
214
|
DEPENDENCIES = {
|
210
215
|
}
|
211
216
|
|
212
217
|
# Developer Gem dependencies: gemname => version
|
213
218
|
DEVELOPMENT_DEPENDENCIES = {
|
214
|
-
'rake'
|
215
|
-
'rcodetools'
|
216
|
-
'rcov'
|
217
|
-
'rdoc'
|
218
|
-
'RedCloth'
|
219
|
-
'rspec'
|
220
|
-
'termios'
|
221
|
-
'text-format'
|
222
|
-
'tmail'
|
223
|
-
'diff-lcs'
|
219
|
+
'rake' => '>= 0.8.7',
|
220
|
+
'rcodetools' => '>= 0.7.0.0',
|
221
|
+
'rcov' => '>= 0.8.1.2.0',
|
222
|
+
'rdoc' => '>= 2.4.3',
|
223
|
+
'RedCloth' => '>= 4.0.3',
|
224
|
+
'rspec' => '>= 1.2.6',
|
225
|
+
'ruby-termios' => '>= 0.9.6',
|
226
|
+
'text-format' => '>= 1.0.0',
|
227
|
+
'tmail' => '>= 1.2.3.1',
|
228
|
+
'diff-lcs' => '>= 1.1.2',
|
224
229
|
}
|
225
230
|
|
226
231
|
# Non-gem requirements: packagename => version
|
@@ -247,7 +252,7 @@ GEMSPEC = Gem::Specification.new do |gem|
|
|
247
252
|
|
248
253
|
gem.has_rdoc = true
|
249
254
|
gem.rdoc_options = RDOC_OPTIONS
|
250
|
-
gem.extra_rdoc_files =
|
255
|
+
gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
|
251
256
|
|
252
257
|
gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
|
253
258
|
gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
|
@@ -261,6 +266,10 @@ GEMSPEC = Gem::Specification.new do |gem|
|
|
261
266
|
gem.files = RELEASE_FILES
|
262
267
|
gem.test_files = SPEC_FILES
|
263
268
|
|
269
|
+
# signing key and certificate chain
|
270
|
+
gem.signing_key = '/Volumes/Keys/ged-private_gem_key.pem'
|
271
|
+
gem.cert_chain = [File.expand_path('~/.gem/ged-public_gem_cert.pem')]
|
272
|
+
|
264
273
|
DEPENDENCIES.each do |name, version|
|
265
274
|
version = '>= 0' if version.length.zero?
|
266
275
|
gem.add_runtime_dependency( name, version )
|
data/lib/pluginfactory.rb
CHANGED
data/rake/documentation.rb
CHANGED
@@ -13,6 +13,10 @@ $LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
|
|
13
13
|
# Make relative string paths of all the stuff we need to generate docs for
|
14
14
|
DOCFILES = Rake::FileList[ LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files ]
|
15
15
|
|
16
|
+
# Documentation coverage constants
|
17
|
+
COVERAGE_DIR = BASEDIR + 'coverage'
|
18
|
+
COVERAGE_REPORT = COVERAGE_DIR + 'documentation.txt'
|
19
|
+
|
16
20
|
|
17
21
|
# Prefer YARD, fallback to RDoc
|
18
22
|
begin
|
@@ -40,28 +44,66 @@ begin
|
|
40
44
|
end
|
41
45
|
|
42
46
|
class YARD::CLI::Base; include YardGlobals; end
|
47
|
+
class YARD::CLI::Command; include YardGlobals; end
|
43
48
|
class YARD::Parser::SourceParser; extend YardGlobals; include YardGlobals; end
|
44
49
|
class YARD::Parser::CParser; include YardGlobals; end
|
45
50
|
class YARD::CodeObjects::Base; include YardGlobals; end
|
46
51
|
class YARD::Handlers::Base; include YardGlobals; end
|
52
|
+
class YARD::Handlers::Processor; include YardGlobals; end
|
47
53
|
class YARD::Serializers::Base; include YardGlobals; end
|
54
|
+
class YARD::RegistryStore; include YardGlobals; end
|
55
|
+
class YARD::Docstring; include YardGlobals; end
|
48
56
|
module YARD::Templates::Helpers::ModuleHelper; include YardGlobals; end
|
57
|
+
|
58
|
+
if vvec(RUBY_VERSION) >= vvec("1.9.1")
|
59
|
+
# Monkeypatched to allow more than two '#' characters at the beginning
|
60
|
+
# of the comment line.
|
61
|
+
# Patched from yard-0.5.8
|
62
|
+
require 'yard/parser/ruby/ruby_parser'
|
63
|
+
class YARD::Parser::Ruby::RipperParser < Ripper
|
64
|
+
def on_comment(comment)
|
65
|
+
$stderr.puts "Adding comment: %p" % [ comment ]
|
66
|
+
visit_ns_token(:comment, comment)
|
67
|
+
|
68
|
+
comment = comment.gsub(/^\#+\s{0,1}/, '').chomp
|
69
|
+
append_comment = @comments[lineno - 1]
|
70
|
+
|
71
|
+
if append_comment && @comments_last_column == column
|
72
|
+
@comments.delete(lineno - 1)
|
73
|
+
comment = append_comment + "\n" + comment
|
74
|
+
end
|
75
|
+
|
76
|
+
@comments[lineno] = comment
|
77
|
+
@comments_last_column = column
|
78
|
+
end
|
79
|
+
end # class YARD::Parser::Ruby::RipperParser
|
80
|
+
end
|
81
|
+
|
49
82
|
# </metamonkeypatch>
|
50
83
|
|
51
84
|
YARD_OPTIONS = [] unless defined?( YARD_OPTIONS )
|
52
85
|
|
53
|
-
YARD::Rake::YardocTask.new( :apidocs ) do |task|
|
86
|
+
yardoctask = YARD::Rake::YardocTask.new( :apidocs ) do |task|
|
54
87
|
task.files = DOCFILES
|
55
88
|
task.options = YARD_OPTIONS
|
89
|
+
task.options << '--debug' << '--verbose' if $trace
|
56
90
|
end
|
91
|
+
yardoctask.before = lambda {
|
92
|
+
trace "Calling yardoc like:",
|
93
|
+
" yardoc %s" % [ quotelist(yardoctask.options + yardoctask.files).join(' ') ]
|
94
|
+
}
|
95
|
+
|
96
|
+
YARDOC_CACHE = BASEDIR + '.yardoc'
|
97
|
+
CLOBBER.include( YARDOC_CACHE.to_s )
|
98
|
+
|
57
99
|
rescue LoadError
|
58
100
|
require 'rdoc/task'
|
59
101
|
|
60
|
-
desc "Build API documentation in #{
|
102
|
+
desc "Build API documentation in #{API_DOCSDIR}"
|
61
103
|
RDoc::Task.new( :apidocs ) do |task|
|
62
104
|
task.main = "README"
|
63
105
|
task.rdoc_files.include( DOCFILES )
|
64
|
-
task.rdoc_dir = API_DOCSDIR
|
106
|
+
task.rdoc_dir = API_DOCSDIR.to_s
|
65
107
|
task.options = RDOC_OPTIONS
|
66
108
|
end
|
67
109
|
end
|
@@ -69,3 +111,5 @@ end
|
|
69
111
|
# Need the DOCFILES to exist to build the API docs
|
70
112
|
task :apidocs => DOCFILES
|
71
113
|
|
114
|
+
CLEAN.include( API_DOCSDIR.to_s )
|
115
|
+
|
data/rake/helpers.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
|
2
3
|
#####################################################################
|
3
4
|
### G L O B A L H E L P E R F U N C T I O N S
|
4
5
|
#####################################################################
|
@@ -6,7 +7,6 @@
|
|
6
7
|
|
7
8
|
require 'pathname'
|
8
9
|
require 'uri'
|
9
|
-
require 'open3'
|
10
10
|
|
11
11
|
begin
|
12
12
|
require 'readline'
|
@@ -54,9 +54,12 @@ module RakefileHelpers
|
|
54
54
|
CLEAR_CURRENT_LINE = "\e[2K"
|
55
55
|
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
TAR_OPTS = { :compression => :gzip }
|
58
|
+
|
59
|
+
|
60
|
+
###############
|
61
|
+
module_function
|
62
|
+
###############
|
60
63
|
|
61
64
|
### Output a logging message
|
62
65
|
def log( *msg )
|
@@ -388,6 +391,7 @@ module RakefileHelpers
|
|
388
391
|
### capture groups, those will be returned in an Array, else the whole matching line
|
389
392
|
### is returned.
|
390
393
|
def find_pattern_in_pipe( regexp, *cmd )
|
394
|
+
require 'open3'
|
391
395
|
output = []
|
392
396
|
|
393
397
|
log( cmd.collect {|part| part =~ /\s/ ? part.inspect : part} )
|
@@ -436,6 +440,63 @@ module RakefileHelpers
|
|
436
440
|
return ver.split('.').collect {|char| char.to_i }.pack('N*')
|
437
441
|
end
|
438
442
|
|
443
|
+
|
444
|
+
### Archive::Tar::Reader#extract (as of 0.9.0) is broken w.r.t.
|
445
|
+
### permissions, so we have to do this ourselves.
|
446
|
+
def untar( tarfile, targetdir )
|
447
|
+
require 'archive/tar'
|
448
|
+
targetdir = Pathname( targetdir )
|
449
|
+
raise "No such directory: #{targetdir}" unless targetdir.directory?
|
450
|
+
|
451
|
+
reader = Archive::Tar::Reader.new( tarfile.to_s, TAR_OPTS )
|
452
|
+
|
453
|
+
mkdir_p( targetdir )
|
454
|
+
reader.each( true ) do |header, body|
|
455
|
+
path = targetdir + header[:path]
|
456
|
+
# trace "Header is: %p" % [ header ]
|
457
|
+
|
458
|
+
case header[:type]
|
459
|
+
when :file
|
460
|
+
trace " #{path}"
|
461
|
+
path.open( File::WRONLY|File::EXCL|File::CREAT|File::TRUNC, header[:mode] ) do |fio|
|
462
|
+
bytesize = header[:size]
|
463
|
+
fio.write( body[0,bytesize] )
|
464
|
+
end
|
465
|
+
|
466
|
+
when :directory
|
467
|
+
trace " #{path}"
|
468
|
+
path.mkpath
|
469
|
+
|
470
|
+
when :link
|
471
|
+
linktarget = targetdir + header[:dest]
|
472
|
+
trace " #{path} => #{linktarget}"
|
473
|
+
path.make_link( linktarget.to_s )
|
474
|
+
|
475
|
+
when :symlink
|
476
|
+
linktarget = targetdir + header[:dest]
|
477
|
+
trace " #{path} -> #{linktarget}"
|
478
|
+
path.make_symlink( linktarget )
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
end
|
483
|
+
|
484
|
+
|
485
|
+
### Extract the contents of the specified +zipfile+ into the given +targetdir+.
|
486
|
+
def unzip( zipfile, targetdir, *files )
|
487
|
+
require 'zip/zip'
|
488
|
+
targetdir = Pathname( targetdir )
|
489
|
+
raise "No such directory: #{targetdir}" unless targetdir.directory?
|
490
|
+
|
491
|
+
Zip::ZipFile.foreach( zipfile ) do |entry|
|
492
|
+
# trace " entry is: %p" % [ entry ]
|
493
|
+
next unless files.empty? || files.include?( entry.name )
|
494
|
+
target_path = targetdir + entry.name
|
495
|
+
# trace " would extract to: %s" % [ target_path ]
|
496
|
+
entry.extract( target_path ) { true }
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
439
500
|
end # module Rakefile::Helpers
|
440
501
|
|
441
502
|
|
data/rake/hg.rb
CHANGED
@@ -85,7 +85,7 @@ unless defined?( HG_DOTDIR )
|
|
85
85
|
|
86
86
|
### Return the list of files which are of status 'unknown'
|
87
87
|
def get_unknown_files
|
88
|
-
list = read_command_output( 'hg', 'status', '-un', '--
|
88
|
+
list = read_command_output( 'hg', 'status', '-un', '--color', 'never' )
|
89
89
|
list = list.split( /\n/ )
|
90
90
|
|
91
91
|
trace "New files: %p" % [ list ]
|
@@ -215,13 +215,20 @@ unless defined?( HG_DOTDIR )
|
|
215
215
|
paths = get_repo_paths()
|
216
216
|
if origin_url = paths['default']
|
217
217
|
ask_for_confirmation( "Pull and update from '#{origin_url}'?", false ) do
|
218
|
-
|
218
|
+
Rake::Task['hg:pull_without_confirmation'].invoke
|
219
219
|
end
|
220
220
|
else
|
221
221
|
trace "Skipping pull: No 'default' path."
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
|
+
|
226
|
+
desc "Pull and update without confirmation"
|
227
|
+
task :pull_without_confirmation do
|
228
|
+
run 'hg', 'pull', '-u'
|
229
|
+
end
|
230
|
+
|
231
|
+
|
225
232
|
desc "Check the current code in if tests pass"
|
226
233
|
task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
|
227
234
|
targets = get_target_args()
|
@@ -242,13 +249,18 @@ unless defined?( HG_DOTDIR )
|
|
242
249
|
paths = get_repo_paths()
|
243
250
|
if origin_url = paths['default']
|
244
251
|
ask_for_confirmation( "Push to '#{origin_url}'?", false ) do
|
245
|
-
|
252
|
+
Rake::Task['hg:push_without_confirmation'].invoke
|
246
253
|
end
|
247
254
|
else
|
248
255
|
trace "Skipping push: No 'default' path."
|
249
256
|
end
|
250
257
|
end
|
251
258
|
|
259
|
+
desc "Push to the default repo without confirmation"
|
260
|
+
task :push_without_confirmation do
|
261
|
+
run 'hg', 'push'
|
262
|
+
end
|
263
|
+
|
252
264
|
end
|
253
265
|
|
254
266
|
if HG_DOTDIR.exist?
|
data/rake/manual.rb
CHANGED
@@ -147,9 +147,14 @@ module Manual
|
|
147
147
|
|
148
148
|
layout = self.config['layout'].sub( /\.page$/, '' )
|
149
149
|
templatepath = @layouts_dir + "#{layout}.page"
|
150
|
-
template =
|
151
|
-
|
150
|
+
template = nil
|
151
|
+
if Object.const_defined?( :Encoding )
|
152
|
+
template = ERB.new( templatepath.read(:encoding => 'UTF-8') )
|
153
|
+
else
|
154
|
+
template = ERB.new( templatepath.read )
|
155
|
+
end
|
152
156
|
|
157
|
+
page = self
|
153
158
|
html = template.result( binding() )
|
154
159
|
|
155
160
|
# Use Tidy to clean up the html if 'cleanup' is turned on, but remove the Tidy
|
data/rake/packaging.rb
CHANGED
@@ -12,7 +12,13 @@ include Config
|
|
12
12
|
### Task: prerelease
|
13
13
|
desc "Append the package build number to package versions"
|
14
14
|
task :prerelease do
|
15
|
-
GEMSPEC.version.version
|
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
|
16
22
|
end
|
17
23
|
|
18
24
|
|
data/rake/publishing.rb
CHANGED
@@ -13,6 +13,7 @@ $publish_privately = false
|
|
13
13
|
|
14
14
|
### Add SSL to Net::SMTP
|
15
15
|
class Net::SMTP
|
16
|
+
|
16
17
|
def ssl_start( helo='localhost.localdomain', user=nil, secret=nil, authtype=nil )
|
17
18
|
if block_given?
|
18
19
|
begin
|
@@ -93,6 +94,9 @@ begin
|
|
93
94
|
require 'etc'
|
94
95
|
require 'socket'
|
95
96
|
require 'text/format'
|
97
|
+
require 'rubygems/gemcutter_utilities'
|
98
|
+
|
99
|
+
include Gem::GemcutterUtilities
|
96
100
|
|
97
101
|
### Generate a valid RFC822 message-id
|
98
102
|
def gen_message_id
|
@@ -104,6 +108,48 @@ begin
|
|
104
108
|
end
|
105
109
|
|
106
110
|
|
111
|
+
### Fetch the rubygems API token if it hasn't been already.
|
112
|
+
def sign_in_to_rubygems
|
113
|
+
return if Gem.configuration.rubygems_api_key
|
114
|
+
|
115
|
+
log "Enter your RubyGems.org credentials."
|
116
|
+
|
117
|
+
email = prompt " Email: "
|
118
|
+
password = prompt_for_password( "Password: " )
|
119
|
+
|
120
|
+
response = rubygems_api_request( :get, "api/v1/api_key" ) do |request|
|
121
|
+
request.basic_auth( email, password )
|
122
|
+
end
|
123
|
+
|
124
|
+
with_response( response ) do |resp|
|
125
|
+
log "Signed in."
|
126
|
+
Gem.configuration.rubygems_api_key = resp.body
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
### Push the gem at the specified +path+ to the rubygems server at +gemhost+.
|
132
|
+
def push_gem( path, gemhost )
|
133
|
+
ENV['RUBYGEMS_HOST'] = "http://#{gemhost}"
|
134
|
+
|
135
|
+
sign_in_to_rubygems()
|
136
|
+
|
137
|
+
response = rubygems_api_request( :post, "api/v1/gems" ) do |request|
|
138
|
+
request.body = Gem.read_binary( path )
|
139
|
+
request.add_field "Content-Length", request.body.size
|
140
|
+
request.add_field "Content-Type", "application/octet-stream"
|
141
|
+
request.add_field "Authorization", Gem.configuration.rubygems_api_key
|
142
|
+
end
|
143
|
+
|
144
|
+
case response
|
145
|
+
when Net::HTTPSuccess
|
146
|
+
log( response.body )
|
147
|
+
else
|
148
|
+
fail( response.body )
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
|
107
153
|
namespace :release do
|
108
154
|
task :default => [ :prep_release, :upload, :publish, :announce ]
|
109
155
|
|
@@ -133,120 +179,147 @@ begin
|
|
133
179
|
end
|
134
180
|
CLOBBER.include( RELEASE_NOTES_FILE )
|
135
181
|
|
182
|
+
# Only define upload tasks if there's an upload host
|
183
|
+
if PROJECT_HOST.empty?
|
184
|
+
task :no_upload_host do
|
185
|
+
log "Skipping upload: no upload host."
|
186
|
+
end
|
187
|
+
task :upload => :no_upload_host
|
188
|
+
task :upload_docs => :no_upload_host
|
189
|
+
task :upload_packages => :no_upload_host
|
190
|
+
else
|
191
|
+
desc "Upload project documentation and packages to #{PROJECT_HOST}"
|
192
|
+
task :upload => [ :upload_docs, :upload_packages ]
|
193
|
+
task :project => :upload # the old name
|
194
|
+
|
195
|
+
desc "Publish the project docs to #{PROJECT_HOST}"
|
196
|
+
task :upload_docs => [ :apidocs ] do
|
197
|
+
when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
|
198
|
+
log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
|
199
|
+
run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
|
200
|
+
run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
|
201
|
+
end
|
202
|
+
end
|
136
203
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
|
204
|
+
desc "Publish the project packages to #{PROJECT_HOST}"
|
205
|
+
task :upload_packages => [ :package ] do
|
206
|
+
when_writing( "Uploading packages") do
|
207
|
+
pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
|
208
|
+
log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
|
209
|
+
pkgs.each do |pkgfile|
|
210
|
+
run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
|
211
|
+
end
|
212
|
+
end
|
147
213
|
end
|
148
214
|
end
|
149
215
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
216
|
+
# Only define the announcement tasks if there are addresses to announce to
|
217
|
+
if RELEASE_ANNOUNCE_ADDRESSES.empty?
|
218
|
+
task :no_announce_addresses do
|
219
|
+
log "Skipping announcement: no announce addresses"
|
220
|
+
end
|
221
|
+
task :announce => :no_announce_addresses
|
160
222
|
|
223
|
+
else
|
224
|
+
file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
|
225
|
+
relnotes = File.read( RELEASE_NOTES_FILE )
|
226
|
+
announce_body = %{
|
161
227
|
|
162
|
-
|
163
|
-
relnotes = File.read( RELEASE_NOTES_FILE )
|
164
|
-
announce_body = %{
|
228
|
+
Version #{PKG_VERSION} of #{PKG_NAME} has been released.
|
165
229
|
|
166
|
-
|
230
|
+
#{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
|
167
231
|
|
168
|
-
|
232
|
+
== Project Page
|
169
233
|
|
170
|
-
|
234
|
+
#{GEMSPEC.homepage}
|
171
235
|
|
172
|
-
|
236
|
+
== Installation
|
173
237
|
|
174
|
-
|
238
|
+
Via gems:
|
175
239
|
|
176
|
-
|
240
|
+
$ sudo gem install #{GEMSPEC.name}
|
177
241
|
|
178
|
-
|
242
|
+
or from source:
|
179
243
|
|
180
|
-
|
244
|
+
$ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
|
245
|
+
$ tar -xzvf #{PKG_FILE_NAME}.tar.gz
|
246
|
+
$ cd #{PKG_FILE_NAME}
|
247
|
+
$ sudo rake install
|
181
248
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
$ sudo rake install
|
249
|
+
== Changes
|
250
|
+
#{relnotes}
|
251
|
+
}.gsub( /^\t+/, '' )
|
186
252
|
|
187
|
-
|
188
|
-
|
189
|
-
|
253
|
+
File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
|
254
|
+
fh.print( announce_body )
|
255
|
+
end
|
190
256
|
|
191
|
-
|
192
|
-
fh.print( announce_body )
|
257
|
+
edit task.name
|
193
258
|
end
|
259
|
+
CLOBBER.include( RELEASE_ANNOUNCE_FILE )
|
194
260
|
|
195
|
-
edit task.name
|
196
|
-
end
|
197
|
-
CLOBBER.include( RELEASE_ANNOUNCE_FILE )
|
198
261
|
|
262
|
+
desc 'Send out a release announcement'
|
263
|
+
task :announce => [RELEASE_ANNOUNCE_FILE] do
|
264
|
+
email = TMail::Mail.new
|
199
265
|
|
200
|
-
|
201
|
-
|
202
|
-
|
266
|
+
if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
|
267
|
+
trace "Sending private announce mail"
|
268
|
+
email.to = 'rubymage@gmail.com'
|
269
|
+
else
|
270
|
+
trace "Sending public announce mail"
|
271
|
+
email.to = RELEASE_ANNOUNCE_ADDRESSES
|
272
|
+
email.bcc = 'rubymage@gmail.com'
|
273
|
+
end
|
203
274
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
email.
|
210
|
-
email.
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
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 )
|
275
|
+
from = prompt_with_default( "Send announcement as:",
|
276
|
+
'Michael Granger <ged@FaerieMUD.org>' ) or fail
|
277
|
+
|
278
|
+
email.from = from
|
279
|
+
email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
|
280
|
+
email.body = File.read( RELEASE_ANNOUNCE_FILE )
|
281
|
+
email.date = Time.new
|
282
|
+
|
283
|
+
email.message_id = gen_message_id()
|
284
|
+
|
285
|
+
log "About to send the following email:"
|
286
|
+
puts '---',
|
287
|
+
email.to_s,
|
288
|
+
'---'
|
289
|
+
|
290
|
+
ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
|
291
|
+
pwent = Etc.getpwuid( Process.euid )
|
292
|
+
curuser = pwent ? pwent.name : 'unknown'
|
293
|
+
username = prompt_with_default( "SMTP user", curuser )
|
294
|
+
password = prompt_for_password()
|
295
|
+
|
296
|
+
trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
|
297
|
+
smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
|
298
|
+
smtp.set_debug_output( $stdout )
|
299
|
+
smtp.esmtp = true
|
300
|
+
|
301
|
+
trace "connecting..."
|
302
|
+
smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
|
303
|
+
trace "sending message..."
|
304
|
+
smtp.send_message( email.to_s, email.from, email.to )
|
305
|
+
end
|
306
|
+
trace "done."
|
239
307
|
end
|
240
|
-
trace "done."
|
241
308
|
end
|
242
309
|
end
|
243
310
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
311
|
+
if GEM_PUBHOST.empty?
|
312
|
+
task :no_gem_host do
|
313
|
+
log "Skipping gem push: no gem publication host."
|
314
|
+
end
|
315
|
+
task :publish => :no_gem_host
|
316
|
+
else
|
317
|
+
desc 'Publish the new gem to #{GEM_PUBHOST}'
|
318
|
+
task :publish => [:clean, :gem, :notes] do |task|
|
319
|
+
ask_for_confirmation( "Publish #{GEM_FILE_NAME} to #{GEM_PUBHOST}?", false ) do
|
320
|
+
gempath = PKGDIR + GEM_FILE_NAME
|
321
|
+
push_gem( gempath, GEM_PUBHOST )
|
322
|
+
end
|
250
323
|
end
|
251
324
|
end
|
252
325
|
end
|
@@ -262,6 +335,7 @@ rescue LoadError => err
|
|
262
335
|
end
|
263
336
|
|
264
337
|
task :release => :no_release_tasks
|
338
|
+
task "release:rerelease" => :no_release_tasks
|
265
339
|
task "release:announce" => :no_release_tasks
|
266
340
|
task "release:publish" => :no_release_tasks
|
267
341
|
task "release:notes" => :no_release_tasks
|
data/spec/pluginfactory_spec.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluginfactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- 7
|
10
|
+
version: 1.0.7
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Martin Chase, Michael Granger
|
13
14
|
autorequire:
|
14
15
|
bindir: bin
|
15
|
-
cert_chain:
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
|
20
|
+
FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
|
21
|
+
DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
|
22
|
+
FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
|
23
|
+
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
|
24
|
+
h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
|
25
|
+
vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
|
26
|
+
KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
|
27
|
+
BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
|
28
|
+
TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
|
29
|
+
AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
|
30
|
+
+saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
|
31
|
+
vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
|
32
|
+
HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
|
33
|
+
aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
|
34
|
+
U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
|
35
|
+
cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
|
36
|
+
-----END CERTIFICATE-----
|
16
37
|
|
17
|
-
date: 2010-
|
38
|
+
date: 2010-09-27 00:00:00 -07:00
|
18
39
|
default_executable:
|
19
40
|
dependencies: []
|
20
41
|
|
@@ -61,37 +82,36 @@ licenses: []
|
|
61
82
|
|
62
83
|
post_install_message:
|
63
84
|
rdoc_options:
|
64
|
-
- -
|
65
|
-
-
|
66
|
-
-
|
67
|
-
- -i
|
85
|
+
- --tab-width=4
|
86
|
+
- --show-hash
|
87
|
+
- --include
|
68
88
|
- .
|
69
|
-
-
|
70
|
-
-
|
71
|
-
- -t
|
72
|
-
- pluginfactory
|
73
|
-
- -W
|
74
|
-
- http://deveiate.org/projects/PluginFactory/browser/
|
89
|
+
- --main=README
|
90
|
+
- --title=pluginfactory
|
75
91
|
require_paths:
|
76
92
|
- lib
|
77
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
78
95
|
requirements:
|
79
96
|
- - ">="
|
80
97
|
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
81
99
|
segments:
|
82
100
|
- 0
|
83
101
|
version: "0"
|
84
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
85
104
|
requirements:
|
86
105
|
- - ">="
|
87
106
|
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
88
108
|
segments:
|
89
109
|
- 0
|
90
110
|
version: "0"
|
91
111
|
requirements: []
|
92
112
|
|
93
113
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.3.
|
114
|
+
rubygems_version: 1.3.7
|
95
115
|
signing_key:
|
96
116
|
specification_version: 3
|
97
117
|
summary: A mixin for making plugin classes
|
metadata.gz.sig
ADDED