RubyPackager 0.1.0.20091021 → 0.1.1.20091105

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/AUTHORS → AUTHORS} +0 -0
  2. data/ChangeLog +67 -0
  3. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/Credits → Credits} +0 -0
  4. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/LICENSE → LICENSE} +0 -0
  5. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/README → README} +0 -0
  6. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/ReleaseInfo → ReleaseInfo} +1 -1
  7. data/TODO +14 -0
  8. data/bin/Release.rb +206 -0
  9. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/Distributors/SourceForge.rb +12 -9
  10. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/Installers/Gem.rb +8 -13
  11. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/ReleaseInfo.rb +1 -11
  12. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/Releaser.rb +130 -102
  13. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/Tools.rb +0 -0
  14. data/lib/RubyPackager/i386-linux/PlatformReleaser.rb +117 -0
  15. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/i386-mswin32/Installers/NSIS.rb +3 -4
  16. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/i386-mswin32/PlatformReleaser.rb +6 -9
  17. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/lib → lib}/RubyPackager/i386-mswin32/edicon/edicon.exe +0 -0
  18. data/test/Common.rb +346 -0
  19. data/test/PlatformIndependent/CommandLine.rb +156 -0
  20. data/test/PlatformIndependent/Executable.rb +31 -0
  21. data/test/PlatformIndependent/Library.rb +31 -0
  22. data/test/PlatformIndependent/Misc.rb +62 -0
  23. data/test/PlatformIndependent/Plugins/Distributors/SourceForge.rb +81 -0
  24. data/test/PlatformIndependent/Plugins/Installers/Gem.rb +142 -0
  25. data/test/Repository/Applications/Basic/Distribution/ReleaseInfo.rb +27 -0
  26. data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_Exe.rb +33 -0
  27. data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_ExeTerm.rb +33 -0
  28. data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_Gem.rb +32 -0
  29. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test → test/Repository}/Applications/Basic/Distribution/i386-mswin32/Icon.ico +0 -0
  30. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test → test/Repository}/Applications/Basic/Distribution/i386-mswin32/Installer/Icon.ico +0 -0
  31. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test → test/Repository}/Applications/Basic/Distribution/i386-mswin32/Installer/InstallLicense.txt +0 -0
  32. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test → test/Repository}/Applications/Basic/Distribution/i386-mswin32/Installer/install.nsi +0 -0
  33. data/{F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/test → test/Repository}/Applications/Basic/Main.rb +0 -0
  34. data/test/Repository/Libraries/Basic/Add.rb +6 -0
  35. data/test/Repository/Libraries/Basic/Distribution/Icon.ico +0 -0
  36. data/test/Repository/Libraries/Basic/Distribution/InstallLicense.txt +31 -0
  37. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo.rb +24 -0
  38. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Additional.rb +27 -0
  39. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Gem.rb +29 -0
  40. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_GemDep.rb +32 -0
  41. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_NSIS.rb +28 -0
  42. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_SF.rb +28 -0
  43. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Test.rb +27 -0
  44. data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_TestGem.rb +33 -0
  45. data/test/Repository/Libraries/Basic/Distribution/install.nsi +53 -0
  46. data/test/Repository/Libraries/Basic/MainLib.rb +6 -0
  47. data/test/Repository/Libraries/Basic/Test.rb +6 -0
  48. data/test/i386-linux/Executable.rb +86 -0
  49. data/test/i386-mswin32/Executable.rb +90 -0
  50. data/test/i386-mswin32/Plugins/Installers/NSIS.rb +39 -0
  51. data/test/run.rb +6 -2
  52. metadata +56 -29
  53. data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/ChangeLog +0 -17
  54. data/F:/RR/Source/rubypackager/svn/rubypackager/Releases/i386-mswin32/0.1.0.20091021/Normal/2009_10_21_19_10_02/Release/TODO +0 -11
  55. 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 +0 -16
  56. 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 +0 -50
  57. 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 +0 -19
  58. 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 +0 -19
@@ -34,9 +34,9 @@ module RubyPackager
34
34
  lDestFileName = "#{iReleaseDir}/#{lRelativeName}"
35
35
  FileUtils::mkdir_p(File.dirname(lDestFileName))
36
36
  if (File.directory?(iFileName))
37
- puts "Create directory #{lRelativeName}"
37
+ logDebug "Create directory #{lRelativeName}"
38
38
  else
39
- puts "Copy file #{lRelativeName}"
39
+ logDebug "Copy file #{lRelativeName}"
40
40
  FileUtils::cp(iFileName, lDestFileName)
41
41
  end
42
42
  end
@@ -60,10 +60,11 @@ module RubyPackager
60
60
  # * *iReleaseComment* (_String_): Comment accompanying this release
61
61
  # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
62
62
  # * *iIncludeTest* (_Boolean_): Do we include test files in the release ?
63
+ # * *iGenerateRDoc* (_Boolean_): Do we generate RDoc ?
63
64
  # * *iInstallers* (<em>list<String></em>): The list of installers to generate
64
65
  # * *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
66
+ def initialize(iPluginsManager, iReleaseInfo, iRootDir, iReleaseBaseDir, iPlatformReleaseInfo, iReleaseVersion, iReleaseTags, iReleaseComment, iIncludeRuby, iIncludeTest, iGenerateRDoc, iInstallers, iDistributors)
67
+ @PluginsManager, @ReleaseInfo, @RootDir, @ReleaseBaseDir, @PlatformReleaseInfo, @ReleaseVersion, @ReleaseTags, @ReleaseComment, @IncludeRuby, @IncludeTest, @GenerateRDoc, @Installers, @Distributors = iPluginsManager, iReleaseInfo, iRootDir, iReleaseBaseDir, iPlatformReleaseInfo, iReleaseVersion, iReleaseTags, iReleaseComment, iIncludeRuby, iIncludeTest, iGenerateRDoc, iInstallers, iDistributors
67
68
  @GemName = "#{@ReleaseInfo.GemInfo[:GemName]}-#{@ReleaseVersion}.gem"
68
69
  # Compute the release directory name
69
70
  lStrOptions = 'Normal'
@@ -80,6 +81,10 @@ module RubyPackager
80
81
  @InstallerDir = "#{@ReleaseDir}/Installer"
81
82
  @DocDir = "#{@ReleaseDir}/Documentation"
82
83
  @ReleaseDir += '/Release'
84
+ require 'fileutils'
85
+ FileUtils.mkdir_p(@ReleaseDir)
86
+ FileUtils.mkdir_p(@InstallerDir)
87
+ FileUtils.mkdir_p(@DocDir)
83
88
  end
84
89
 
85
90
  # Release
@@ -105,14 +110,16 @@ module RubyPackager
105
110
  end
106
111
  @Installers.each do |iInstallerName|
107
112
  @PluginsManager.accessPlugin('Installers', iInstallerName) do |ioPlugin|
108
- if (!ioPlugin.checkTools)
113
+ if ((ioPlugin.respond_to?(:checkTools)) and
114
+ (!ioPlugin.checkTools))
109
115
  rSuccess = false
110
116
  end
111
117
  end
112
118
  end
113
119
  @Distributors.each do |iDistributorName|
114
120
  @PluginsManager.accessPlugin('Distributors', iDistributorName) do |ioPlugin|
115
- if (!ioPlugin.checkTools)
121
+ if ((ioPlugin.respond_to?(:checkTools)) and
122
+ (!ioPlugin.checkTools))
116
123
  rSuccess = false
117
124
  end
118
125
  end
@@ -123,7 +130,9 @@ module RubyPackager
123
130
  rSuccess = releaseFiles
124
131
  if (rSuccess)
125
132
  # Generate documentation
126
- rSuccess = generateRDoc
133
+ if (@GenerateRDoc)
134
+ rSuccess = generateRDoc
135
+ end
127
136
  if (rSuccess)
128
137
  # Generate Release notes
129
138
  rSuccess = generateReleaseNote_HTML
@@ -134,9 +143,6 @@ module RubyPackager
134
143
  # List of files generated to distribute
135
144
  # list< String >
136
145
  lGeneratedInstallers = []
137
- if (!@Installers.empty?)
138
- FileUtils::mkdir_p(@InstallerDir)
139
- end
140
146
  @Installers.each do |iInstallerName|
141
147
  logOp("Create installer #{iInstallerName}") do
142
148
  @PluginsManager.accessPlugin('Installers', iInstallerName) do |ioPlugin|
@@ -178,9 +184,9 @@ module RubyPackager
178
184
  # * *iOperationName* (_String_): Operation name
179
185
  # * *CodeBlock*: Code to call in this operation
180
186
  def logOp(iOperationName)
181
- puts "===== #{iOperationName} ..."
187
+ logDebug "===== #{iOperationName} ..."
182
188
  yield
183
- puts "===== ... #{iOperationName}"
189
+ logDebug "===== ... #{iOperationName}"
184
190
  end
185
191
 
186
192
  # Release files in a directory, and create the executable if needed
@@ -197,7 +203,7 @@ module RubyPackager
197
203
  if (@ReleaseTags.empty?)
198
204
  lStrTags = ':Tags => []'
199
205
  else
200
- lStrTags = ":Tags => [ '#{@ReleaseTags.join('\' \'')}' ]"
206
+ lStrTags = ":Tags => [ '#{@ReleaseTags.join('\', \'')}' ]"
201
207
  end
202
208
  File.open("#{@ReleaseDir}/ReleaseInfo", 'w') do |oFile|
203
209
  oFile << "
@@ -222,8 +228,10 @@ module RubyPackager
222
228
  logOp('Copy additional files') do
223
229
  RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.AdditionalFiles)
224
230
  end
225
- logOp('Copy test files') do
226
- RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.TestFiles)
231
+ if (@IncludeTest)
232
+ logOp('Copy test files') do
233
+ RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.TestFiles)
234
+ end
227
235
  end
228
236
  end
229
237
 
@@ -237,43 +245,50 @@ module RubyPackager
237
245
  def generateRDoc
238
246
  rSuccess = true
239
247
 
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"
248
+ logOp('Generating RDoc') do
249
+ $ProjectInfo = {
250
+ :Name => @ReleaseInfo.ProjectInfo[:Name],
251
+ :Version => @ReleaseVersion,
252
+ :Tags => @ReleaseTags,
253
+ :Date => Time.now,
254
+ :DevStatus => @ReleaseInfo.ProjectInfo[:DevStatus],
255
+ :Author => @ReleaseInfo.AuthorInfo[:Name],
256
+ :AuthorMail => @ReleaseInfo.AuthorInfo[:EMail],
257
+ :AuthorURL => @ReleaseInfo.AuthorInfo[:WebPageURL],
258
+ :HomepageURL => @ReleaseInfo.ProjectInfo[:WebPageURL],
259
+ :ImageURL => @ReleaseInfo.ProjectInfo[:ImageURL],
260
+ # TODO: Do not hardcode SF anymore
261
+ :DownloadURL => "https://sourceforge.net/projects/#{@ReleaseInfo.SFInfo[:ProjectUnixName]}/files/#{@ReleaseVersion}/#{@GemName}/download",
262
+ :SVNBrowseURL => @ReleaseInfo.ProjectInfo[:SVNBrowseURL],
263
+ :FaviconURL => @ReleaseInfo.ProjectInfo[:FaviconURL],
264
+ # For the documentation, the Root dir is the Release dir as files have been copied there and the rdoc will be generated from there.
265
+ :RootDir => @ReleaseDir
266
+ }
267
+ gem 'rdoc'
268
+ require 'rdoc/rdoc'
269
+ lRDocOptions = [
270
+ '--line-numbers',
271
+ '--tab-width=2',
272
+ "--title=#{@ReleaseInfo.ProjectInfo[:Name].gsub(/'/,'\\\\\'')} v#{@ReleaseVersion}",
273
+ '--fileboxes',
274
+ '--exclude=.svn',
275
+ '--exclude=nbproject',
276
+ '--exclude=Done.txt',
277
+ "--exclude=Releases",
278
+ "--output=#{@DocDir}/rdoc"
279
+ ]
274
280
  # Bug (RDoc): Sometimes it does not change current directory correctly (not deterministic)
275
- ] )
276
- Dir.chdir(lOldDir)
281
+ lOldDir = Dir.getwd
282
+ Dir.chdir(@ReleaseDir)
283
+ # First try with Muriel's template
284
+ begin
285
+ RDoc::RDoc.new.document( lRDocOptions + [ '--fmt=muriel' ] )
286
+ rescue Exception
287
+ # Then try with default template
288
+ RDoc::RDoc.new.document( lRDocOptions )
289
+ end
290
+ Dir.chdir(lOldDir)
291
+ end
277
292
 
278
293
  return rSuccess
279
294
  end
@@ -285,31 +300,24 @@ module RubyPackager
285
300
  def generateReleaseNote_HTML
286
301
  rSuccess = true
287
302
 
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
303
+ logOp('Generating release note in HTML format') do
304
+ lLastChangesLines = []
305
+ getLastChangeLog.each do |iLine|
306
+ lLastChangesLines << iLine.
307
+ gsub(/\n/,"<br/>\n").
308
+ gsub(/^=== (.*)$/, '<h3>\1</h3>').
309
+ gsub(/^\* (.*)$/, '<li>\1</li>').
310
+ gsub(/Bug correction/, '<span class="Bug">Bug correction</span>')
309
311
  end
310
- end
311
- File.open("#{@DocDir}/ReleaseNote.html", 'w') do |oFile|
312
- oFile << "
312
+ lStrWhatsNew = ''
313
+ if (@ReleaseComment != nil)
314
+ lStrWhatsNew = "
315
+ <h2>What's new in this release</h2>
316
+ #{@ReleaseComment.gsub(/\n/,"<br/>\n")}
317
+ "
318
+ end
319
+ File.open("#{@DocDir}/ReleaseNote.html", 'w') do |oFile|
320
+ oFile << "
313
321
  <html>
314
322
  <head>
315
323
  <link rel=\"shortcut icon\" href=\"#{@ReleaseInfo.ProjectInfo[:FaviconURL]}%>\" />
@@ -365,8 +373,7 @@ module RubyPackager
365
373
  <a href=\"#{@ReleaseInfo.ProjectInfo[:WebPageURL]}\"><img src=\"#{@ReleaseInfo.ProjectInfo[:ImageURL]}\" align=\"right\" width=\"100px\"/></a>
366
374
  <h1>Release Note for #{@ReleaseInfo.ProjectInfo[:Name]} - v. #{@ReleaseVersion}</h1>
367
375
  <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")}
376
+ #{lStrWhatsNew}
370
377
  <h2>Detailed changes with previous version</h2>
371
378
  #{lLastChangesLines.join}
372
379
  <h2>Useful links</h2>
@@ -382,6 +389,7 @@ module RubyPackager
382
389
  </body>
383
390
  </html>
384
391
  "
392
+ end
385
393
  end
386
394
 
387
395
  return rSuccess
@@ -394,38 +402,26 @@ module RubyPackager
394
402
  def generateReleaseNote_TXT
395
403
  rSuccess = true
396
404
 
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
405
+ logOp('Generating release note in TXT format') do
406
+ lStrWhatsNew = ''
407
+ if (@ReleaseComment != nil)
408
+ lStrWhatsNew = "
409
+ == What's new in this release
410
+
411
+ #{@ReleaseComment}
412
+
413
+ "
414
414
  end
415
- end
416
- File.open("#{@DocDir}/ReleaseNote.txt", 'w') do |oFile|
417
- oFile << "
415
+ File.open("#{@DocDir}/ReleaseNote.txt", 'w') do |oFile|
416
+ oFile << "
418
417
  = Release Note for #{@ReleaseInfo.ProjectInfo[:Name]} - v. #{@ReleaseVersion}
419
418
 
420
419
  == Development status: #{@ReleaseInfo.ProjectInfo[:DevStatus]}
421
420
 
422
- == What's new in this release
423
-
424
- #{@ReleaseComment}
425
-
421
+ #{lStrWhatsNew}
426
422
  == Detailed changes with previous version
427
423
 
428
- #{lLastChangesLines.join}
424
+ #{getLastChangeLog.join}
429
425
 
430
426
  == Useful links
431
427
 
@@ -437,11 +433,43 @@ module RubyPackager
437
433
  * View complete ChangeLog: #{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}ChangeLog?view=markup
438
434
  * View README file: #{@ReleaseInfo.ProjectInfo[:SVNBrowseURL]}README?view=markup
439
435
  "
436
+ end
440
437
  end
441
438
 
442
439
  return rSuccess
443
440
  end
444
441
 
442
+ # Get the last change log
443
+ #
444
+ # Return:
445
+ # * <em>list<String></em>: The change log lines
446
+ def getLastChangeLog
447
+ rLastChangesLines = []
448
+
449
+ lChangeLogFileName = "#{@RootDir}/ChangeLog"
450
+ if (File.exists?(lChangeLogFileName))
451
+ File.open(lChangeLogFileName, 'r') do |iFile|
452
+ lInLastVersionSection = false
453
+ iFile.readlines.each do |iLine|
454
+ if (iLine.match(/^== /) != nil)
455
+ if (lInLastVersionSection)
456
+ # Nothing else to parse
457
+ break
458
+ else
459
+ # We are beginning the section corresponding to the last version
460
+ lInLastVersionSection = true
461
+ end
462
+ elsif (lInLastVersionSection)
463
+ # This line belongs to the last version section
464
+ rLastChangesLines << iLine
465
+ end
466
+ end
467
+ end
468
+ end
469
+
470
+ return rLastChangesLines
471
+ end
472
+
445
473
  end
446
474
 
447
475
  end
@@ -0,0 +1,117 @@
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
+ # This file prepares a win32 distribution
7
+
8
+ # Require needed to generate the temporary ruby file that produces the executable
9
+ require 'tmpdir'
10
+
11
+ module RubyPackager
12
+
13
+ class PlatformReleaser
14
+
15
+ PLATFORM_DIR = File.dirname(__FILE__)
16
+
17
+ # Check if the tools we will use to generate an executable are present
18
+ #
19
+ # Parameters:
20
+ # * *iRootDir* (_String_): Root directory
21
+ # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
22
+ # Return:
23
+ # * _Boolean_: Are tools correctly useable ?
24
+ def checkExeTools(iRootDir, iIncludeRuby)
25
+ rSuccess = true
26
+
27
+ if (iIncludeRuby)
28
+ # We need allinoneruby
29
+ if (Gem.find_files('allinoneruby').empty?)
30
+ logErr "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)."
31
+ rSuccess = false
32
+ end
33
+ end
34
+
35
+ return rSuccess
36
+ end
37
+
38
+ # Create the binary.
39
+ # This is called when the core library has been copied in the release directory.
40
+ #
41
+ # Parameters:
42
+ # * *iRootDir* (_String_): Root directory
43
+ # * *iReleaseDir* (_String_): Release directory
44
+ # * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
45
+ # * *iReleaseInfo* (_ReleaseInfo_): The release information
46
+ # Return:
47
+ # * _Boolean_: Success ?
48
+ def createBinary(iRootDir, iReleaseDir, iIncludeRuby, iReleaseInfo)
49
+ rSuccess = true
50
+
51
+ lBinSubDir = "Launch/#{RUBY_PLATFORM}/bin"
52
+ lRubyBaseBinName = nil
53
+ lRubyLaunchCmd = nil
54
+ lRubyBaseBinName = 'ruby'
55
+ lRubyLaunchCmd = 'ruby'
56
+ lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
57
+ if (iIncludeRuby)
58
+ # First create the binary containing all ruby
59
+ lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
60
+ FileUtils::mkdir_p(lBinDir)
61
+ lOldDir = Dir.getwd
62
+ Dir.chdir(lBinDir)
63
+ lCmd = "allinoneruby #{lBinName}"
64
+ rSuccess = system(lCmd)
65
+ if (!rSuccess)
66
+ logErr "Error while executing \"#{lCmd}\""
67
+ end
68
+ Dir.chdir(lOldDir)
69
+ end
70
+ if (rSuccess)
71
+ # Then create the real executable
72
+ # Generate the Shell file that launches everything for Linux
73
+ File.open("#{iReleaseDir}/#{iReleaseInfo.ExecutableInfo[:ExeName]}", 'w') do |oFile|
74
+ oFile << "
75
+ \#!/bin/sh
76
+ \#--
77
+ \# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
78
+ \# Licensed under the terms specified in LICENSE file. No warranty is provided.
79
+ \#++
80
+
81
+ \# This file is generated by RubyPackager for Linux.
82
+
83
+ \# This file has to launch the correct binary. There can be several binaries dependending on the configuration.
84
+ \# This is the file that will be created as the executable to launch.
85
+
86
+ \# Test Ruby's existence
87
+ which ruby >/dev/null 2>/dev/null
88
+ if [ $? == 1 ]
89
+ then
90
+ echo 'Ruby not found on current platform. Use embedded one.'
91
+ if [ ! -d tempruby ]
92
+ then
93
+ echo 'Extracting Ruby distribution...'
94
+ mkdir tempruby
95
+ cd tempruby
96
+ ../#{lBinSubDir}/#{lBinName} --eee-justextract
97
+ cd ..
98
+ fi
99
+ \# Set the environment correctly to execute Ruby from the extracted dir
100
+ export LD_LIBRARY_PATH=`pwd`/tempruby/bin:`pwd`/tempruby/lib:`pwd`/tempruby/lib/lib1:`pwd`/tempruby/lib/lib2:`pwd`/tempruby/lib/lib3:`pwd`/tempruby/lib/lib4:${LD_LIRARY_PATH}
101
+ export RUBYOPT=
102
+ ./tempruby/bin/ruby -w #{iReleaseInfo.ExecutableInfo[:StartupRBFile]}
103
+ else
104
+ echo 'Ruby found on current platform. Use it directly.'
105
+ ruby -w #{iReleaseInfo.ExecutableInfo[:StartupRBFile]}
106
+ fi
107
+ "
108
+ end
109
+ File.chmod(0755, "#{iReleaseDir}/#{iReleaseInfo.ExecutableInfo[:ExeName]}")
110
+ end
111
+
112
+ return rSuccess
113
+ end
114
+
115
+ end
116
+
117
+ end
@@ -18,8 +18,7 @@ module RubyPackager
18
18
 
19
19
  # Check that makensis is present
20
20
  if (!system('makensis /VERSION'))
21
- puts "!!! Need to have MakeNSIS installed in the system PATH to create installer."
22
- puts "!!! Please download and install MakeNSIS in the PATH from http://nsis.sourceforge.net/Main_Page"
21
+ logErr "Need to have MakeNSIS installed in the system PATH to create installer.\nPlease download and install MakeNSIS in the PATH from http://nsis.sourceforge.net/Main_Page"
23
22
  rSuccess = false
24
23
  end
25
24
 
@@ -40,12 +39,12 @@ module RubyPackager
40
39
  rFileName = nil
41
40
 
42
41
  if (iReleaseInfo.InstallInfo[:NSISFileName] == nil)
43
- puts '!!! No NSISFileName specified among the Install description.'
42
+ logErr 'No NSISFileName specified among the Install description.'
44
43
  else
45
44
  lNSISOK = system("makensis /DVERSION=#{iVersion} \"/DRELEASEDIR=#{iReleaseDir.gsub(/\//,'\\')}\" \"#{iRootDir.gsub(/\//,'\\')}\\#{iReleaseInfo.InstallInfo[:NSISFileName].gsub(/\//,'\\')}\"")
46
45
  if (lNSISOK)
47
46
  lInstallerDir = File.dirname("#{iRootDir}/#{iReleaseInfo.InstallInfo[:NSISFileName]}")
48
- rFileName = "#{iReleaseInfo.ExecutableInfo[:ExeName]}_#{iVersion}_setup.exe"
47
+ rFileName = "#{iReleaseInfo.InstallInfo[:InstallerName]}_#{iVersion}_setup.exe"
49
48
  FileUtils.mv("#{lInstallerDir}/setup.exe", "#{iInstallerDir}/#{rFileName}")
50
49
  end
51
50
  end
@@ -27,21 +27,18 @@ module RubyPackager
27
27
  if (iIncludeRuby)
28
28
  # We need allinoneruby
29
29
  if (Gem.find_files('allinoneruby').empty?)
30
- puts "!!! Need to have allinoneruby gem to release including Ruby."
31
- puts "!!! Please install allinoneruby gem (gem install allinoneruby)."
30
+ logErr "Need to have allinoneruby gem to release including Ruby.\nPlease install allinoneruby gem (gem install allinoneruby)."
32
31
  rSuccess = false
33
32
  end
34
33
  end
35
34
  # Check that edicon is present
36
35
  if (!File.exists?("#{PLATFORM_DIR}/edicon/edicon.exe"))
37
- puts "!!! Need to have edicon.exe installed in #{PLATFORM_DIR}/edicon to set a Windows executable's icon."
38
- puts "!!! Please install edicon, part of Ocra Gem (gem install ocra), and copy from the Gem directory (ocra-1.1.1/share/ocra/edicon.exe) to #{PLATFORM_DIR}/edicon/edicon.exe."
36
+ logErr "Need to have edicon.exe installed in #{PLATFORM_DIR}/edicon to set a Windows executable's icon.\nPlease install edicon, part of Ocra Gem (gem install ocra), and copy from the Gem directory (ocra-1.1.1/share/ocra/edicon.exe) to #{PLATFORM_DIR}/edicon/edicon.exe."
39
37
  rSuccess = false
40
38
  end
41
39
  # Check that exerb is present
42
40
  if (!system('exerb.bat --version'))
43
- puts "!!! Need to have exerb installed in the system PATH to create a Windows executable."
44
- puts "!!! Please download and install exerb from http://exerb.sourceforge.jp/index.en.html"
41
+ logErr "Need to have exerb installed in the system PATH to create a Windows executable.\nPlease download and install exerb from http://exerb.sourceforge.jp/index.en.html"
45
42
  rSuccess = false
46
43
  end
47
44
 
@@ -86,7 +83,7 @@ module RubyPackager
86
83
  end
87
84
  rSuccess = system(lCmd)
88
85
  if (!rSuccess)
89
- puts "!!! Error while executing \"#{lCmd}\""
86
+ logErr "Error while executing \"#{lCmd}\""
90
87
  end
91
88
  Dir.chdir(lOldDir)
92
89
  end
@@ -158,10 +155,10 @@ end
158
155
  lEdiconCmd = "#{PLATFORM_DIR}/edicon/edicon.exe #{iReleaseDir}/#{iReleaseInfo.ExecutableInfo[:ExeName]}.exe #{iRootDir}/#{iReleaseInfo.ExecutableInfo[:IconName]}"
159
156
  rSuccess = system(lEdiconCmd)
160
157
  if (!rSuccess)
161
- puts "!!! Error while executing \"#{lEdiconCmd}\""
158
+ logErr "Error while executing \"#{lEdiconCmd}\""
162
159
  end
163
160
  else
164
- puts "!!! Error while executing \"exerb.bat -o #{iReleaseInfo.ExecutableInfo[:ExeName]}.exe #{lTempFileName}\""
161
+ logErr "Error while executing \"exerb.bat -o #{iReleaseInfo.ExecutableInfo[:ExeName]}.exe #{lTempFileName}\""
165
162
  end
166
163
  end
167
164