RubyPackager 0.1.1.20091105 → 0.2.1.20101110
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +28 -0
- data/LICENSE +1 -1
- data/ReleaseInfo +3 -3
- data/TODO +2 -0
- data/bin/Release.rb +4 -2
- data/lib/RubyPackager/Distributors/SourceForge.rb +5 -6
- data/lib/RubyPackager/Installers/Gem.rb +98 -64
- data/lib/RubyPackager/ReleaseInfo.rb +10 -8
- data/lib/RubyPackager/Releaser.rb +18 -17
- data/lib/RubyPackager/Tools.rb +1 -1
- data/lib/RubyPackager/i386-cygwin/PlatformReleaser.rb +112 -0
- data/lib/RubyPackager/i386-linux/PlatformReleaser.rb +15 -20
- data/lib/RubyPackager/i386-mswin32/Installers/NSIS.rb +1 -1
- data/lib/RubyPackager/i386-mswin32/PlatformReleaser.rb +23 -25
- metadata +34 -56
- data/test/Common.rb +0 -346
- data/test/PlatformIndependent/CommandLine.rb +0 -156
- data/test/PlatformIndependent/Executable.rb +0 -31
- data/test/PlatformIndependent/Library.rb +0 -31
- data/test/PlatformIndependent/Misc.rb +0 -62
- data/test/PlatformIndependent/Plugins/Distributors/SourceForge.rb +0 -81
- data/test/PlatformIndependent/Plugins/Installers/Gem.rb +0 -142
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo.rb +0 -27
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_Exe.rb +0 -33
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_ExeTerm.rb +0 -33
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_Gem.rb +0 -32
- data/test/Repository/Applications/Basic/Distribution/i386-mswin32/Icon.ico +0 -0
- data/test/Repository/Applications/Basic/Distribution/i386-mswin32/Installer/Icon.ico +0 -0
- data/test/Repository/Applications/Basic/Distribution/i386-mswin32/Installer/InstallLicense.txt +0 -31
- data/test/Repository/Applications/Basic/Distribution/i386-mswin32/Installer/install.nsi +0 -51
- data/test/Repository/Applications/Basic/Main.rb +0 -8
- data/test/Repository/Libraries/Basic/Add.rb +0 -6
- data/test/Repository/Libraries/Basic/Distribution/Icon.ico +0 -0
- data/test/Repository/Libraries/Basic/Distribution/InstallLicense.txt +0 -31
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo.rb +0 -24
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Additional.rb +0 -27
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Gem.rb +0 -29
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_GemDep.rb +0 -32
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_NSIS.rb +0 -28
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_SF.rb +0 -28
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Test.rb +0 -27
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_TestGem.rb +0 -33
- data/test/Repository/Libraries/Basic/Distribution/install.nsi +0 -53
- data/test/Repository/Libraries/Basic/MainLib.rb +0 -6
- data/test/Repository/Libraries/Basic/Test.rb +0 -6
- data/test/i386-linux/Executable.rb +0 -86
- data/test/i386-mswin32/Executable.rb +0 -90
- data/test/i386-mswin32/Plugins/Installers/NSIS.rb +0 -39
- data/test/run.rb +0 -23
data/ChangeLog
CHANGED
@@ -1,5 +1,33 @@
|
|
1
1
|
= RubyPackager Release History
|
2
2
|
|
3
|
+
== 0.2.0.20101110 (Beta)
|
4
|
+
|
5
|
+
=== Misc
|
6
|
+
|
7
|
+
* Changed DevStatus to Beta.
|
8
|
+
* Updated Copyright information.
|
9
|
+
* Used rUtilAnts' changeDir.
|
10
|
+
|
11
|
+
=== New features
|
12
|
+
|
13
|
+
* Release files can now specify several executables to be considered.
|
14
|
+
* Release files can now specify several require paths to be considered using :RequirePaths
|
15
|
+
|
16
|
+
=== API changes
|
17
|
+
|
18
|
+
* API change for Installer plugins: added parameter to know if test files are part of the release.
|
19
|
+
* Changed API for plugins generating executables: executable info is given instead of all info.
|
20
|
+
* Changed API for plugins getting executables information: :ExecutableInfo replaced by :ExecutablesInfo, giving a list of executables info.
|
21
|
+
|
22
|
+
=== Bug corrections
|
23
|
+
|
24
|
+
* Bug correction: Gem Installer: Unable to release a gem without test files if test files were declared in the release info.
|
25
|
+
* Bug correction: Gem Installer: Unable to release a gem with a platform other than Ruby.
|
26
|
+
* Bug correction: Executables generated for Linux did not run.
|
27
|
+
* Bug correction: Read ReleaseInfo from its correct location.
|
28
|
+
* Bug correction: Running executables on Windows did not work sometimes.
|
29
|
+
* Bug correction: When Ruby version did include a patch level, output of Ruby was expected incorrectly.
|
30
|
+
|
3
31
|
== 0.1.1.20091105 (Alpha)
|
4
32
|
|
5
33
|
=== New features
|
data/LICENSE
CHANGED
@@ -6,7 +6,7 @@ This list is found in the file named AUTHORS.
|
|
6
6
|
The AUTHORS and LICENSE files have to be included in any release of software
|
7
7
|
embedding source code of this package, or using it as a derivative software.
|
8
8
|
|
9
|
-
Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
9
|
+
Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
10
10
|
|
11
11
|
Redistribution and use in source and binary forms, with or without
|
12
12
|
modification, are permitted provided that the following conditions are met:
|
data/ReleaseInfo
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# This file has been generated by RubyPackager during a delivery.
|
3
3
|
# More info about RubyPackager: http://rubypackager.sourceforge.net
|
4
4
|
{
|
5
|
-
:Version => '0.
|
6
|
-
:Tags => [],
|
7
|
-
:DevStatus => '
|
5
|
+
:Version => '0.2.1.20101110',
|
6
|
+
:Tags => [ 'Beta' ],
|
7
|
+
:DevStatus => 'Beta'
|
8
8
|
}
|
data/TODO
CHANGED
@@ -12,3 +12,5 @@
|
|
12
12
|
** Make it run under MacOS
|
13
13
|
** Make rdoc modifications part of a real Gem or an RDoc improvement.
|
14
14
|
** Use RDI in checkContext methods.
|
15
|
+
** As it is possible to have many failures when delivering or generating installers, and as generating executables and documentation is a long process, it should be better to reuse partially generated content.
|
16
|
+
** Delivering a Gem has to be done using "gem push" with a RubyGems.org account info.
|
data/bin/Release.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!env ruby
|
2
2
|
#--
|
3
|
-
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
4
4
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
5
5
|
#++
|
6
6
|
|
@@ -13,6 +13,8 @@
|
|
13
13
|
|
14
14
|
require 'rUtilAnts/Logging'
|
15
15
|
RUtilAnts::Logging::initializeLogging("#{File.dirname(__FILE__)}/..", 'http://sourceforge.net/tracker/?group_id=274236&atid=1165400')
|
16
|
+
require 'rUtilAnts/Misc'
|
17
|
+
RUtilAnts::Misc.initializeMisc
|
16
18
|
|
17
19
|
module RubyPackager
|
18
20
|
|
@@ -36,7 +38,7 @@ module RubyPackager
|
|
36
38
|
:Tags => [],
|
37
39
|
:DevStatus => 'Unofficial'
|
38
40
|
}
|
39
|
-
lReleaseInfoFileName = "#{File.dirname(FILE_PATH)}
|
41
|
+
lReleaseInfoFileName = "#{File.dirname(FILE_PATH)}/../ReleaseInfo"
|
40
42
|
if (File.exists?(lReleaseInfoFileName))
|
41
43
|
File.open(lReleaseInfoFileName, 'r') do |iFile|
|
42
44
|
lRPReleaseInfo = eval(iFile.read)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
2
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
@@ -59,7 +59,7 @@ module RubyPackager
|
|
59
59
|
@SFReleaseDir = "/home/frs/project/#{@SFProjectSubPath}/#{@ReleaseVersion}"
|
60
60
|
createSFShell
|
61
61
|
createReleaseOnSFNET
|
62
|
-
# It is possible that
|
62
|
+
# It is possible that the RDoc has not been generated
|
63
63
|
if (File.exists?("#{@DocDir}/rdoc"))
|
64
64
|
uploadRDocOnSFNET
|
65
65
|
end
|
@@ -93,10 +93,9 @@ module RubyPackager
|
|
93
93
|
def uploadRDocOnSFNET
|
94
94
|
logDebug 'Uploading RDoc on SF.NET ...'
|
95
95
|
# Zip the RDoc
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
Dir.chdir(lOldDir)
|
96
|
+
changeDir(@DocDir) do
|
97
|
+
system("zip -r rdoc.zip rdoc")
|
98
|
+
end
|
100
99
|
# Send it
|
101
100
|
lRDocBaseDir = "/home/groups/#{@SFProjectSubPath}/htdocs/rdoc"
|
102
101
|
sshWithPassword(
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
2
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
@@ -17,52 +17,80 @@ module RubyPackager
|
|
17
17
|
# * *iInstallerDir* (_String_): The directory where the installer has to be put
|
18
18
|
# * *iVersion* (_String_): Release version
|
19
19
|
# * *iReleaseInfo* (_ReleaseInfo_): Release info
|
20
|
+
# * *iIncludeTest* (_Boolean_): Are test files part of the release ?
|
20
21
|
# Return:
|
21
22
|
# * _String_: File name to distribute, or nil in case of failure
|
22
|
-
def createInstaller(iRootDir, iReleaseDir, iInstallerDir, iVersion, iReleaseInfo)
|
23
|
+
def createInstaller(iRootDir, iReleaseDir, iInstallerDir, iVersion, iReleaseInfo, iIncludeTest)
|
23
24
|
rFileName = nil
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
26
|
+
changeDir(iReleaseDir) do
|
27
|
+
# 1. Generate the gemspec that will build the gem
|
28
|
+
lStrHasRDoc = nil
|
29
|
+
if (iReleaseInfo.GemInfo[:HasRDoc])
|
30
|
+
lStrHasRDoc = 'true'
|
31
|
+
else
|
32
|
+
lStrHasRDoc = 'false'
|
33
|
+
end
|
34
|
+
# !!! Don't use absolute paths here, otherwise they will be stored in the Gem
|
35
|
+
lStrFiles = "iSpec.files = [ '#{Dir.glob('**/*').join('\', \'')}' ]"
|
36
|
+
lStrExtraRDocFiles = ''
|
37
|
+
if ((iReleaseInfo.GemInfo[:ExtraRDocFiles] != nil) and
|
38
|
+
(!iReleaseInfo.GemInfo[:ExtraRDocFiles].empty?))
|
39
|
+
lStrExtraRDocFiles = "iSpec.extra_rdoc_files = [ '#{iReleaseInfo.GemInfo[:ExtraRDocFiles].join('\', \'')}' ]"
|
40
|
+
RubyPackager::copyFiles(iRootDir, iReleaseDir, iReleaseInfo.GemInfo[:ExtraRDocFiles])
|
41
|
+
end
|
42
|
+
lGemDepsStrList = []
|
43
|
+
if (iReleaseInfo.GemInfo[:GemDependencies] != nil)
|
44
|
+
iReleaseInfo.GemInfo[:GemDependencies].each do |iGemDepInfo|
|
45
|
+
iGemName, iGemVersion = iGemDepInfo
|
46
|
+
if (iGemVersion != nil)
|
47
|
+
lGemDepsStrList << "iSpec.add_dependency('#{iGemName}', '#{iGemVersion}')"
|
48
|
+
else
|
49
|
+
lGemDepsStrList << "iSpec.add_dependency('#{iGemName}')"
|
50
|
+
end
|
50
51
|
end
|
51
52
|
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
53
|
+
lStrTestFile = ''
|
54
|
+
if ((iIncludeTest) and
|
55
|
+
(iReleaseInfo.GemInfo[:TestFile] != nil))
|
56
|
+
lStrTestFile = "iSpec.test_file = '#{iReleaseInfo.GemInfo[:TestFile]}'"
|
57
|
+
end
|
58
|
+
# Compute the list of executable files and the executable directory
|
59
|
+
lBinError = false
|
60
|
+
lExecutablesDir = nil
|
61
|
+
lExecutablesBase = []
|
62
|
+
iReleaseInfo.ExecutablesInfo.each do |iExecutableInfo|
|
63
|
+
if (lExecutablesDir == nil)
|
64
|
+
lExecutablesDir = File.dirname(iExecutableInfo[:StartupRBFile])
|
65
|
+
elsif (lExecutablesDir != File.dirname(iExecutableInfo[:StartupRBFile]))
|
66
|
+
# Error
|
67
|
+
logErr "Executables should be all in the same directory. \"#{lExecutablesDir}\" and \"#{File.dirname(iExecutableInfo[:StartupRBFile])}\" are different directories."
|
68
|
+
lBinError = true
|
69
|
+
end
|
70
|
+
lExecutablesBase << File.basename(iExecutableInfo[:StartupRBFile])
|
71
|
+
end
|
72
|
+
if (!lBinError)
|
73
|
+
lStrBinDir = ''
|
74
|
+
lStrExecutables = ''
|
75
|
+
if (lExecutablesDir != nil)
|
76
|
+
lStrBinDir = "iSpec.bindir = '#{lExecutablesDir}'"
|
77
|
+
lStrExecutables = "iSpec.executables = #{lExecutablesBase.inspect}"
|
78
|
+
end
|
79
|
+
# Compute require paths
|
80
|
+
lRequirePaths = []
|
81
|
+
if (iReleaseInfo.GemInfo[:RequirePath] != nil)
|
82
|
+
lRequirePaths = [ iReleaseInfo.GemInfo[:RequirePath] ]
|
83
|
+
end
|
84
|
+
if (iReleaseInfo.GemInfo[:RequirePaths] != nil)
|
85
|
+
lRequirePaths.concat(iReleaseInfo.GemInfo[:RequirePaths])
|
86
|
+
end
|
87
|
+
lStrRequirePaths = 'iSpec.require_path = \'\''
|
88
|
+
if (!lRequirePaths.empty?)
|
89
|
+
lStrRequirePaths = "iSpec.require_paths = #{lRequirePaths.inspect}"
|
90
|
+
end
|
91
|
+
lGemSpecFileName = 'release.gemspec.rb'
|
92
|
+
File.open(lGemSpecFileName, 'w') do |oFile|
|
93
|
+
oFile << "
|
66
94
|
Gem::Specification.new do |iSpec|
|
67
95
|
iSpec.name = '#{iReleaseInfo.GemInfo[:GemName]}'
|
68
96
|
iSpec.version = '#{iVersion}'
|
@@ -73,39 +101,45 @@ Gem::Specification.new do |iSpec|
|
|
73
101
|
iSpec.summary = '#{iReleaseInfo.ProjectInfo[:Summary].gsub(/'/,'\\\\\'')}'
|
74
102
|
iSpec.description = '#{iReleaseInfo.ProjectInfo[:Description].gsub(/'/,'\\\\\'')}'
|
75
103
|
#{lStrFiles}
|
76
|
-
|
104
|
+
#{lStrRequirePaths}
|
77
105
|
iSpec.has_rdoc = #{lStrHasRDoc}
|
78
106
|
#{lStrExtraRDocFiles}
|
79
107
|
iSpec.rubyforge_project = '#{iReleaseInfo.RFInfo[:ProjectUnixName]}'
|
80
108
|
#{lStrTestFile}
|
81
109
|
#{lStrBinDir}
|
82
|
-
#{
|
110
|
+
#{lStrExecutables}
|
83
111
|
#{lGemDepsStrList.join("\n")}
|
84
112
|
end
|
85
113
|
"
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
114
|
+
end
|
115
|
+
# 2. Call gem build with this gemspec
|
116
|
+
# Load RubyGems
|
117
|
+
require 'rubygems/command_manager'
|
118
|
+
# Build gem
|
119
|
+
lGemOK = true
|
120
|
+
begin
|
121
|
+
::Gem::CommandManager.instance.find_command('build').invoke(lGemSpecFileName)
|
122
|
+
rescue ::Gem::SystemExitException
|
123
|
+
# For RubyGems, this is normal behaviour: success results in an exception thrown with exit_code 0.
|
124
|
+
if ($!.exit_code != 0)
|
125
|
+
logErr "RubyGems returned error #{$!.exit_code}."
|
126
|
+
lGemOK = false
|
127
|
+
end
|
128
|
+
end
|
129
|
+
File.unlink(lGemSpecFileName)
|
130
|
+
if (lGemOK)
|
131
|
+
# Move the Gem to the destination directory
|
132
|
+
require 'fileutils'
|
133
|
+
# Find the name of the Gem: it can differ depending on the platform
|
134
|
+
rFileName = Dir.glob("#{iReleaseInfo.GemInfo[:GemName]}-#{iVersion}*.gem")[0]
|
135
|
+
if (rFileName == nil)
|
136
|
+
logErr "Unable to find generated gem \"#{iReleaseInfo.GemInfo[:GemName]}-#{iVersion}*.gem\""
|
137
|
+
else
|
138
|
+
FileUtils::mv(rFileName, "#{iInstallerDir}/#{rFileName}")
|
139
|
+
end
|
140
|
+
end
|
99
141
|
end
|
100
142
|
end
|
101
|
-
File.unlink(lGemSpecFileName)
|
102
|
-
if (lGemOK)
|
103
|
-
# Move the Gem to the destination directory
|
104
|
-
require 'fileutils'
|
105
|
-
rFileName = "#{iReleaseInfo.GemInfo[:GemName]}-#{iVersion}.gem"
|
106
|
-
FileUtils::mv(rFileName, "#{iInstallerDir}/#{rFileName}")
|
107
|
-
end
|
108
|
-
Dir.chdir(lOldDir)
|
109
143
|
|
110
144
|
return rFileName
|
111
145
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
2
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
@@ -16,9 +16,9 @@ module RubyPackager
|
|
16
16
|
# map< Symbol, Object >
|
17
17
|
attr_reader :ProjectInfo
|
18
18
|
|
19
|
-
# Information about the
|
20
|
-
# map< Symbol, Object >
|
21
|
-
attr_reader :
|
19
|
+
# Information about the executables
|
20
|
+
# list< map< Symbol, Object > >
|
21
|
+
attr_reader :ExecutablesInfo
|
22
22
|
|
23
23
|
# Information about the installer
|
24
24
|
# map< Symbol, Object >
|
@@ -53,7 +53,7 @@ module RubyPackager
|
|
53
53
|
# This sets also default values
|
54
54
|
@AuthorInfo = {}
|
55
55
|
@ProjectInfo = {}
|
56
|
-
@
|
56
|
+
@ExecutablesInfo = []
|
57
57
|
@InstallInfo = {}
|
58
58
|
@SFInfo = {}
|
59
59
|
@RFInfo = {}
|
@@ -99,7 +99,8 @@ module RubyPackager
|
|
99
99
|
return self
|
100
100
|
end
|
101
101
|
|
102
|
-
# Add executable package properties
|
102
|
+
# Add executable package properties.
|
103
|
+
# This method can be called several times to specify several executables.
|
103
104
|
#
|
104
105
|
# Parameters:
|
105
106
|
# * *iParams* (<em>map<Symbol,Object></em>): The parameters:
|
@@ -110,7 +111,7 @@ module RubyPackager
|
|
110
111
|
# Return:
|
111
112
|
# * _ReleaseInfo_: self
|
112
113
|
def executable(iParams)
|
113
|
-
@
|
114
|
+
@ExecutablesInfo << iParams
|
114
115
|
|
115
116
|
return self
|
116
117
|
end
|
@@ -163,7 +164,8 @@ module RubyPackager
|
|
163
164
|
# * *iParams* (<em>map<Symbol,Object></em>): The parameters:
|
164
165
|
# ** *:GemName* (_String_): The Gem name
|
165
166
|
# ** *:GemPlatformClassName* (_String_): The name of the Gem platform class
|
166
|
-
# ** *:RequirePath* (_String_):
|
167
|
+
# ** *:RequirePath* (_String_): Single path to require
|
168
|
+
# ** *:RequirePaths* (<em>list<String></em>): Paths to require
|
167
169
|
# ** *:HasRDoc* (_String_): Include RDoc in the Gem ?
|
168
170
|
# ** *:ExtraRDocFiles* (<em>list<String></em>): List of file patterns to be included in the RDoc but not in the Gem
|
169
171
|
# ** *:TestFile* (_String_): Name of the test file to execute
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
2
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
@@ -102,7 +102,7 @@ module RubyPackager
|
|
102
102
|
(!@ReleaseInfo.checkReadyForRelease(@RootDir)))
|
103
103
|
rSuccess = false
|
104
104
|
end
|
105
|
-
if (
|
105
|
+
if (!@ReleaseInfo.ExecutablesInfo.empty?)
|
106
106
|
# Check tools for platform dependent considerations
|
107
107
|
if (!@PlatformReleaseInfo.checkExeTools(@RootDir, @IncludeRuby))
|
108
108
|
rSuccess = false
|
@@ -146,7 +146,7 @@ module RubyPackager
|
|
146
146
|
@Installers.each do |iInstallerName|
|
147
147
|
logOp("Create installer #{iInstallerName}") do
|
148
148
|
@PluginsManager.accessPlugin('Installers', iInstallerName) do |ioPlugin|
|
149
|
-
lFileName = ioPlugin.createInstaller(@RootDir, @ReleaseDir, @InstallerDir, @ReleaseVersion, @ReleaseInfo)
|
149
|
+
lFileName = ioPlugin.createInstaller(@RootDir, @ReleaseDir, @InstallerDir, @ReleaseVersion, @ReleaseInfo, @IncludeTest)
|
150
150
|
if (lFileName == nil)
|
151
151
|
rSuccess = false
|
152
152
|
else
|
@@ -217,11 +217,13 @@ module RubyPackager
|
|
217
217
|
"
|
218
218
|
end
|
219
219
|
end
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
220
|
+
@ReleaseInfo.ExecutablesInfo.each do |iExecutableInfo|
|
221
|
+
if (iExecutableInfo[:ExeName] != nil)
|
222
|
+
logOp("Create binary #{iExecutableInfo[:ExeName]}") do
|
223
|
+
# TODO (crate): When crate will work correctly under Windows, use it here to pack everything
|
224
|
+
# For now the executable creation is platform dependent
|
225
|
+
rSuccess = @PlatformReleaseInfo.createBinary(@RootDir, @ReleaseDir, @IncludeRuby, iExecutableInfo)
|
226
|
+
end
|
225
227
|
end
|
226
228
|
end
|
227
229
|
if (rSuccess)
|
@@ -278,16 +280,15 @@ module RubyPackager
|
|
278
280
|
"--output=#{@DocDir}/rdoc"
|
279
281
|
]
|
280
282
|
# Bug (RDoc): Sometimes it does not change current directory correctly (not deterministic)
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
283
|
+
changeDir(@ReleaseDir) do
|
284
|
+
# First try with Muriel's template
|
285
|
+
begin
|
286
|
+
RDoc::RDoc.new.document( lRDocOptions + [ '--fmt=muriel' ] )
|
287
|
+
rescue Exception
|
288
|
+
# Then try with default template
|
289
|
+
RDoc::RDoc.new.document( lRDocOptions )
|
290
|
+
end
|
289
291
|
end
|
290
|
-
Dir.chdir(lOldDir)
|
291
292
|
end
|
292
293
|
|
293
294
|
return rSuccess
|
data/lib/RubyPackager/Tools.rb
CHANGED
@@ -0,0 +1,112 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009-2010 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 cygwin 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
|
+
# * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
|
46
|
+
# Return:
|
47
|
+
# * _Boolean_: Success ?
|
48
|
+
def createBinary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
|
49
|
+
rSuccess = true
|
50
|
+
|
51
|
+
lBinSubDir = "Launch/#{RUBY_PLATFORM}/bin"
|
52
|
+
lRubyBaseBinName = 'ruby'
|
53
|
+
lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
|
54
|
+
if (iIncludeRuby)
|
55
|
+
# First create the binary containing all ruby
|
56
|
+
lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
|
57
|
+
FileUtils::mkdir_p(lBinDir)
|
58
|
+
changeDir(lBinDir) do
|
59
|
+
lCmd = "allinoneruby #{lBinName}"
|
60
|
+
rSuccess = system(lCmd)
|
61
|
+
if (!rSuccess)
|
62
|
+
logErr "Error while executing \"#{lCmd}\""
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
if (rSuccess)
|
67
|
+
# Then create the real executable
|
68
|
+
# Generate the Shell file that launches everything for Linux
|
69
|
+
File.open("#{iReleaseDir}/#{iExecutableInfo[:ExeName]}", 'w') do |oFile|
|
70
|
+
oFile << "\#!/bin/sh
|
71
|
+
\#--
|
72
|
+
\# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
73
|
+
\# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
74
|
+
\#++
|
75
|
+
|
76
|
+
\# This file is generated by RubyPackager for Cygwin.
|
77
|
+
|
78
|
+
\# This file has to launch the correct binary. There can be several binaries dependending on the configuration.
|
79
|
+
\# This is the file that will be created as the executable to launch.
|
80
|
+
|
81
|
+
\# Test Ruby's existence
|
82
|
+
which ruby >/dev/null 2>/dev/null
|
83
|
+
if [ $? == 1 ]
|
84
|
+
then
|
85
|
+
echo 'Ruby not found on current platform. Use embedded one.'
|
86
|
+
if [ ! -d tempruby ]
|
87
|
+
then
|
88
|
+
echo 'Extracting Ruby distribution...'
|
89
|
+
mkdir tempruby
|
90
|
+
cd tempruby
|
91
|
+
../#{lBinSubDir}/#{lBinName} --eee-justextract
|
92
|
+
cd ..
|
93
|
+
fi
|
94
|
+
\# Set the environment correctly to execute Ruby from the extracted dir
|
95
|
+
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}
|
96
|
+
export RUBYOPT=
|
97
|
+
./tempruby/bin/ruby -w #{iExecutableInfo[:StartupRBFile]}
|
98
|
+
else
|
99
|
+
echo 'Ruby found on current platform. Use it directly.'
|
100
|
+
ruby -w #{iExecutableInfo[:StartupRBFile]}
|
101
|
+
fi
|
102
|
+
"
|
103
|
+
end
|
104
|
+
File.chmod(0755, "#{iReleaseDir}/#{iExecutableInfo[:ExeName]}")
|
105
|
+
end
|
106
|
+
|
107
|
+
return rSuccess
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
2
|
+
# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
3
3
|
# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
4
4
|
#++
|
5
5
|
|
@@ -42,39 +42,34 @@ module RubyPackager
|
|
42
42
|
# * *iRootDir* (_String_): Root directory
|
43
43
|
# * *iReleaseDir* (_String_): Release directory
|
44
44
|
# * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
|
45
|
-
# * *
|
45
|
+
# * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
|
46
46
|
# Return:
|
47
47
|
# * _Boolean_: Success ?
|
48
|
-
def createBinary(iRootDir, iReleaseDir, iIncludeRuby,
|
48
|
+
def createBinary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
|
49
49
|
rSuccess = true
|
50
50
|
|
51
51
|
lBinSubDir = "Launch/#{RUBY_PLATFORM}/bin"
|
52
|
-
lRubyBaseBinName = nil
|
53
|
-
lRubyLaunchCmd = nil
|
54
52
|
lRubyBaseBinName = 'ruby'
|
55
|
-
lRubyLaunchCmd = 'ruby'
|
56
53
|
lBinName = "#{lRubyBaseBinName}-#{RUBY_VERSION}.bin"
|
57
54
|
if (iIncludeRuby)
|
58
55
|
# First create the binary containing all ruby
|
59
56
|
lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
|
60
57
|
FileUtils::mkdir_p(lBinDir)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
58
|
+
changeDir(lBinDir) do
|
59
|
+
lCmd = "allinoneruby #{lBinName}"
|
60
|
+
rSuccess = system(lCmd)
|
61
|
+
if (!rSuccess)
|
62
|
+
logErr "Error while executing \"#{lCmd}\""
|
63
|
+
end
|
67
64
|
end
|
68
|
-
Dir.chdir(lOldDir)
|
69
65
|
end
|
70
66
|
if (rSuccess)
|
71
67
|
# Then create the real executable
|
72
68
|
# Generate the Shell file that launches everything for Linux
|
73
|
-
File.open("#{iReleaseDir}/#{
|
74
|
-
oFile << "
|
75
|
-
\#!/bin/sh
|
69
|
+
File.open("#{iReleaseDir}/#{iExecutableInfo[:ExeName]}", 'w') do |oFile|
|
70
|
+
oFile << "\#!/bin/sh
|
76
71
|
\#--
|
77
|
-
\# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
72
|
+
\# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
78
73
|
\# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
79
74
|
\#++
|
80
75
|
|
@@ -99,14 +94,14 @@ then
|
|
99
94
|
\# Set the environment correctly to execute Ruby from the extracted dir
|
100
95
|
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
96
|
export RUBYOPT=
|
102
|
-
./tempruby/bin/ruby -w #{
|
97
|
+
./tempruby/bin/ruby -w #{iExecutableInfo[:StartupRBFile]}
|
103
98
|
else
|
104
99
|
echo 'Ruby found on current platform. Use it directly.'
|
105
|
-
ruby -w #{
|
100
|
+
ruby -w #{iExecutableInfo[:StartupRBFile]}
|
106
101
|
fi
|
107
102
|
"
|
108
103
|
end
|
109
|
-
File.chmod(0755, "#{iReleaseDir}/#{
|
104
|
+
File.chmod(0755, "#{iReleaseDir}/#{iExecutableInfo[:ExeName]}")
|
110
105
|
end
|
111
106
|
|
112
107
|
return rSuccess
|