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
@@ -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
|
|
@@ -52,16 +52,16 @@ module RubyPackager
|
|
52
52
|
# * *iRootDir* (_String_): Root directory
|
53
53
|
# * *iReleaseDir* (_String_): Release directory
|
54
54
|
# * *iIncludeRuby* (_Boolean_): Do we include Ruby in the release ?
|
55
|
-
# * *
|
55
|
+
# * *iExecutableInfo* (<em>map<Symbol,Object></em>): The executable information
|
56
56
|
# Return:
|
57
57
|
# * _Boolean_: Success ?
|
58
|
-
def createBinary(iRootDir, iReleaseDir, iIncludeRuby,
|
58
|
+
def createBinary(iRootDir, iReleaseDir, iIncludeRuby, iExecutableInfo)
|
59
59
|
rSuccess = true
|
60
60
|
|
61
61
|
lBinSubDir = "Launch/#{RUBY_PLATFORM}/bin"
|
62
62
|
lRubyBaseBinName = nil
|
63
63
|
lRubyLaunchCmd = nil
|
64
|
-
if (
|
64
|
+
if (iExecutableInfo[:TerminalApplication])
|
65
65
|
lRubyBaseBinName = 'ruby'
|
66
66
|
lRubyLaunchCmd = 'ruby'
|
67
67
|
else
|
@@ -73,19 +73,18 @@ module RubyPackager
|
|
73
73
|
# First create the binary containing all ruby
|
74
74
|
lBinDir = "#{iReleaseDir}/#{lBinSubDir}"
|
75
75
|
FileUtils::mkdir_p(lBinDir)
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
76
|
+
changeDir(lBinDir) do
|
77
|
+
lCmd = nil
|
78
|
+
if (iExecutableInfo[:TerminalApplication])
|
79
|
+
lCmd = "allinoneruby.bat #{lBinName}"
|
80
|
+
else
|
81
|
+
lCmd = "allinoneruby.bat --rubyw #{lBinName}"
|
82
|
+
end
|
83
|
+
rSuccess = system(lCmd)
|
84
|
+
if (!rSuccess)
|
85
|
+
logErr "Error while executing \"#{lCmd}\""
|
86
|
+
end
|
87
87
|
end
|
88
|
-
Dir.chdir(lOldDir)
|
89
88
|
end
|
90
89
|
if (rSuccess)
|
91
90
|
# Then create the real executable
|
@@ -94,7 +93,7 @@ module RubyPackager
|
|
94
93
|
File.open(lTempFileName, 'w') do |oFile|
|
95
94
|
oFile << "
|
96
95
|
\#--
|
97
|
-
\# Copyright (c) 2009 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
96
|
+
\# Copyright (c) 2009-2010 Muriel Salvan (murielsalvan@users.sourceforge.net)
|
98
97
|
\# Licensed under the terms specified in LICENSE file. No warranty is provided.
|
99
98
|
\#++
|
100
99
|
|
@@ -131,12 +130,12 @@ lCurrentDir = Dir.getwd
|
|
131
130
|
if (system('#{lRubyBaseBinName} --version'))
|
132
131
|
\# Launch directly
|
133
132
|
puts \"Ruby found in environment. Using it directly.\"
|
134
|
-
lSuccess = RubyPackager::shellExecute(\"#{lRubyLaunchCmd} -w \\\"\#{lCurrentDir}/#{
|
133
|
+
lSuccess = RubyPackager::shellExecute(\"#{lRubyLaunchCmd} -w \\\"\#{lCurrentDir}/#{iExecutableInfo[:StartupRBFile]}\\\" \#{ARGV.join(' ')}\")
|
135
134
|
end
|
136
135
|
if (!lSuccess)
|
137
136
|
\# Use allinoneruby
|
138
137
|
puts \"Ruby not found in environment. Using shipped Ruby.\"
|
139
|
-
lSuccess = RubyPackager::shellExecute(\"start \\\"Title\\\" \\\"\#{lCurrentDir}/#{lBinSubDir}/#{lBinName}\\\" \\\"\#{lCurrentDir}/#{
|
138
|
+
lSuccess = RubyPackager::shellExecute(\"start \\\"Title\\\" \\\"\#{lCurrentDir}/#{lBinSubDir}/#{lBinName}\\\" \\\"\#{lCurrentDir}/#{iExecutableInfo[:StartupRBFile]}\\\" \#{ARGV.join(' ')}\")
|
140
139
|
if (!lSuccess)
|
141
140
|
puts 'Unable to execute the application. Please reinstall it.'
|
142
141
|
puts 'Hit enter to quit.'
|
@@ -145,20 +144,19 @@ if (!lSuccess)
|
|
145
144
|
end
|
146
145
|
"
|
147
146
|
end
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
Dir.chdir(lOldDir)
|
147
|
+
changeDir(iReleaseDir) do
|
148
|
+
rSuccess = system("exerb.bat -o #{iExecutableInfo[:ExeName]}.exe #{lTempFileName}")
|
149
|
+
end
|
152
150
|
if (rSuccess)
|
153
151
|
File.unlink(lTempFileName)
|
154
152
|
# And set its icon
|
155
|
-
lEdiconCmd = "#{PLATFORM_DIR}/edicon/edicon.exe #{iReleaseDir}/#{
|
153
|
+
lEdiconCmd = "#{PLATFORM_DIR}/edicon/edicon.exe #{iReleaseDir}/#{iExecutableInfo[:ExeName]}.exe #{iRootDir}/#{iExecutableInfo[:IconName]}"
|
156
154
|
rSuccess = system(lEdiconCmd)
|
157
155
|
if (!rSuccess)
|
158
156
|
logErr "Error while executing \"#{lEdiconCmd}\""
|
159
157
|
end
|
160
158
|
else
|
161
|
-
logErr "Error while executing \"exerb.bat -o #{
|
159
|
+
logErr "Error while executing \"exerb.bat -o #{iExecutableInfo[:ExeName]}.exe #{lTempFileName}\""
|
162
160
|
end
|
163
161
|
end
|
164
162
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: RubyPackager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 1
|
9
|
+
- 20101110
|
10
|
+
version: 0.2.1.20101110
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Muriel Salvan
|
@@ -9,19 +15,22 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-11-10 00:00:00 +01:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: rUtilAnts
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 1
|
23
31
|
version: "0.1"
|
24
|
-
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
25
34
|
description: Generate installable binary distributions of Ruby programs for many platforms (many OS, with or without Ruby installed on clients...). Fit to distribute extensible (plugins) Ruby programs also. Handles also libraries and uploads on websites (SF.net...).
|
26
35
|
email: murielsalvan@users.sourceforge.net
|
27
36
|
executables:
|
@@ -31,57 +40,24 @@ extensions: []
|
|
31
40
|
extra_rdoc_files: []
|
32
41
|
|
33
42
|
files:
|
34
|
-
- ReleaseInfo
|
35
|
-
- README
|
36
|
-
- LICENSE
|
37
43
|
- AUTHORS
|
38
|
-
-
|
39
|
-
- TODO
|
44
|
+
- bin/Release.rb
|
40
45
|
- ChangeLog
|
41
|
-
-
|
42
|
-
- lib/RubyPackager/
|
43
|
-
- lib/RubyPackager/
|
46
|
+
- Credits
|
47
|
+
- lib/RubyPackager/Distributors/SourceForge.rb
|
48
|
+
- lib/RubyPackager/i386-cygwin/PlatformReleaser.rb
|
44
49
|
- lib/RubyPackager/i386-linux/PlatformReleaser.rb
|
45
|
-
- lib/RubyPackager/i386-mswin32/PlatformReleaser.rb
|
46
50
|
- lib/RubyPackager/i386-mswin32/edicon/edicon.exe
|
47
51
|
- lib/RubyPackager/i386-mswin32/Installers/NSIS.rb
|
52
|
+
- lib/RubyPackager/i386-mswin32/PlatformReleaser.rb
|
48
53
|
- lib/RubyPackager/Installers/Gem.rb
|
49
|
-
- lib/RubyPackager/
|
50
|
-
-
|
51
|
-
-
|
52
|
-
-
|
53
|
-
-
|
54
|
-
-
|
55
|
-
-
|
56
|
-
- test/Repository/Applications/Basic/Main.rb
|
57
|
-
- test/Repository/Applications/Basic/Distribution/ReleaseInfo.rb
|
58
|
-
- test/Repository/Applications/Basic/Distribution/ReleaseInfo_Exe.rb
|
59
|
-
- test/Repository/Applications/Basic/Distribution/ReleaseInfo_Gem.rb
|
60
|
-
- test/Repository/Applications/Basic/Distribution/ReleaseInfo_ExeTerm.rb
|
61
|
-
- test/Repository/Applications/Basic/Distribution/i386-mswin32/Icon.ico
|
62
|
-
- test/Repository/Applications/Basic/Distribution/i386-mswin32/Installer/Icon.ico
|
63
|
-
- test/Repository/Applications/Basic/Distribution/i386-mswin32/Installer/InstallLicense.txt
|
64
|
-
- test/Repository/Applications/Basic/Distribution/i386-mswin32/Installer/install.nsi
|
65
|
-
- test/Repository/Libraries/Basic/MainLib.rb
|
66
|
-
- test/Repository/Libraries/Basic/Test.rb
|
67
|
-
- test/Repository/Libraries/Basic/Add.rb
|
68
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo.rb
|
69
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Test.rb
|
70
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Additional.rb
|
71
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_Gem.rb
|
72
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_GemDep.rb
|
73
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_NSIS.rb
|
74
|
-
- test/Repository/Libraries/Basic/Distribution/install.nsi
|
75
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_TestGem.rb
|
76
|
-
- test/Repository/Libraries/Basic/Distribution/Icon.ico
|
77
|
-
- test/Repository/Libraries/Basic/Distribution/InstallLicense.txt
|
78
|
-
- test/Repository/Libraries/Basic/Distribution/ReleaseInfo_SF.rb
|
79
|
-
- test/PlatformIndependent/Library.rb
|
80
|
-
- test/PlatformIndependent/Executable.rb
|
81
|
-
- test/PlatformIndependent/CommandLine.rb
|
82
|
-
- test/PlatformIndependent/Misc.rb
|
83
|
-
- test/PlatformIndependent/Plugins/Installers/Gem.rb
|
84
|
-
- test/PlatformIndependent/Plugins/Distributors/SourceForge.rb
|
54
|
+
- lib/RubyPackager/ReleaseInfo.rb
|
55
|
+
- lib/RubyPackager/Releaser.rb
|
56
|
+
- lib/RubyPackager/Tools.rb
|
57
|
+
- LICENSE
|
58
|
+
- README
|
59
|
+
- ReleaseInfo
|
60
|
+
- TODO
|
85
61
|
has_rdoc: true
|
86
62
|
homepage: http://rubypackager.sourceforge.net/
|
87
63
|
licenses: []
|
@@ -95,20 +71,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
71
|
requirements:
|
96
72
|
- - ">="
|
97
73
|
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 0
|
98
76
|
version: "0"
|
99
|
-
version:
|
100
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
78
|
requirements:
|
102
79
|
- - ">="
|
103
80
|
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
104
83
|
version: "0"
|
105
|
-
version:
|
106
84
|
requirements: []
|
107
85
|
|
108
86
|
rubyforge_project: rubypackager
|
109
|
-
rubygems_version: 1.3.
|
87
|
+
rubygems_version: 1.3.6
|
110
88
|
signing_key:
|
111
89
|
specification_version: 3
|
112
90
|
summary: Solution to release Ruby programs on any platform.
|
113
|
-
test_files:
|
114
|
-
|
91
|
+
test_files: []
|
92
|
+
|
data/test/Common.rb
DELETED
@@ -1,346 +0,0 @@
|
|
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
|