RubyPackager 0.1.0.20091021
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/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/AUTHORS +3 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/ChangeLog +17 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/Credits +35 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/LICENSE +31 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/README +18 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/ReleaseInfo +8 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/TODO +11 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/Distributors/SourceForge.rb +159 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/Installers/Gem.rb +122 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/ReleaseInfo.rb +227 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/Releaser.rb +447 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/Tools.rb +72 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/i386-mswin32/Installers/NSIS.rb +60 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/i386-mswin32/PlatformReleaser.rb +173 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib/RubyPackager/i386-mswin32/edicon/edicon.exe +0 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Applications/Basic/Distribution/ReleaseInfo.rb +16 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Applications/Basic/Distribution/i386-mswin32/Icon.ico +0 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Applications/Basic/Distribution/i386-mswin32/Installer/Icon.ico +0 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Applications/Basic/Distribution/i386-mswin32/Installer/InstallLicense.txt +31 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Applications/Basic/Distribution/i386-mswin32/Installer/install.nsi +51 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Applications/Basic/Main.rb +8 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/Common.rb +50 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/i386-mswin32/run.rb +19 -0
- data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test/run.rb +19 -0
- data/test/run.rb +19 -0
- metadata +87 -0
@@ -0,0 +1,447 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
# Release a distribution of a Ruby program.
|
7
|
+
# This produces an installable executable that will install a set of files and directories:
|
8
|
+
# * A binary, including some core Ruby and program files (eventually the whole Ruby distribution if needed - that is if the program is meant to be run on platforms not providing Ruby)
|
9
|
+
# * A list of files/directories
|
10
|
+
|
11
|
+
require 'fileutils'
|
12
|
+
|
13
|
+
module RubyPackager
|
14
|
+
|
15
|
+
# Copy a list of files patterns to the release directory
|
16
|
+
#
|
17
|
+
# Parameters:
|
18
|
+
# * *iRootDir* (_String_): The root dir
|
19
|
+
# * *iReleaseDir* (_String_): The release dir
|
20
|
+
# * *iFilesPatterns* (<em>list<String></em>): The list of files patterns
|
21
|
+
def self.copyFiles(iRootDir, iReleaseDir, iFilesPatterns)
|
22
|
+
iFilesPatterns.each do |iFilePattern|
|
23
|
+
Dir.glob(File.expand_path(iFilePattern)).each do |iFileName|
|
24
|
+
if (File.basename(iFileName).match(/^(\.svn|CVS)$/) == nil)
|
25
|
+
lRelativeName = nil
|
26
|
+
# Extract the relative file name
|
27
|
+
lMatch = iFileName.match(/^#{iRootDir}\/(.*)$/)
|
28
|
+
if (lMatch == nil)
|
29
|
+
# The path is already relative
|
30
|
+
lRelativeName = iFileName
|
31
|
+
else
|
32
|
+
lRelativeName = lMatch[1]
|
33
|
+
end
|
34
|
+
lDestFileName = "#{iReleaseDir}/#{lRelativeName}"
|
35
|
+
FileUtils::mkdir_p(File.dirname(lDestFileName))
|
36
|
+
if (File.directory?(iFileName))
|
37
|
+
puts "Create directory #{lRelativeName}"
|
38
|
+
else
|
39
|
+
puts "Copy file #{lRelativeName}"
|
40
|
+
FileUtils::cp(iFileName, lDestFileName)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Class that makes a release
|
48
|
+
class Releaser
|
49
|
+
|
50
|
+
# Constructor
|
51
|
+
#
|
52
|
+
# Parameters:
|
53
|
+
# * *iPluginsManager* (<em>RUtilAnts::Plugins::PluginsManager</em>): The Plugins manager
|
54
|
+
# * *iReleaseInfo* (_ReleaseInfo_): The release information
|
55
|
+
# * *iRootDir* (_String_): The root directory, containing files to ship in the distribution
|
56
|
+
# * *iReleaseBaseDir* (_String_): The release directory, where files will be copied and generated for distribution
|
57
|
+
# * *iPlatformReleaseInfo* (_Object_): The platform dependent release info
|
58
|
+
# * *iReleaseVersion* (_String_): Version to release
|
59
|
+
# * *iReleaseTags* (<em>list<String></em>): Tags associated to this release
|
60
|
+
# * *iReleaseComment* (_String_): Comment accompanying this release
|
61
|
+
# * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
|
62
|
+
# * *iIncludeTest* (_Boolean_): Do we include test files in the release ?
|
63
|
+
# * *iInstallers* (<em>list<String></em>): The list of installers to generate
|
64
|
+
# * *iDistributors* (<em>list<String></em>): The list of distributors to ship installers to
|
65
|
+
def initialize(iPluginsManager, iReleaseInfo, iRootDir, iReleaseBaseDir, iPlatformReleaseInfo, iReleaseVersion, iReleaseTags, iReleaseComment, iIncludeRuby, iIncludeTest, iInstallers, iDistributors)
|
66
|
+
@PluginsManager, @ReleaseInfo, @RootDir, @ReleaseBaseDir, @PlatformReleaseInfo, @ReleaseVersion, @ReleaseTags, @ReleaseComment, @IncludeRuby, @IncludeTest, @Installers, @Distributors = iPluginsManager, iReleaseInfo, iRootDir, iReleaseBaseDir, iPlatformReleaseInfo, iReleaseVersion, iReleaseTags, iReleaseComment, iIncludeRuby, iIncludeTest, iInstallers, iDistributors
|
67
|
+
@GemName = "#{@ReleaseInfo.GemInfo[:GemName]}-#{@ReleaseVersion}.gem"
|
68
|
+
# Compute the release directory name
|
69
|
+
lStrOptions = 'Normal'
|
70
|
+
if (@IncludeRuby)
|
71
|
+
if (@IncludeTest)
|
72
|
+
lStrOptions = 'IncludeRuby_IncludeTest'
|
73
|
+
else
|
74
|
+
lStrOptions = 'IncludeRuby'
|
75
|
+
end
|
76
|
+
elsif (@IncludeTest)
|
77
|
+
lStrOptions = 'IncludeTest'
|
78
|
+
end
|
79
|
+
@ReleaseDir = "#{@ReleaseBaseDir}/#{RUBY_PLATFORM}/#{@ReleaseVersion}/#{lStrOptions}/#{Time.now.strftime('%Y_%m_%d_%H_%M_%S')}"
|
80
|
+
@InstallerDir = "#{@ReleaseDir}/Installer"
|
81
|
+
@DocDir = "#{@ReleaseDir}/Documentation"
|
82
|
+
@ReleaseDir += '/Release'
|
83
|
+
end
|
84
|
+
|
85
|
+
# Release
|
86
|
+
#
|
87
|
+
# Return:
|
88
|
+
# * _Boolean_: Success ?
|
89
|
+
def execute
|
90
|
+
rSuccess = true
|
91
|
+
|
92
|
+
# First check that every tool we will need is present
|
93
|
+
# TODO: Use RDI to install missing ones
|
94
|
+
logOp('Check installed tools') do
|
95
|
+
# Check that the tools we need to release are indeed here
|
96
|
+
if ((@ReleaseInfo.respond_to?(:checkReadyForRelease)) and
|
97
|
+
(!@ReleaseInfo.checkReadyForRelease(@RootDir)))
|
98
|
+
rSuccess = false
|
99
|
+
end
|
100
|
+
if (@ReleaseInfo.ExecutableInfo[:ExeName] != nil)
|
101
|
+
# Check tools for platform dependent considerations
|
102
|
+
if (!@PlatformReleaseInfo.checkExeTools(@RootDir, @IncludeRuby))
|
103
|
+
rSuccess = false
|
104
|
+
end
|
105
|
+
end
|
106
|
+
@Installers.each do |iInstallerName|
|
107
|
+
@PluginsManager.accessPlugin('Installers', iInstallerName) do |ioPlugin|
|
108
|
+
if (!ioPlugin.checkTools)
|
109
|
+
rSuccess = false
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
@Distributors.each do |iDistributorName|
|
114
|
+
@PluginsManager.accessPlugin('Distributors', iDistributorName) do |ioPlugin|
|
115
|
+
if (!ioPlugin.checkTools)
|
116
|
+
rSuccess = false
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
if (rSuccess)
|
122
|
+
# Release files and create binary if needed
|
123
|
+
rSuccess = releaseFiles
|
124
|
+
if (rSuccess)
|
125
|
+
# Generate documentation
|
126
|
+
rSuccess = generateRDoc
|
127
|
+
if (rSuccess)
|
128
|
+
# Generate Release notes
|
129
|
+
rSuccess = generateReleaseNote_HTML
|
130
|
+
if (rSuccess)
|
131
|
+
rSuccess = generateReleaseNote_TXT
|
132
|
+
if (rSuccess)
|
133
|
+
# Create installers
|
134
|
+
# List of files generated to distribute
|
135
|
+
# list< String >
|
136
|
+
lGeneratedInstallers = []
|
137
|
+
if (!@Installers.empty?)
|
138
|
+
FileUtils::mkdir_p(@InstallerDir)
|
139
|
+
end
|
140
|
+
@Installers.each do |iInstallerName|
|
141
|
+
logOp("Create installer #{iInstallerName}") do
|
142
|
+
@PluginsManager.accessPlugin('Installers', iInstallerName) do |ioPlugin|
|
143
|
+
lFileName = ioPlugin.createInstaller(@RootDir, @ReleaseDir, @InstallerDir, @ReleaseVersion, @ReleaseInfo)
|
144
|
+
if (lFileName == nil)
|
145
|
+
rSuccess = false
|
146
|
+
else
|
147
|
+
lGeneratedInstallers << lFileName
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
if (rSuccess)
|
153
|
+
# 5. Distribute
|
154
|
+
@Distributors.each do |iDistributorName|
|
155
|
+
logOp("Distribute to #{iDistributorName}") do
|
156
|
+
@PluginsManager.accessPlugin('Distributors', iDistributorName) do |ioPlugin|
|
157
|
+
if (!ioPlugin.distribute(@InstallerDir, @ReleaseVersion, @ReleaseInfo, lGeneratedInstallers, @DocDir))
|
158
|
+
rSuccess = false
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
return rSuccess
|
171
|
+
end
|
172
|
+
|
173
|
+
private
|
174
|
+
|
175
|
+
# Log an operation, and call some code inside
|
176
|
+
#
|
177
|
+
# Parameters:
|
178
|
+
# * *iOperationName* (_String_): Operation name
|
179
|
+
# * *CodeBlock*: Code to call in this operation
|
180
|
+
def logOp(iOperationName)
|
181
|
+
puts "===== #{iOperationName} ..."
|
182
|
+
yield
|
183
|
+
puts "===== ... #{iOperationName}"
|
184
|
+
end
|
185
|
+
|
186
|
+
# Release files in a directory, and create the executable if needed
|
187
|
+
#
|
188
|
+
# Return:
|
189
|
+
# * _Boolean_: Success ?
|
190
|
+
def releaseFiles
|
191
|
+
rSuccess = true
|
192
|
+
|
193
|
+
logOp('Copy core files') do
|
194
|
+
RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.CoreFiles)
|
195
|
+
# Create the ReleaseVersion file
|
196
|
+
lStrTags = nil
|
197
|
+
if (@ReleaseTags.empty?)
|
198
|
+
lStrTags = ':Tags => []'
|
199
|
+
else
|
200
|
+
lStrTags = ":Tags => [ '#{@ReleaseTags.join('\' \'')}' ]"
|
201
|
+
end
|
202
|
+
File.open("#{@ReleaseDir}/ReleaseInfo", 'w') do |oFile|
|
203
|
+
oFile << "
|
204
|
+
# This file has been generated by RubyPackager during a delivery.
|
205
|
+
# More info about RubyPackager: http://rubypackager.sourceforge.net
|
206
|
+
{
|
207
|
+
:Version => '#{@ReleaseVersion}',
|
208
|
+
#{lStrTags},
|
209
|
+
:DevStatus => '#{@ReleaseInfo.ProjectInfo[:DevStatus]}'
|
210
|
+
}
|
211
|
+
"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
if (@ReleaseInfo.ExecutableInfo[:ExeName] != nil)
|
215
|
+
logOp('Create binary') do
|
216
|
+
# TODO (crate): When crate will work correctly under Windows, use it here to pack everything
|
217
|
+
# For now the executable creation is platform dependent
|
218
|
+
rSuccess = @PlatformReleaseInfo.createBinary(@RootDir, @ReleaseDir, @IncludeRuby, @ReleaseInfo)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
if (rSuccess)
|
222
|
+
logOp('Copy additional files') do
|
223
|
+
RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.AdditionalFiles)
|
224
|
+
end
|
225
|
+
logOp('Copy test files') do
|
226
|
+
RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.TestFiles)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
return rSuccess
|
231
|
+
end
|
232
|
+
|
233
|
+
# Generate rdoc
|
234
|
+
#
|
235
|
+
# Return:
|
236
|
+
# * _Boolean_: Success ?
|
237
|
+
def generateRDoc
|
238
|
+
rSuccess = true
|
239
|
+
|
240
|
+
puts "==== Generating RDoc ..."
|
241
|
+
$ProjectInfo = {
|
242
|
+
:Name => @ReleaseInfo.ProjectInfo[:Name],
|
243
|
+
:Version => @ReleaseVersion,
|
244
|
+
:Tags => @ReleaseTags,
|
245
|
+
:Date => Time.now,
|
246
|
+
:DevStatus => @ReleaseInfo.ProjectInfo[:DevStatus],
|
247
|
+
:Author => @ReleaseInfo.AuthorInfo[:Name],
|
248
|
+
:AuthorMail => @ReleaseInfo.AuthorInfo[:EMail],
|
249
|
+
:AuthorURL => @ReleaseInfo.AuthorInfo[:WebPageURL],
|
250
|
+
:HomepageURL => @ReleaseInfo.ProjectInfo[:WebPageURL],
|
251
|
+
:ImageURL => @ReleaseInfo.ProjectInfo[:ImageURL],
|
252
|
+
# TODO: Do not hardcode SF anymore
|
253
|
+
:DownloadURL => "https://sourceforge.net/projects/#{@ReleaseInfo.SFInfo[:ProjectUnixName]}/files/#{@ReleaseVersion}/#{@GemName}/download",
|
254
|
+
:SVNBrowseURL => @ReleaseInfo.ProjectInfo[:SVNBrowseURL],
|
255
|
+
:FaviconURL => @ReleaseInfo.ProjectInfo[:FaviconURL],
|
256
|
+
# For the documentation, the Root dir is the Release dir as files have been copied there and the rdoc will be generated from there.
|
257
|
+
:RootDir => @ReleaseDir
|
258
|
+
}
|
259
|
+
gem 'rdoc'
|
260
|
+
require 'rdoc/rdoc'
|
261
|
+
lOldDir = Dir.getwd
|
262
|
+
Dir.chdir(@ReleaseDir)
|
263
|
+
RDoc::RDoc.new.document( [
|
264
|
+
'--line-numbers',
|
265
|
+
'--tab-width=2',
|
266
|
+
"--title=#{@ReleaseInfo.ProjectInfo[:Name].gsub(/'/,'\\\\\'')} v#{@ReleaseVersion}",
|
267
|
+
'--fileboxes',
|
268
|
+
'--fmt=darkfish',
|
269
|
+
'--exclude=.svn',
|
270
|
+
'--exclude=nbproject',
|
271
|
+
'--exclude=Done.txt',
|
272
|
+
"--exclude=Releases",
|
273
|
+
"--output=#{@DocDir}/rdoc"
|
274
|
+
# Bug (RDoc): Sometimes it does not change current directory correctly (not deterministic)
|
275
|
+
] )
|
276
|
+
Dir.chdir(lOldDir)
|
277
|
+
|
278
|
+
return rSuccess
|
279
|
+
end
|
280
|
+
|
281
|
+
# Generate a release note file to attach to this release
|
282
|
+
#
|
283
|
+
# Return:
|
284
|
+
# * _Boolean_: Success ?
|
285
|
+
def generateReleaseNote_HTML
|
286
|
+
rSuccess = true
|
287
|
+
|
288
|
+
puts "==== Generating release note in HTML format ..."
|
289
|
+
lLastChangesLines = []
|
290
|
+
File.open("#{@RootDir}/ChangeLog", 'r') do |iFile|
|
291
|
+
lInLastVersionSection = false
|
292
|
+
iFile.readlines.each do |iLine|
|
293
|
+
if (iLine.match(/^== /) != nil)
|
294
|
+
if (lInLastVersionSection)
|
295
|
+
# Nothing else to parse
|
296
|
+
break
|
297
|
+
else
|
298
|
+
# We are beginning the section corresponding to the last version
|
299
|
+
lInLastVersionSection = true
|
300
|
+
end
|
301
|
+
elsif (lInLastVersionSection)
|
302
|
+
# This line belongs to the last version section
|
303
|
+
lLastChangesLines << iLine.
|
304
|
+
gsub(/\n/,"<br/>\n").
|
305
|
+
gsub(/^=== (.*)$/, '<h3>\1</h3>').
|
306
|
+
gsub(/^\* (.*)$/, '<li>\1</li>').
|
307
|
+
gsub(/Bug correction/, '<span class="Bug">Bug correction</span>')
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
File.open("#{@DocDir}/ReleaseNote.html", 'w') do |oFile|
|
312
|
+
oFile << "
|
313
|
+
<html>
|
314
|
+
<head>
|
315
|
+
<link rel=\"shortcut icon\" href=\"#{@ReleaseInfo.ProjectInfo[:FaviconURL]}%>\" />
|
316
|
+
<style type=\"text/css\">
|
317
|
+
body {
|
318
|
+
background: #fdfdfd;
|
319
|
+
font: 14px \"Helvetica Neue\", Helvetica, Tahoma, sans-serif;
|
320
|
+
}
|
321
|
+
img {
|
322
|
+
border: none;
|
323
|
+
}
|
324
|
+
h1 {
|
325
|
+
text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;
|
326
|
+
color: #6C8C22;
|
327
|
+
}
|
328
|
+
h2 {
|
329
|
+
padding: 2px 8px;
|
330
|
+
background: #ccc;
|
331
|
+
color: #666;
|
332
|
+
-moz-border-radius-topleft: 4px;
|
333
|
+
-moz-border-radius-topright: 4px;
|
334
|
+
-webkit-border-top-left-radius: 4px;
|
335
|
+
-webkit-border-top-right-radius: 4px;
|
336
|
+
border-bottom: 1px solid #aaa;
|
337
|
+
}
|
338
|
+
h3 {
|
339
|
+
padding: 2px 32px;
|
340
|
+
background: #ddd;
|
341
|
+
color: #666;
|
342
|
+
-moz-border-radius-topleft: 4px;
|
343
|
+
-moz-border-radius-topright: 4px;
|
344
|
+
-webkit-border-top-left-radius: 4px;
|
345
|
+
-webkit-border-top-right-radius: 4px;
|
346
|
+
border-bottom: 1px solid #aaa;
|
347
|
+
}
|
348
|
+
.Bug {
|
349
|
+
color: red;
|
350
|
+
font-weight: bold;
|
351
|
+
}
|
352
|
+
.Important {
|
353
|
+
color: #633;
|
354
|
+
font-weight: bold;
|
355
|
+
}
|
356
|
+
ul {
|
357
|
+
line-height: 160%;
|
358
|
+
}
|
359
|
+
li {
|
360
|
+
padding-left: 20px;
|
361
|
+
}
|
362
|
+
</style>
|
363
|
+
</head>
|
364
|
+
<body>
|
365
|
+
<a href=\"#{@ReleaseInfo.ProjectInfo[:WebPageURL]}\"><img src=\"#{@ReleaseInfo.ProjectInfo[:ImageURL]}\" align=\"right\" width=\"100px\"/></a>
|
366
|
+
<h1>Release Note for #{@ReleaseInfo.ProjectInfo[:Name]} - v. #{@ReleaseVersion}</h1>
|
367
|
+
<h2>Development status: <span class=\"Important\">#{@ReleaseInfo.ProjectInfo[:DevStatus]}</span></h2>
|
368
|
+
<h2>What's new in this release</h2>
|
369
|
+
#{@ReleaseComment.gsub(/\n/,"<br/>\n")}
|
370
|
+
<h2>Detailed changes with previous version</h2>
|
371
|
+
#{lLastChangesLines.join}
|
372
|
+
<h2>Useful links</h2>
|
373
|
+
<ul>
|
374
|
+
<li><a href=\"#{@ReleaseInfo.ProjectInfo[:WebPageURL]}\">Project web site</a></li>
|
375
|
+
<li><a href=\"https://sourceforge.net/projects/#{@ReleaseInfo.SFInfo[:ProjectUnixName]}/files/#{@ReleaseVersion}/#{@GemName}/download\">Download</a></li>
|
376
|
+
<li>Author: <a href=\"#{@ReleaseInfo.AuthorInfo[:WebPageURL]}\">#{@ReleaseInfo.AuthorInfo[:Name]}</a> (<a href=\"mailto://#{@ReleaseInfo.AuthorInfo[:EMail]}\">Contact</a>)</li>
|
377
|
+
<li><a href=\"#{@ReleaseInfo.ProjectInfo[:WebPageURL]}rdoc/#{@ReleaseVersion}\">Browse RDoc</a></li>
|
378
|
+
<li><a href=\"#{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}\">Browse SVN</a></li>
|
379
|
+
<li><a href=\"#{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}ChangeLog?view=markup\">View complete ChangeLog</a></li>
|
380
|
+
<li><a href=\"#{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}README?view=markup\">View README file</a></li>
|
381
|
+
</ul>
|
382
|
+
</body>
|
383
|
+
</html>
|
384
|
+
"
|
385
|
+
end
|
386
|
+
|
387
|
+
return rSuccess
|
388
|
+
end
|
389
|
+
|
390
|
+
# Generate a release note file to attach to this release
|
391
|
+
#
|
392
|
+
# Return:
|
393
|
+
# * _Boolean_: Success ?
|
394
|
+
def generateReleaseNote_TXT
|
395
|
+
rSuccess = true
|
396
|
+
|
397
|
+
puts "==== Generating release note in TXT format ..."
|
398
|
+
lLastChangesLines = []
|
399
|
+
File.open("#{@RootDir}/ChangeLog", 'r') do |iFile|
|
400
|
+
lInLastVersionSection = false
|
401
|
+
iFile.readlines.each do |iLine|
|
402
|
+
if (iLine.match(/^== /) != nil)
|
403
|
+
if (lInLastVersionSection)
|
404
|
+
# Nothing else to parse
|
405
|
+
break
|
406
|
+
else
|
407
|
+
# We are beginning the section corresponding to the last version
|
408
|
+
lInLastVersionSection = true
|
409
|
+
end
|
410
|
+
elsif (lInLastVersionSection)
|
411
|
+
# This line belongs to the last version section
|
412
|
+
lLastChangesLines << iLine
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
File.open("#{@DocDir}/ReleaseNote.txt", 'w') do |oFile|
|
417
|
+
oFile << "
|
418
|
+
= Release Note for #{@ReleaseInfo.ProjectInfo[:Name]} - v. #{@ReleaseVersion}
|
419
|
+
|
420
|
+
== Development status: #{@ReleaseInfo.ProjectInfo[:DevStatus]}
|
421
|
+
|
422
|
+
== What's new in this release
|
423
|
+
|
424
|
+
#{@ReleaseComment}
|
425
|
+
|
426
|
+
== Detailed changes with previous version
|
427
|
+
|
428
|
+
#{lLastChangesLines.join}
|
429
|
+
|
430
|
+
== Useful links
|
431
|
+
|
432
|
+
* Project web site: #{@ReleaseInfo.ProjectInfo[:WebPageURL]}
|
433
|
+
* Download: https://sourceforge.net/projects/#{@ReleaseInfo.ProjectInfo[:ProjectUnixName]}/files/#{@ReleaseVersion}/#{@GemName}/download
|
434
|
+
* Author: #{@ReleaseInfo.AuthorInfo[:Name]} (#{@ReleaseInfo.AuthorInfo[:WebPageURL]}) (Mail: #{@ReleaseInfo.AuthorInfo[:EMail]})
|
435
|
+
* Browse RDoc: #{@ReleaseInfo.ProjectInfo[:WebPageURL]}rdoc/#{@ReleaseVersion}
|
436
|
+
* Browse SVN: #{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}
|
437
|
+
* View complete ChangeLog: #{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}ChangeLog?view=markup
|
438
|
+
* View README file: #{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}README?view=markup
|
439
|
+
"
|
440
|
+
end
|
441
|
+
|
442
|
+
return rSuccess
|
443
|
+
end
|
444
|
+
|
445
|
+
end
|
446
|
+
|
447
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
|
+
#++
|
5
|
+
|
6
|
+
module RubyPackager
|
7
|
+
|
8
|
+
module Tools
|
9
|
+
|
10
|
+
# The map of stored passwords, per login
|
11
|
+
@@Passwords = {}
|
12
|
+
|
13
|
+
# Get a needed password.
|
14
|
+
# Ask it from the user if we don't know it
|
15
|
+
#
|
16
|
+
# Parameters:
|
17
|
+
# * *iLogin* (_String_): Login for which we want the password
|
18
|
+
# Return:
|
19
|
+
# * _String_: Password
|
20
|
+
def getPassword(iLogin)
|
21
|
+
if (@@Passwords[iLogin] == nil)
|
22
|
+
# Ask for it
|
23
|
+
puts "Enter password for login #{iLogin}:"
|
24
|
+
# TODO: Hide the output
|
25
|
+
@@Passwords[iLogin] = $stdin.gets.strip
|
26
|
+
end
|
27
|
+
|
28
|
+
return @@Passwords[iLogin]
|
29
|
+
end
|
30
|
+
|
31
|
+
# Execute some SSH command on a remote host protected with password
|
32
|
+
#
|
33
|
+
# Parameters:
|
34
|
+
# * *iSSHHost* (_String_): The SSH host
|
35
|
+
# * *iSSHLogin* (_String_): The SSH login
|
36
|
+
# * *iCmd* (_String_): The command to execute
|
37
|
+
def sshWithPassword(iSSHHost, iSSHLogin, iCmd)
|
38
|
+
require 'net/ssh'
|
39
|
+
Net::SSH.start(
|
40
|
+
iSSHHost,
|
41
|
+
iSSHLogin,
|
42
|
+
:password => getPassword(iSSHLogin)
|
43
|
+
) do |iSSH|
|
44
|
+
puts(iSSH.exec!(iCmd))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Copy files through SCP.
|
49
|
+
#
|
50
|
+
# Parameters:
|
51
|
+
# * *iSCPHost* (_String_): Host
|
52
|
+
# * *iSCPLogin* (_String_): Login
|
53
|
+
# * *iFileSrc* (_String_): Path to local file to copy from
|
54
|
+
# * *iFileDst* (_String_): Path to remote file to copy to
|
55
|
+
def scpWithPassword(iSCPHost, iSCPLogin, iFileSrc, iFileDst)
|
56
|
+
require 'net/scp'
|
57
|
+
Net::SCP.start(
|
58
|
+
iSCPHost,
|
59
|
+
iSCPLogin,
|
60
|
+
:password => getPassword(iSCPLogin)
|
61
|
+
) do |iSCP|
|
62
|
+
iSCP.upload!(iFileSrc, iFileDst) do |iChunk, iName, iSent, iTotal|
|
63
|
+
printf "#{iName}: #{iSent}/#{iTotal}\015"
|
64
|
+
$stdout.flush
|
65
|
+
end
|
66
|
+
puts ''
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|