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.
- 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
- data/ChangeLog +67 -0
- 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
- 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
- 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
- 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
- data/TODO +14 -0
- data/bin/Release.rb +206 -0
- 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
- 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
- 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
- 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
- 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
- data/lib/RubyPackager/i386-linux/PlatformReleaser.rb +117 -0
- 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
- 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
- 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
- data/test/Common.rb +346 -0
- data/test/PlatformIndependent/CommandLine.rb +156 -0
- data/test/PlatformIndependent/Executable.rb +31 -0
- data/test/PlatformIndependent/Library.rb +31 -0
- data/test/PlatformIndependent/Misc.rb +62 -0
- data/test/PlatformIndependent/Plugins/Distributors/SourceForge.rb +81 -0
- data/test/PlatformIndependent/Plugins/Installers/Gem.rb +142 -0
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo.rb +27 -0
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_Exe.rb +33 -0
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_ExeTerm.rb +33 -0
- data/test/Repository/Applications/Basic/Distribution/ReleaseInfo_Gem.rb +32 -0
- 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
- 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
- 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
- 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
- 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
- data/test/Repository/Libraries/Basic/Add.rb +6 -0
- data/test/Repository/Libraries/Basic/Distribution/Icon.ico +0 -0
- data/test/Repository/Libraries/Basic/Distribution/InstallLicense.txt +31 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo.rb +24 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Additional.rb +27 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Gem.rb +29 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_GemDep.rb +32 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_NSIS.rb +28 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_SF.rb +28 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Test.rb +27 -0
- data/test/Repository/Libraries/Basic/Distribution/ReleaseInfo_TestGem.rb +33 -0
- data/test/Repository/Libraries/Basic/Distribution/install.nsi +53 -0
- data/test/Repository/Libraries/Basic/MainLib.rb +6 -0
- data/test/Repository/Libraries/Basic/Test.rb +6 -0
- data/test/i386-linux/Executable.rb +86 -0
- data/test/i386-mswin32/Executable.rb +90 -0
- data/test/i386-mswin32/Plugins/Installers/NSIS.rb +39 -0
- data/test/run.rb +6 -2
- metadata +56 -29
- 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
- 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
- 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
- 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
- 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
- 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
data/test/Common.rb
ADDED
@@ -0,0 +1,346 @@
|
|
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
|
+
require 'fileutils'
|
7
|
+
# Require rUtilAnts and RubyPackager now because we will redefine methods and classes in them.
|
8
|
+
require 'rUtilAnts/Plugins'
|
9
|
+
require 'RubyPackager/Tools'
|
10
|
+
# Mute everything except errors
|
11
|
+
RUtilAnts::Logging::initializeLogging(File.dirname(__FILE__), 'http://sourceforge.net/tracker/?group_id=274236&atid=1165400', true)
|
12
|
+
|
13
|
+
# Bypass the creation of any PluginsManager to include our dummy plugins automatically
|
14
|
+
module RUtilAnts
|
15
|
+
|
16
|
+
module Plugins
|
17
|
+
|
18
|
+
PluginsManager_ORG = PluginsManager
|
19
|
+
remove_const :PluginsManager
|
20
|
+
|
21
|
+
class PluginsManager < PluginsManager_ORG
|
22
|
+
|
23
|
+
# Constructor
|
24
|
+
def initialize
|
25
|
+
super
|
26
|
+
# Add dummy Installers and Distributors
|
27
|
+
registerNewPlugin('Installers', 'DummyInstaller1', nil, nil, 'RubyPackager::Test::Common::DummyInstaller1', nil)
|
28
|
+
registerNewPlugin('Installers', 'DummyInstaller2', nil, nil, 'RubyPackager::Test::Common::DummyInstaller2', nil)
|
29
|
+
registerNewPlugin('Distributors', 'DummyDistributor1', nil, nil, 'RubyPackager::Test::Common::DummyDistributor1', nil)
|
30
|
+
registerNewPlugin('Distributors', 'DummyDistributor2', nil, nil, 'RubyPackager::Test::Common::DummyDistributor2', nil)
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
module RubyPackager
|
40
|
+
|
41
|
+
# Redefine some functions used to communicate with external sites
|
42
|
+
module Tools
|
43
|
+
|
44
|
+
remove_method :sshWithPassword
|
45
|
+
|
46
|
+
# Execute some SSH command on a remote host protected with password
|
47
|
+
#
|
48
|
+
# Parameters:
|
49
|
+
# * *iSSHHost* (_String_): The SSH host
|
50
|
+
# * *iSSHLogin* (_String_): The SSH login
|
51
|
+
# * *iCmd* (_String_): The command to execute
|
52
|
+
def sshWithPassword(iSSHHost, iSSHLogin, iCmd)
|
53
|
+
$SSHCommands << [ 'SSH', {
|
54
|
+
:Host => iSSHHost,
|
55
|
+
:Login => iSSHLogin,
|
56
|
+
:Cmd => iCmd
|
57
|
+
} ]
|
58
|
+
end
|
59
|
+
|
60
|
+
remove_method :scpWithPassword
|
61
|
+
|
62
|
+
# Copy files through SCP.
|
63
|
+
#
|
64
|
+
# Parameters:
|
65
|
+
# * *iSCPHost* (_String_): Host
|
66
|
+
# * *iSCPLogin* (_String_): Login
|
67
|
+
# * *iFileSrc* (_String_): Path to local file to copy from
|
68
|
+
# * *iFileDst* (_String_): Path to remote file to copy to
|
69
|
+
def scpWithPassword(iSCPHost, iSCPLogin, iFileSrc, iFileDst)
|
70
|
+
$SSHCommands << [ 'SCP', {
|
71
|
+
:Host => iSCPHost,
|
72
|
+
:Login => iSCPLogin,
|
73
|
+
:FileSrc => iFileSrc,
|
74
|
+
:FileDst => iFileDst
|
75
|
+
} ]
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
module Test
|
81
|
+
|
82
|
+
module Common
|
83
|
+
|
84
|
+
class DummyInstaller1
|
85
|
+
# Create the installer with everything in the release directory.
|
86
|
+
#
|
87
|
+
# Parameters:
|
88
|
+
# * *iRootDir* (_String_): The Root directory
|
89
|
+
# * *iReleaseDir* (_String_): The release directory (all files to put in the installer are there)
|
90
|
+
# * *iInstallerDir* (_String_): The directory where the installer has to be put
|
91
|
+
# * *iVersion* (_String_): Release version
|
92
|
+
# * *iReleaseInfo* (_ReleaseInfo_): Release info
|
93
|
+
# Return:
|
94
|
+
# * _String_: File name to distribute, or nil in case of failure
|
95
|
+
def createInstaller(iRootDir, iReleaseDir, iInstallerDir, iVersion, iReleaseInfo)
|
96
|
+
rFileName = nil
|
97
|
+
|
98
|
+
Dir.glob("#{iReleaseDir}/*").each do |iFileName|
|
99
|
+
rFileName = "#{File.basename(iFileName)}.Installer1"
|
100
|
+
require 'fileutils'
|
101
|
+
FileUtils::cp(iFileName, "#{iInstallerDir}/#{rFileName}")
|
102
|
+
break
|
103
|
+
end
|
104
|
+
|
105
|
+
return rFileName
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
class DummyInstaller2
|
111
|
+
# Create the installer with everything in the release directory.
|
112
|
+
#
|
113
|
+
# Parameters:
|
114
|
+
# * *iRootDir* (_String_): The Root directory
|
115
|
+
# * *iReleaseDir* (_String_): The release directory (all files to put in the installer are there)
|
116
|
+
# * *iInstallerDir* (_String_): The directory where the installer has to be put
|
117
|
+
# * *iVersion* (_String_): Release version
|
118
|
+
# * *iReleaseInfo* (_ReleaseInfo_): Release info
|
119
|
+
# Return:
|
120
|
+
# * _String_: File name to distribute, or nil in case of failure
|
121
|
+
def createInstaller(iRootDir, iReleaseDir, iInstallerDir, iVersion, iReleaseInfo)
|
122
|
+
rFileName = nil
|
123
|
+
|
124
|
+
Dir.glob("#{iReleaseDir}/*").each do |iFileName|
|
125
|
+
rFileName = "#{File.basename(iFileName)}.Installer2"
|
126
|
+
require 'fileutils'
|
127
|
+
FileUtils::cp(iFileName, "#{iInstallerDir}/#{rFileName}")
|
128
|
+
break
|
129
|
+
end
|
130
|
+
|
131
|
+
return rFileName
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
class DummyDistributor1
|
137
|
+
|
138
|
+
def initialize
|
139
|
+
$Distributed1 = {}
|
140
|
+
end
|
141
|
+
|
142
|
+
# Distribute what has been generated
|
143
|
+
#
|
144
|
+
# Parameters:
|
145
|
+
# * *iInstallerDir* (_String_): Directory where installers are generated
|
146
|
+
# * *iReleaseVersion* (_String_): Release version
|
147
|
+
# * *iReleaseInfo* (_ReleaseInfo_): Release info
|
148
|
+
# * *iGeneratedFileNames* (<em>list<String></em>): List of files to distribute
|
149
|
+
# * *iDocDir* (_String_): Directory where the documentation has been generated
|
150
|
+
# Return:
|
151
|
+
# * _Boolean_: Success ?
|
152
|
+
def distribute(iInstallerDir, iReleaseVersion, iReleaseInfo, iGeneratedFileNames, iDocDir)
|
153
|
+
rSuccess = true
|
154
|
+
|
155
|
+
iGeneratedFileNames.each do |iFileName|
|
156
|
+
$Distributed1[File.basename(iFileName)] = nil
|
157
|
+
end
|
158
|
+
|
159
|
+
return rSuccess
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
class DummyDistributor2
|
165
|
+
|
166
|
+
def initialize
|
167
|
+
$Distributed2 = {}
|
168
|
+
end
|
169
|
+
|
170
|
+
# Distribute what has been generated
|
171
|
+
#
|
172
|
+
# Parameters:
|
173
|
+
# * *iInstallerDir* (_String_): Directory where installers are generated
|
174
|
+
# * *iReleaseVersion* (_String_): Release version
|
175
|
+
# * *iReleaseInfo* (_ReleaseInfo_): Release info
|
176
|
+
# * *iGeneratedFileNames* (<em>list<String></em>): List of files to distribute
|
177
|
+
# * *iDocDir* (_String_): Directory where the documentation has been generated
|
178
|
+
# Return:
|
179
|
+
# * _Boolean_: Success ?
|
180
|
+
def distribute(iInstallerDir, iReleaseVersion, iReleaseInfo, iGeneratedFileNames, iDocDir)
|
181
|
+
rSuccess = true
|
182
|
+
|
183
|
+
iGeneratedFileNames.each do |iFileName|
|
184
|
+
$Distributed2[File.basename(iFileName)] = nil
|
185
|
+
end
|
186
|
+
|
187
|
+
return rSuccess
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
# Execute a test
|
193
|
+
#
|
194
|
+
# Parameters:
|
195
|
+
# * *iRepositoryName* (_String_): Name of the repository for the test
|
196
|
+
# * *iArguments* (<em>list<String></em>): List of arguments to give to RubyPackager (except the release file)
|
197
|
+
# * *iReleaseFileName* (_String_): Name of the release file, relatively to the Distribution directory of the application
|
198
|
+
# * *iParams* (<em>map<Symbol,Object></em>): Additional parameters [optional = {}]
|
199
|
+
# ** *:IncludeRDoc* (_Boolean_): Do we generate RDoc ? [optional = false]
|
200
|
+
# * _CodeBlock_: The code called once the released has been made
|
201
|
+
# ** *iReleaseDir* (_String_): The directory in which the release has been made
|
202
|
+
# ** *iReleaseInfo* (<em>RubyPackager::ReleaseInfo</em>): The release info read
|
203
|
+
def execTest(iRepositoryName, iArguments, iReleaseInfoFileName, iParams = {})
|
204
|
+
lIncludeRDoc = iParams[:IncludeRDoc]
|
205
|
+
if (lIncludeRDoc == nil)
|
206
|
+
lIncludeRDoc = false
|
207
|
+
end
|
208
|
+
# Reset variables that will be used by dummy Distributors
|
209
|
+
# The list of commands SSH/SCP issued, along with their parameters
|
210
|
+
# list< [ String, map< Symbol, Object > ] >
|
211
|
+
# list< [ CommandName, map< AttributeName, Value > ] >
|
212
|
+
$SSHCommands = []
|
213
|
+
# Go to the application directory
|
214
|
+
lOldDir = Dir.getwd
|
215
|
+
lAppDir = File.expand_path("#{File.dirname(__FILE__)}/Repository/#{iRepositoryName}")
|
216
|
+
Dir.chdir(lAppDir)
|
217
|
+
# Clean the Releases dir if it exists already
|
218
|
+
FileUtils::rm_rf("#{lAppDir}/Releases")
|
219
|
+
# Launch everything
|
220
|
+
lRealReleaseInfoFileName = "Distribution/#{iReleaseInfoFileName}"
|
221
|
+
lSuccess = nil
|
222
|
+
if (lIncludeRDoc)
|
223
|
+
lSuccess = RubyPackager::Launcher.new.run(iArguments + [ lRealReleaseInfoFileName ])
|
224
|
+
else
|
225
|
+
lSuccess = RubyPackager::Launcher.new.run(iArguments + [ '--no-rdoc', lRealReleaseInfoFileName ])
|
226
|
+
end
|
227
|
+
Dir.chdir(lOldDir)
|
228
|
+
# Check if everything is ok
|
229
|
+
assert(lSuccess)
|
230
|
+
# Get the name of the directory
|
231
|
+
lDirs = Dir.glob("#{lAppDir}/Releases/#{RUBY_PLATFORM}/*/*/*")
|
232
|
+
assert_equal(1, lDirs.size)
|
233
|
+
lReleaseDir = lDirs[0]
|
234
|
+
# Read the release info
|
235
|
+
lReleaseInfo = nil
|
236
|
+
File.open("#{lAppDir}/#{lRealReleaseInfoFileName}", 'r') do |iFile|
|
237
|
+
lReleaseInfo = eval(iFile.read)
|
238
|
+
end
|
239
|
+
assert(lReleaseInfo.kind_of?(RubyPackager::ReleaseInfo))
|
240
|
+
yield(lReleaseDir, lReleaseInfo)
|
241
|
+
# Clean the Releases dir
|
242
|
+
FileUtils::rm_rf("#{lAppDir}/Releases")
|
243
|
+
end
|
244
|
+
|
245
|
+
# Check content of a released ReleaseInfo file
|
246
|
+
#
|
247
|
+
# Parameters:
|
248
|
+
# * *iReleaseDir* (_String_): The directory of the release
|
249
|
+
# * *iReleaseInfo* (<em>RubyPackager::ReleaseInfo</em>): The release info used by the release
|
250
|
+
# * *iParams* (<em>map<Symbol,Object></em>): Additional parameters:
|
251
|
+
# ** *:Version* (_String_): The version [optional = 'UnnamedVersion']
|
252
|
+
# ** *:Tags* (<em>list<String></em>): List of Tags [optional = []]
|
253
|
+
def checkReleaseInfo(iReleaseDir, iReleaseInfo, iParams = {})
|
254
|
+
lVersion = iParams[:Version]
|
255
|
+
if (lVersion == nil)
|
256
|
+
lVersion = 'UnnamedVersion'
|
257
|
+
end
|
258
|
+
lTags = iParams[:Tags]
|
259
|
+
if (lTags == nil)
|
260
|
+
lTags = []
|
261
|
+
end
|
262
|
+
assert(File.exists?("#{iReleaseDir}/Release/ReleaseInfo"))
|
263
|
+
lReleasedInfo = nil
|
264
|
+
File.open("#{iReleaseDir}/Release/ReleaseInfo", 'r') do |iFile|
|
265
|
+
lReleasedInfo = eval(iFile.read)
|
266
|
+
end
|
267
|
+
assert(lReleasedInfo.kind_of?(Hash))
|
268
|
+
assert_equal(lVersion, lReleasedInfo[:Version])
|
269
|
+
assert_equal(lTags, lReleasedInfo[:Tags])
|
270
|
+
assert_equal('Project:DevStatus', lReleasedInfo[:DevStatus])
|
271
|
+
end
|
272
|
+
|
273
|
+
# Check generated RDoc
|
274
|
+
#
|
275
|
+
# Parameters:
|
276
|
+
# * *iReleaseDir* (_String_): The directory of the release
|
277
|
+
# * *iReleaseInfo* (<em>RubyPackager::ReleaseInfo</em>): The release info used by the release
|
278
|
+
def checkRDoc(iReleaseDir, iReleaseInfo)
|
279
|
+
assert(File.exists?("#{iReleaseDir}/Documentation/rdoc/index.html"))
|
280
|
+
end
|
281
|
+
|
282
|
+
# Check generated release notes
|
283
|
+
#
|
284
|
+
# Parameters:
|
285
|
+
# * *iReleaseDir* (_String_): The directory of the release
|
286
|
+
# * *iReleaseInfo* (<em>RubyPackager::ReleaseInfo</em>): The release info used by the release
|
287
|
+
def checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
288
|
+
assert(File.exists?("#{iReleaseDir}/Documentation/ReleaseNote.html"))
|
289
|
+
assert(File.exists?("#{iReleaseDir}/Documentation/ReleaseNote.txt"))
|
290
|
+
end
|
291
|
+
|
292
|
+
# Run a generated executable and get its output
|
293
|
+
#
|
294
|
+
# Parameters:
|
295
|
+
# * *iFileName* (_String_): The file name to execute
|
296
|
+
# Return:
|
297
|
+
# * _String_: The output
|
298
|
+
def runExe(lExeFileName)
|
299
|
+
rOutput = nil
|
300
|
+
|
301
|
+
lOldDir = Dir.getwd
|
302
|
+
Dir.chdir(File.dirname(lExeFileName))
|
303
|
+
begin
|
304
|
+
begin
|
305
|
+
# TODO: Bug ???: On Linux, we need to "cd ." before, otherwise the executable is not found. Understand why and remove it.
|
306
|
+
rOutput = `cd .;#{File.basename(lExeFileName)}`
|
307
|
+
rescue Exception
|
308
|
+
assert(false)
|
309
|
+
end
|
310
|
+
rescue Exception
|
311
|
+
Dir.chdir(lOldDir)
|
312
|
+
raise
|
313
|
+
end
|
314
|
+
Dir.chdir(lOldDir)
|
315
|
+
|
316
|
+
return rOutput
|
317
|
+
end
|
318
|
+
|
319
|
+
# Get the gem specification corresponding to a given gem file
|
320
|
+
#
|
321
|
+
# Parameters:
|
322
|
+
# * *iGemFileName* (_String_): Name of the Gem file
|
323
|
+
# Return:
|
324
|
+
# * <em>Gem::Specification</em>: The corresponding Gem specification
|
325
|
+
def getGemSpec(iGemFileName)
|
326
|
+
rGemSpec = nil
|
327
|
+
|
328
|
+
lOldDir = Dir.getwd
|
329
|
+
Dir.chdir(File.dirname(iGemFileName))
|
330
|
+
require 'rubygems'
|
331
|
+
# TODO: Bug (Ruby): Remove this test when Ruby will be able to deal .bat files correctly.
|
332
|
+
if (RUBY_PLATFORM == 'i386-mswin32')
|
333
|
+
rGemSpec = eval(`gem.bat specification #{File.basename(iGemFileName)} --ruby`.gsub(/Gem::/,'::Gem::'))
|
334
|
+
else
|
335
|
+
rGemSpec = eval(`gem specification #{File.basename(iGemFileName)} --ruby`.gsub(/Gem::/,'::Gem::'))
|
336
|
+
end
|
337
|
+
Dir.chdir(lOldDir)
|
338
|
+
|
339
|
+
return rGemSpec
|
340
|
+
end
|
341
|
+
|
342
|
+
end
|
343
|
+
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
@@ -0,0 +1,156 @@
|
|
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 Test
|
9
|
+
|
10
|
+
module PlatformIndependent
|
11
|
+
|
12
|
+
class CommandLine < ::Test::Unit::TestCase
|
13
|
+
|
14
|
+
include RubyPackager::Test::Common
|
15
|
+
|
16
|
+
# Test release a specific version
|
17
|
+
def testVersion
|
18
|
+
execTest('Libraries/Basic', [ '-v', '0.0.1.20091030' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
19
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo, :Version => '0.0.1.20091030')
|
20
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
21
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Test release a specific version (long version)
|
26
|
+
def testVersionLong
|
27
|
+
execTest('Libraries/Basic', [ '--version=0.0.1.20091030' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
28
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo, :Version => '0.0.1.20091030')
|
29
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
30
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Test release with Tags
|
35
|
+
def testTags
|
36
|
+
execTest('Libraries/Basic', [ '-t', 'Tag1', '-t', 'Tag2' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
37
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo, :Tags => ['Tag1', 'Tag2'] )
|
38
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
39
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# Test release with Tags (long version)
|
44
|
+
def testTagsLong
|
45
|
+
execTest('Libraries/Basic', [ '--tag=Tag1', '--tag=Tag2' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
46
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo, :Tags => ['Tag1', 'Tag2'] )
|
47
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
48
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Test release with Comments
|
53
|
+
def testComment
|
54
|
+
execTest('Libraries/Basic', [ '-c', 'Comment' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
55
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
56
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
57
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Test release with Comments (long version)
|
62
|
+
def testCommentLong
|
63
|
+
execTest('Libraries/Basic', [ '--comment=Comment' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
64
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
65
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
66
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Test release with Test files
|
71
|
+
def testTest
|
72
|
+
execTest('Libraries/Basic', [ '-n' ], 'ReleaseInfo_Test.rb') do |iReleaseDir, iReleaseInfo|
|
73
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
74
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
75
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
76
|
+
assert(File.exists?("#{iReleaseDir}/Release/Test.rb"))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Test release with Test files (long version)
|
81
|
+
def testTestLong
|
82
|
+
execTest('Libraries/Basic', [ '--includeTest' ], 'ReleaseInfo_Test.rb') do |iReleaseDir, iReleaseInfo|
|
83
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
84
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
85
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
86
|
+
assert(File.exists?("#{iReleaseDir}/Release/Test.rb"))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Test release with Installers
|
91
|
+
def testInstallers
|
92
|
+
execTest('Libraries/Basic', [ '-i', 'DummyInstaller1', '-i', 'DummyInstaller2' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
93
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
94
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
95
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
96
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer1"))
|
97
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer2"))
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Test release with Installers (long version)
|
102
|
+
def testInstallersLong
|
103
|
+
execTest('Libraries/Basic', [ '--installer=DummyInstaller1', '--installer=DummyInstaller2' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
104
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
105
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
106
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
107
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer1"))
|
108
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer2"))
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# Test release with Distributors
|
113
|
+
def testDistributors
|
114
|
+
execTest('Libraries/Basic', [ '-i', 'DummyInstaller1', '-i', 'DummyInstaller2', '-d', 'DummyDistributor1', '-d', 'DummyDistributor2' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
115
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
116
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
117
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
118
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer1"))
|
119
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer2"))
|
120
|
+
assert($Distributed1 != nil)
|
121
|
+
assert_equal(2, $Distributed1.size)
|
122
|
+
assert($Distributed1.has_key?('MainLib.rb.Installer1'))
|
123
|
+
assert($Distributed1.has_key?('MainLib.rb.Installer2'))
|
124
|
+
assert($Distributed2 != nil)
|
125
|
+
assert_equal(2, $Distributed2.size)
|
126
|
+
assert($Distributed2.has_key?('MainLib.rb.Installer1'))
|
127
|
+
assert($Distributed2.has_key?('MainLib.rb.Installer2'))
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Test release with Distributors (long version)
|
132
|
+
def testDistributorsLong
|
133
|
+
execTest('Libraries/Basic', [ '-i', 'DummyInstaller1', '-i', 'DummyInstaller2', '--distributor=DummyDistributor1', '--distributor=DummyDistributor2' ], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
134
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
135
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
136
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
137
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer1"))
|
138
|
+
assert(File.exists?("#{iReleaseDir}/Installer/MainLib.rb.Installer2"))
|
139
|
+
assert($Distributed1 != nil)
|
140
|
+
assert_equal(2, $Distributed1.size)
|
141
|
+
assert($Distributed1.has_key?('MainLib.rb.Installer1'))
|
142
|
+
assert($Distributed1.has_key?('MainLib.rb.Installer2'))
|
143
|
+
assert($Distributed2 != nil)
|
144
|
+
assert_equal(2, $Distributed2.size)
|
145
|
+
assert($Distributed2.has_key?('MainLib.rb.Installer1'))
|
146
|
+
assert($Distributed2.has_key?('MainLib.rb.Installer2'))
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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 Test
|
9
|
+
|
10
|
+
module PlatformIndependent
|
11
|
+
|
12
|
+
class Executable < ::Test::Unit::TestCase
|
13
|
+
|
14
|
+
include RubyPackager::Test::Common
|
15
|
+
|
16
|
+
# Test the basic usage
|
17
|
+
def testBasicExecutable
|
18
|
+
execTest('Applications/Basic', [], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
19
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
20
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
21
|
+
assert(File.exists?("#{iReleaseDir}/Release/Main.rb"))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
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 Test
|
9
|
+
|
10
|
+
module PlatformIndependent
|
11
|
+
|
12
|
+
class Library < ::Test::Unit::TestCase
|
13
|
+
|
14
|
+
include RubyPackager::Test::Common
|
15
|
+
|
16
|
+
# Test the basic usage
|
17
|
+
def testBasicLib
|
18
|
+
execTest('Libraries/Basic', [], 'ReleaseInfo.rb') do |iReleaseDir, iReleaseInfo|
|
19
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
20
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
21
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,62 @@
|
|
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 Test
|
9
|
+
|
10
|
+
module PlatformIndependent
|
11
|
+
|
12
|
+
class Misc < ::Test::Unit::TestCase
|
13
|
+
|
14
|
+
include RubyPackager::Test::Common
|
15
|
+
|
16
|
+
# Test release without Test files
|
17
|
+
def testWithoutTest
|
18
|
+
execTest('Libraries/Basic', [], 'ReleaseInfo_Test.rb') do |iReleaseDir, iReleaseInfo|
|
19
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
20
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
21
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
22
|
+
assert(!File.exists?("#{iReleaseDir}/Release/Test.rb"))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Test release with Test files
|
27
|
+
def testWithTest
|
28
|
+
execTest('Libraries/Basic', [ '-n' ], 'ReleaseInfo_Test.rb') do |iReleaseDir, iReleaseInfo|
|
29
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
30
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
31
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
32
|
+
assert(File.exists?("#{iReleaseDir}/Release/Test.rb"))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Test release with Additional files
|
37
|
+
def testWithAdditional
|
38
|
+
execTest('Libraries/Basic', [], 'ReleaseInfo_Additional.rb') do |iReleaseDir, iReleaseInfo|
|
39
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
40
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
41
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
42
|
+
assert(File.exists?("#{iReleaseDir}/Release/Add.rb"))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Test release with RDoc
|
47
|
+
def testWithRDoc
|
48
|
+
execTest('Libraries/Basic', [], 'ReleaseInfo.rb', :IncludeRDoc => true) do |iReleaseDir, iReleaseInfo|
|
49
|
+
checkReleaseInfo(iReleaseDir, iReleaseInfo)
|
50
|
+
checkReleaseNotes(iReleaseDir, iReleaseInfo)
|
51
|
+
checkRDoc(iReleaseDir, iReleaseInfo)
|
52
|
+
assert(File.exists?("#{iReleaseDir}/Release/MainLib.rb"))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|