rubyinstaller-build 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +8 -0
  3. data/.gitignore +12 -0
  4. data/.yardopts +7 -0
  5. data/CHANGELOG-2.4.md +166 -0
  6. data/CHANGELOG-2.5.md +87 -0
  7. data/CHANGELOG-2.6.md +62 -0
  8. data/CHANGELOG-2.7.md +22 -0
  9. data/Gemfile +6 -0
  10. data/LICENSE.txt +25 -0
  11. data/README.md +114 -0
  12. data/Rakefile +164 -0
  13. data/appveyor-key.asc.asc +61 -0
  14. data/appveyor.yml +141 -0
  15. data/docker/Dockerfile +50 -0
  16. data/docker/Rakefile +22 -0
  17. data/gems/rubyinstaller-build.yaml +2 -0
  18. data/lib/devkit.rb +3 -0
  19. data/lib/ruby_installer.rb +3 -0
  20. data/lib/ruby_installer/build.rb +23 -0
  21. data/lib/ruby_installer/build/ca_cert_file.rb +66 -0
  22. data/lib/ruby_installer/build/colors.rb +45 -0
  23. data/lib/ruby_installer/build/components/01_msys2.rb +97 -0
  24. data/lib/ruby_installer/build/components/02_pacman_update.rb +35 -0
  25. data/lib/ruby_installer/build/components/03_dev_tools.rb +68 -0
  26. data/lib/ruby_installer/build/components/base.rb +58 -0
  27. data/lib/ruby_installer/build/components_installer.rb +53 -0
  28. data/lib/ruby_installer/build/dll_directory.rb +97 -0
  29. data/lib/ruby_installer/build/erb_compiler.rb +61 -0
  30. data/lib/ruby_installer/build/gem_version.rb +5 -0
  31. data/lib/ruby_installer/build/gems.rb +74 -0
  32. data/lib/ruby_installer/build/msys2_installation.rb +280 -0
  33. data/lib/ruby_installer/build/openstruct.rb +29 -0
  34. data/lib/ruby_installer/build/release.rb +120 -0
  35. data/lib/ruby_installer/build/singleton.rb +45 -0
  36. data/lib/ruby_installer/build/task.rb +20 -0
  37. data/lib/ruby_installer/build/utils.rb +110 -0
  38. data/lib/ruby_installer/runtime.rb +18 -0
  39. data/lib/ruby_installer/runtime/ridk.rb +195 -0
  40. data/packages/ri-msys/Rakefile +72 -0
  41. data/packages/ri-msys/recipes/sandbox/70-add-msys2-installation.rake +18 -0
  42. data/packages/ri/Rakefile +60 -0
  43. data/recipes/archive-7z/10-define-variables.rake +2 -0
  44. data/recipes/archive-7z/70-create-archive.rake +10 -0
  45. data/recipes/archive-7z/90-define-main-task.rake +2 -0
  46. data/recipes/installer-inno/10-define-variables.rake +2 -0
  47. data/recipes/installer-inno/50-generate-filelist.rake +28 -0
  48. data/recipes/installer-inno/60-generate-iss-file.rake +8 -0
  49. data/recipes/installer-inno/70-run-iscc.rake +19 -0
  50. data/recipes/installer-inno/90-define-main-task.rake +2 -0
  51. data/recipes/installer-inno/events.iss +88 -0
  52. data/recipes/installer-inno/images/fake.bmp +0 -0
  53. data/recipes/installer-inno/images/wizard-large.bmp +0 -0
  54. data/recipes/installer-inno/images/wizard-logo.bmp +0 -0
  55. data/recipes/installer-inno/ri_gui.iss +286 -0
  56. data/recipes/installer-inno/rubyinstaller.iss.erb +157 -0
  57. data/recipes/installer-inno/util.iss +271 -0
  58. data/recipes/msys2/10-define-variables.rake +6 -0
  59. data/recipes/msys2/30-download-msys2-base.rake +4 -0
  60. data/recipes/msys2/40-extract-msys2-base.rake +9 -0
  61. data/recipes/msys2/50-init-msys.rake +8 -0
  62. data/recipes/msys2/50-install-components.rake +19 -0
  63. data/recipes/msys2/90-define-main-task.rake +2 -0
  64. data/recipes/sandbox/10-define-variables.rake +6 -0
  65. data/recipes/sandbox/20-add-runtime-files.rake +15 -0
  66. data/recipes/sandbox/20-define-import-files.rake +16 -0
  67. data/recipes/sandbox/20-define-import-readline.rake +28 -0
  68. data/recipes/sandbox/20-extend-irb.rake +13 -0
  69. data/recipes/sandbox/40-fix-rake-shebang.rake +6 -0
  70. data/recipes/sandbox/40-generate-rake-cmd.rake +7 -0
  71. data/recipes/sandbox/40-generate-version-file.rake +20 -0
  72. data/recipes/sandbox/50-do-import-files.rake +17 -0
  73. data/recipes/sandbox/50-gather-sandbox-files.rake +6 -0
  74. data/recipes/sandbox/60-define-gem-wrappers.rake +5 -0
  75. data/recipes/sandbox/60-side-by-side-assembly.rake +81 -0
  76. data/recipes/sandbox/70-add-gem-bin-wrappers.rake +10 -0
  77. data/recipes/sandbox/70-install-gems.rake +11 -0
  78. data/recipes/sandbox/80-copy-msys-files.rake +8 -0
  79. data/recipes/sandbox/90-define-main-task.rake +2 -0
  80. data/recipes/sandbox/LICENSE.txt +24 -0
  81. data/recipes/sandbox/rubyinstaller-2.3.4-x64.files +4 -0
  82. data/recipes/sandbox/rubyinstaller-2.3.4-x86.files +4 -0
  83. data/recipes/sandbox/rubyinstaller-2.3.4.files +43 -0
  84. data/recipes/sandbox/rubyinstaller-2.4.10-x64.files +4 -0
  85. data/recipes/sandbox/rubyinstaller-2.4.10-x86.files +4 -0
  86. data/recipes/sandbox/rubyinstaller-2.4.10.files +44 -0
  87. data/recipes/sandbox/rubyinstaller-2.5.8-x64.files +6 -0
  88. data/recipes/sandbox/rubyinstaller-2.5.8-x86.files +6 -0
  89. data/recipes/sandbox/rubyinstaller-2.5.8.files +33 -0
  90. data/recipes/sandbox/rubyinstaller-2.6.6-x64.files +6 -0
  91. data/recipes/sandbox/rubyinstaller-2.6.6-x86.files +6 -0
  92. data/recipes/sandbox/rubyinstaller-2.6.6.files +35 -0
  93. data/recipes/sandbox/rubyinstaller-2.7.1-x64.files +6 -0
  94. data/recipes/sandbox/rubyinstaller-2.7.1-x86.files +6 -0
  95. data/recipes/sandbox/rubyinstaller-2.7.1.files +35 -0
  96. data/recipes/sandbox/rubyinstaller-head-x64.files +6 -0
  97. data/recipes/sandbox/rubyinstaller-head-x86.files +6 -0
  98. data/recipes/sandbox/rubyinstaller-head.files +35 -0
  99. data/recipes/unpack/10-define-variables.rake +5 -0
  100. data/recipes/unpack/20-define-msys-packages.rake +1 -0
  101. data/recipes/unpack/30-add-ri2-repo-to-msys.rake +41 -0
  102. data/recipes/unpack/50-install-msys-packages.rake +28 -0
  103. data/recipes/unpack/90-define-main-task.rake +2 -0
  104. data/recipes/unpack/appveyor-repo-key.asc +29 -0
  105. data/resources/files/irbrc_predefiner.rb +21 -0
  106. data/resources/files/operating_system.rb +21 -0
  107. data/resources/files/readline.rb +17 -0
  108. data/resources/files/reline.rb +437 -0
  109. data/resources/files/reline/ansi.rb +177 -0
  110. data/resources/files/reline/config.rb +297 -0
  111. data/resources/files/reline/general_io.rb +75 -0
  112. data/resources/files/reline/history.rb +56 -0
  113. data/resources/files/reline/key_actor.rb +7 -0
  114. data/resources/files/reline/key_actor/base.rb +7 -0
  115. data/resources/files/reline/key_actor/emacs.rb +517 -0
  116. data/resources/files/reline/key_actor/vi_command.rb +518 -0
  117. data/resources/files/reline/key_actor/vi_insert.rb +517 -0
  118. data/resources/files/reline/key_stroke.rb +53 -0
  119. data/resources/files/reline/kill_ring.rb +113 -0
  120. data/resources/files/reline/line_editor.rb +2231 -0
  121. data/resources/files/reline/unicode.rb +527 -0
  122. data/resources/files/reline/unicode/east_asian_width.rb +1145 -0
  123. data/resources/files/reline/version.rb +3 -0
  124. data/resources/files/reline/windows.rb +273 -0
  125. data/resources/files/ridk.cmd +39 -0
  126. data/resources/files/ridk.ps1 +26 -0
  127. data/resources/files/ridk_use/ridk.cmd +13 -0
  128. data/resources/files/ridk_use/ridk.ps1 +17 -0
  129. data/resources/files/ridk_use/ridk_use.rb +221 -0
  130. data/resources/files/setrbvars.cmd +14 -0
  131. data/resources/icons/ruby-doc.ico +0 -0
  132. data/resources/ssl/README-SSL.md +37 -0
  133. data/resources/ssl/c_rehash.rb +167 -0
  134. data/resources/ssl/cacert.pem +4105 -0
  135. data/rubyinstaller-build.gemspec +28 -0
  136. metadata +226 -0
@@ -0,0 +1,72 @@
1
+ $: << File.expand_path("../../../lib", __FILE__)
2
+
3
+ require "ruby_installer/build"
4
+
5
+ include RubyInstaller::Build::Utils
6
+ RubyInstaller::Build.enable_msys_apps
7
+
8
+ class RubyPackage < RubyInstaller::Build::Openstruct
9
+ def initialize(*args)
10
+ super
11
+
12
+ self.rubyver, self.pkgrel = packagever.split("-", 2)
13
+ self.packagename = "rubyinstaller-devkit"
14
+ self.rubyver2 = packagever=='head' ? "2.8" : rubyver[/^\d+\.\d+/]
15
+
16
+ self.install_gems = %w[]
17
+
18
+ case arch
19
+ when 'x64'
20
+ self.pacman_arch = "mingw-w64-x86_64"
21
+ self.ruby_arch = "x64-mingw32"
22
+ self.msys_arch = "x86_64"
23
+ self.msysdir = "msys64"
24
+ self.mingwdir = "mingw64"
25
+ self.default_instdir = "C:\\Ruby#{rubyver2.gsub(".","")}-x64"
26
+ when 'x86'
27
+ self.pacman_arch = "mingw-w64-i686"
28
+ self.ruby_arch = "i386-mingw32"
29
+ self.msys_arch = "i686"
30
+ self.msysdir = "msys32"
31
+ self.mingwdir = "mingw32"
32
+ self.default_instdir = "C:\\Ruby#{rubyver2.gsub(".","")}"
33
+ else
34
+ raise "invalid arch #{arch}"
35
+ end
36
+
37
+ self.packagenameverarch = "#{packagename}-#{ packagever=='head' ? 'head' : packagever }-#{arch}"
38
+ self.pacman_ruby = "#{pacman_arch}-ruby#{ packagever=='head' ? '-head' : "#{rubyver2.gsub(".","")}=#{rubyver}" }"
39
+ end
40
+ end
41
+
42
+ ovl_glob('recipes/*/task.rake').each{|f| load(ovl_expand_file(f)) }
43
+
44
+ ruby_arch_packages = %w[x64 x86].map do |arch|
45
+ %w[2.4.10-1 2.5.8-1 2.6.6-1 2.7.1-1 head].map do |packagever|
46
+ RubyPackage.new( packagever: packagever, arch: arch, rootdir: __dir__ ).freeze
47
+ end
48
+ end
49
+
50
+ ruby_arch_packages.each do |ruby_packages|
51
+ # Define MSYS2 installation tasks only once per arch and reuse it for different ruby versions.
52
+ msys2 = nil
53
+ namespace "msys2-#{ruby_packages.first.msys_arch}" do
54
+ msys2 = RubyInstaller::Build::Task.new( thisdir: "recipes/msys2", package: ruby_packages.first )
55
+ end
56
+
57
+ ruby_packages.each do |pack|
58
+ nsp = "ruby-#{pack.rubyver}-#{pack.arch}"
59
+ namespace nsp do
60
+ unpack = RubyInstaller::Build::Task.new( thisdir: "recipes/unpack", package: pack )
61
+ sandbox = RubyInstaller::Build::Task.new( thisdir: "recipes/sandbox", package: pack, unpack_task: unpack, msys2_task: msys2 )
62
+ RubyInstaller::Build::Task.new( thisdir: "recipes/installer-inno", package: pack, sandbox_task: sandbox )
63
+ RubyInstaller::Build::Task.new( thisdir: "recipes/archive-7z", package: pack, sandbox_task: sandbox )
64
+ end
65
+
66
+ desc "Build all for #{nsp}"
67
+ task nsp => ["#{nsp}:installer-inno", "#{nsp}:archive-7z"]
68
+
69
+ desc "Build installers for all rubies"
70
+ task :default => nsp
71
+ end
72
+ end
@@ -0,0 +1,18 @@
1
+ msysdir = File.join(self.sandboxdir, package.msysdir)
2
+ directory File.dirname(msysdir)
3
+ file msysdir => [msys2_task.devtools, File.dirname(msysdir)] do |t|
4
+ cp_r msys2_task.sandboxdir, t.name
5
+
6
+ init_files = File.readlines(msys2_task.after_init_filelist).map(&:chomp) - File.readlines(msys2_task.before_init_filelist).map(&:chomp)
7
+
8
+ # Remove files created while MSYS init.
9
+ # These files are re-created on the target computer.
10
+ chdir t.name do
11
+ rm init_files
12
+
13
+ # Do not include pacman gnupg directory. These files are unique to each installation
14
+ # and are created at the first call of `sh -l`.
15
+ rm_r "etc/pacman.d/gnupg"
16
+ end
17
+ end
18
+ self.sandboxfiles << msysdir
@@ -0,0 +1,60 @@
1
+ $: << File.expand_path("../../../lib", __FILE__)
2
+
3
+ require "ruby_installer/build"
4
+
5
+ include RubyInstaller::Build::Utils
6
+ RubyInstaller::Build.enable_msys_apps
7
+
8
+ class RubyPackage < RubyInstaller::Build::Openstruct
9
+ def initialize(*args)
10
+ super
11
+
12
+ self.rubyver, self.pkgrel = packagever.split("-", 2)
13
+ self.packagename = "rubyinstaller"
14
+ self.rubyver2 = packagever=='head' ? "2.8" : rubyver[/^\d+\.\d+/]
15
+
16
+ self.install_gems = %w[]
17
+
18
+ case arch
19
+ when 'x64'
20
+ self.pacman_arch = "mingw-w64-x86_64"
21
+ self.ruby_arch = "x64-mingw32"
22
+ self.mingwdir = "mingw64"
23
+ self.default_instdir = "C:\\Ruby#{rubyver2.gsub(".","")}-x64"
24
+ when 'x86'
25
+ self.pacman_arch = "mingw-w64-i686"
26
+ self.ruby_arch = "i386-mingw32"
27
+ self.mingwdir = "mingw32"
28
+ self.default_instdir = "C:\\Ruby#{rubyver2.gsub(".","")}"
29
+ else
30
+ raise "invalid arch #{arch}"
31
+ end
32
+
33
+ self.packagenameverarch = "#{packagename}-#{ packagever=='head' ? 'head' : packagever }-#{arch}"
34
+ self.pacman_ruby = "#{pacman_arch}-ruby#{ packagever=='head' ? '-head' : "#{rubyver2.gsub(".","")}=#{rubyver}" }"
35
+ end
36
+ end
37
+
38
+ ovl_glob('recipes/*/task.rake').each{|f| load(ovl_expand_file(f)) }
39
+
40
+ ruby_arch_packages = %w[x64 x86].map do |arch|
41
+ %w[2.4.10-1 2.5.8-1 2.6.6-1 2.7.1-1 head].map do |packagever|
42
+ RubyPackage.new( packagever: packagever, arch: arch, rootdir: __dir__ ).freeze
43
+ end
44
+ end
45
+
46
+ ruby_arch_packages.flatten.each do |pack|
47
+ nsp = "ruby-#{pack.rubyver}-#{pack.arch}"
48
+ namespace nsp do
49
+ unpack = RubyInstaller::Build::Task.new( thisdir: "recipes/unpack", package: pack )
50
+ sandbox = RubyInstaller::Build::Task.new( thisdir: "recipes/sandbox", package: pack, unpack_task: unpack )
51
+ RubyInstaller::Build::Task.new( thisdir: "recipes/installer-inno", package: pack, sandbox_task: sandbox )
52
+ RubyInstaller::Build::Task.new( thisdir: "recipes/archive-7z", package: pack, sandbox_task: sandbox )
53
+ end
54
+
55
+ desc "Build all for #{nsp}"
56
+ task nsp => ["#{nsp}:installer-inno", "#{nsp}:archive-7z"]
57
+
58
+ desc "Build installers for all rubies"
59
+ task :default => nsp
60
+ end
@@ -0,0 +1,2 @@
1
+ self.sandboxdir = sandbox_task.sandboxdir
2
+ self.archivefile = "recipes/archive-7z/#{package.packagenameverarch}.7z"
@@ -0,0 +1,10 @@
1
+ file archivefile => sandbox_task.sandboxfiles do
2
+ rm_f archivefile
3
+ msys_sh <<-EOT
4
+ pacman -S --needed --noconfirm p7zip
5
+ EOT
6
+
7
+ chdir "recipes/sandbox" do
8
+ sh "sh 7z a -bd ../../#{archivefile} #{sandboxdir.sub("recipes/sandbox/", "")} | ruby -ne \"STDERR.print '.'\""
9
+ end
10
+ end
@@ -0,0 +1,2 @@
1
+ desc "7z archive for ruby-#{package.rubyver}-#{package.arch}"
2
+ task "archive-7z" => ["sandbox", archivefile]
@@ -0,0 +1,2 @@
1
+ self.sandboxdir = sandbox_task.sandboxdir
2
+ self.installer_exe = "#{thisdir}/#{package.packagenameverarch}.exe"
@@ -0,0 +1,28 @@
1
+ self.filelist_iss = "#{thisdir}/filelist-ruby-#{package.rubyver}-#{package.ruby_arch}.iss"
2
+ directory File.dirname(filelist_iss)
3
+ file filelist_iss => [__FILE__, ovl_expand_file(sandbox_task.sandboxfile_listfile), ovl_expand_file(sandbox_task.sandboxfile_arch_listfile), File.dirname(filelist_iss)] do
4
+ puts "generate #{filelist_iss}"
5
+ out = sandbox_task.sandboxfiles.map do |path|
6
+ reltosandbox_path = path.gsub(sandboxdir+"/", "")
7
+
8
+ if package.respond_to?(:msysdir) && reltosandbox_path.start_with?(package.msysdir)
9
+ components = "msys2"
10
+ flags = "uninsneveruninstall"
11
+ elsif File.fnmatch("share/{ri,doc}/*", reltosandbox_path, File::FNM_EXTGLOB)
12
+ components = "rdoc"
13
+ else
14
+ components = "ruby"
15
+ end
16
+ args = if File.directory?(path)
17
+ flags = "recursesubdirs createallsubdirs #{flags}"
18
+ source = "../../#{path}/*"
19
+ dest = "{app}/#{reltosandbox_path}"
20
+ else
21
+ source = "../../#{path}"
22
+ dest = "{app}/#{File.dirname(reltosandbox_path)}"
23
+ end
24
+
25
+ "Source: #{source}; DestDir: #{dest}; Flags: #{flags}; Components: #{components}"
26
+ end.join("\n")
27
+ File.write(filelist_iss, out)
28
+ end
@@ -0,0 +1,8 @@
1
+ iss_files = ovl_glob("#{thisdir}/*.iss*").map{|f| ovl_expand_file(f) }
2
+
3
+ # Compile the iss file from ERB template
4
+ self.iss_compiler = RubyInstaller::Build::ErbCompiler.new(File.join(thisdir, "rubyinstaller.iss.erb"), File.join(thisdir, "#{package.packagenameverarch}.iss"))
5
+ file iss_compiler.result_filename => [iss_compiler.erb_filename_abs] + iss_files - [iss_compiler.result_filename] do |t|
6
+ puts "erb #{t.name}"
7
+ iss_compiler.write_result(self)
8
+ end
@@ -0,0 +1,19 @@
1
+ file installer_exe => (sandbox_task.sandboxfiles + [iss_compiler.result_filename, filelist_iss]) do
2
+ tries = 10
3
+ loop do
4
+ ok, res = sh "cmd", "/c", "iscc", iss_compiler.result_filename, "/Q", "/O#{File.dirname(installer_exe)}", "/F#{File.basename(installer_exe, ".exe")}" do |ok_, res_|
5
+ [ok_, res_]
6
+ end
7
+ if !ok
8
+ if (tries-=1) > 0 && res.exitstatus == 2
9
+ # Handle "Out of memory" which happens in docker, when several "docker run" are running
10
+ $stderr.puts "Retry iscc due to failure #{res.inspect}"
11
+ sleep 5
12
+ else
13
+ raise "iscc failed #{res.inspect}"
14
+ end
15
+ else
16
+ break
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,2 @@
1
+ desc "installer for ruby-#{package.rubyver}-#{package.arch}"
2
+ task "installer-inno" => ["sandbox", installer_exe]
@@ -0,0 +1,88 @@
1
+ procedure InitializeWizard;
2
+ begin
3
+ InitializeGUI;
4
+ end;
5
+
6
+ procedure CurStepChanged(const CurStep: TSetupStep);
7
+ begin
8
+
9
+ // Run preparing steps before install of files
10
+ if CurStep = ssInstall then
11
+ begin
12
+ if UsingWinNT then
13
+ begin
14
+ UnInstallOldVersion();
15
+
16
+ Log(Format('Selected Tasks - Path: %d, Associate: %d', [PathChkBox.State, PathExtChkBox.State]));
17
+
18
+ if IsModifyPath then
19
+ ModifyPath([ExpandConstant('{app}') + '\bin']);
20
+
21
+ if IsAssociated then
22
+ ModifyFileExts(['.rb', '.rbw']);
23
+
24
+ if IsUtf8 then
25
+ ModifyRubyopt(['-Eutf-8']);
26
+
27
+ if IsComponentSelected('msys2') then
28
+ DeleteRubyMsys2Directory();
29
+
30
+ end else
31
+ MsgBox('Looks like you''ve got on older, unsupported Windows version.' #13 +
32
+ 'Proceeding with a reduced feature set installation.',
33
+ mbInformation, MB_OK);
34
+ end;
35
+
36
+ // Final steps before installer closes
37
+ if CurStep = ssDone then
38
+ begin
39
+ Log(Format('Selected Tasks - DevkitInstall %d', [DevkitChkBox.State]));
40
+ if IsDevkitInstall then
41
+ RunDevkitInstall();
42
+ end;
43
+ end;
44
+
45
+ procedure CurPageChanged(CurPageID: Integer);
46
+ begin
47
+ if CurPageID = wpSelectDir then
48
+ WizardForm.NextButton.Caption := SetupMessage(msgButtonInstall);
49
+
50
+ {* Disable MSYS2 component install, when it is already present in the install directory,
51
+ but take component selection as set per /COMPONENTS param when in slient install. *}
52
+ if (CurPageID = wpSelectComponents) and (not WizardSilent) then
53
+ begin
54
+ EnableMsys2Component(Msys2AlreadyInstalled() = '');
55
+ ComplistClickCheck(TObject.Create);
56
+ end;
57
+ end;
58
+
59
+ procedure RegisterPreviousData(PreviousDataKey: Integer);
60
+ begin
61
+ {* store install choices so we can use during uninstall *}
62
+ if IsModifyPath then
63
+ SetPreviousData(PreviousDataKey, 'PathModified', 'yes');
64
+ if IsAssociated then
65
+ SetPreviousData(PreviousDataKey, 'FilesAssociated', 'yes');
66
+ if IsUtf8 then
67
+ SetPreviousData(PreviousDataKey, 'Utf8', 'yes');
68
+
69
+ SetPreviousData(PreviousDataKey, 'RubyInstallerId', ExpandConstant('{#PackageBaseId}\{#RubyVersion}'));
70
+ end;
71
+
72
+ procedure CurUninstallStepChanged(const CurUninstallStep: TUninstallStep);
73
+ begin
74
+ if CurUninstallStep = usUninstall then
75
+ begin
76
+ if UsingWinNT then
77
+ begin
78
+ if GetPreviousData('PathModified', 'no') = 'yes' then
79
+ ModifyPath([ExpandConstant('{app}') + '\bin']);
80
+
81
+ if GetPreviousData('FilesAssociated', 'no') = 'yes' then
82
+ ModifyFileExts(['.rb', '.rbw']);
83
+
84
+ if GetPreviousData('Utf8', 'no') = 'yes' then
85
+ ModifyRubyopt(['-Eutf-8']);
86
+ end;
87
+ end;
88
+ end;
@@ -0,0 +1,286 @@
1
+ // RubyInstaller Inno Setup GUI Customizations
2
+ //
3
+ // Copyright (c) 2009-2012 Jon Maken
4
+ // Copyright (c) 2012 Yusuke Endoh
5
+ // Revision: 2012-05-28 13:58:04 -0600
6
+ // License: Modified BSD License
7
+
8
+ const
9
+ ChkBoxBaseY = 95;
10
+ ChkBoxBaseHeight = 17;
11
+ ChkBoxBaseLeft = 18;
12
+
13
+ var
14
+ PathChkBox, PathExtChkBox, Utf8ChkBox, DevkitChkBox: TCheckBox;
15
+ CompLabel: TLabel;
16
+ ComplistPrevClickCheck: TNotifyEvent;
17
+
18
+ function IsAssociated(): Boolean;
19
+ begin
20
+ Result := PathExtChkBox.Checked;
21
+ end;
22
+
23
+ function IsModifyPath(): Boolean;
24
+ begin
25
+ Result := PathChkBox.Checked;
26
+ end;
27
+
28
+ function IsDevkitInstall(): Boolean;
29
+ begin
30
+ Result := DevkitChkBox.Checked;
31
+ end;
32
+
33
+ function IsUtf8(): Boolean;
34
+ begin
35
+ Result := Utf8ChkBox.Checked;
36
+ end;
37
+
38
+
39
+ procedure ParseSilentTasks();
40
+ var
41
+ I, N: Integer;
42
+ Param: String;
43
+ Tasks: TStringList;
44
+ begin
45
+ {* parse command line args for silent install tasks *}
46
+ for I := 0 to ParamCount do
47
+ begin
48
+ Param := AnsiUppercase(ParamStr(I));
49
+ if Pos('/TASKS', Param) <> 0 then
50
+ begin
51
+ Param := Trim(Copy(Param, Pos('=', Param) + 1, Length(Param)));
52
+ try
53
+ // TODO check for too many tasks to prevent overflow??
54
+ Tasks := StrToList(Param, ',');
55
+ for N := 0 to Tasks.Count - 1 do
56
+ case Trim(Tasks.Strings[N]) of
57
+ 'MODPATH': PathChkBox.State := cbChecked;
58
+ 'NOMODPATH': PathChkBox.State := cbUnchecked;
59
+ 'ASSOCFILES': PathExtChkBox.State := cbChecked;
60
+ 'NOASSOCFILES': PathExtChkBox.State := cbUnchecked;
61
+ 'RIDKINSTALL': DevkitChkBox.State := cbChecked;
62
+ 'NORIDKINSTALL': DevkitChkBox.State := cbUnchecked;
63
+ 'DEFAULTUTF8': Utf8ChkBox.State := cbChecked;
64
+ 'NODEFAULTUTF8': Utf8ChkBox.State := cbUnchecked;
65
+ end;
66
+ finally
67
+ Tasks.Free;
68
+ end;
69
+ end;
70
+ end;
71
+ end;
72
+
73
+ procedure URLText_OnClick(Sender: TObject);
74
+ var
75
+ ErrorCode: Integer;
76
+ begin
77
+ if Sender is TNewStaticText then
78
+ ShellExec('open', TNewStaticText(Sender).Caption, '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
79
+ end;
80
+
81
+ procedure RunDevkitInstall();
82
+ var
83
+ ErrorCode: Integer;
84
+ ridkpath: String;
85
+ begin
86
+ ridkpath := ExpandConstant('{app}') + '\bin\ridk.cmd';
87
+ ShellExec('open', ridkpath, 'install', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
88
+ end;
89
+
90
+ procedure ComplistClickCheck(Sender: TObject);
91
+ var
92
+ msysdir: String;
93
+ update: Boolean;
94
+ begin
95
+ update := GetUninstallString() <> '';
96
+ msysdir := Msys2AlreadyInstalled();
97
+
98
+ if update then
99
+ if msysdir <> '' then
100
+ if IsComponentSelected('msys2') then
101
+ CompLabel.Caption := 'ATTENTION: MSYS2 is already present in ' + msysdir + '. It will be deleted now and then re-installed. Additional installed pacman packages will be removed. Some gems might not work afterwards and must be re-installed.'
102
+ else
103
+ CompLabel.Caption := 'Ruby in ' + ExpandConstant('{app}') + ' will be updated. MSYS2 seems to be already present in ' + msysdir + ' . It will kept untouched and will be reused for this Ruby installation. Optionally it can be updated per `ridk install` on the last page of the installer.'
104
+ else
105
+ if IsComponentSelected('msys2') then
106
+ CompLabel.Caption := 'Ruby in ' + ExpandConstant('{app}') + ' will be updated and MSYS2 will be installed into ' + ExpandConstant('{app}\{#MsysDir}') + '. Please run `ridk install` on the last installer page to initialize it. It can be updated later per `ridk install` as well.'
107
+ else
108
+ CompLabel.Caption := 'Ruby in ' + ExpandConstant('{app}') + ' will be updated. It''s possible to install MSYS2 at the last page of the installer or to reuse an existing MSYS2 installation.'
109
+ else
110
+ if msysdir <> '' then
111
+ if IsComponentSelected('msys2') then
112
+ CompLabel.Caption := 'ATTENTION: MSYS2 is already present in ' + msysdir + '. It will be deleted now and then re-installed. Additional installed pacman packages will be removed. Some gems might not work afterwards and must be re-installed.'
113
+ else
114
+ CompLabel.Caption := 'Ruby will be installed into ' + ExpandConstant('{app}') + '. MSYS2 seems to be already present in ' + msysdir + ' . It will kept untouched and will be re-used for this Ruby installation. Optionally it can be updated per `ridk install` on the last page of the installer.'
115
+ else
116
+ if IsComponentSelected('msys2') then
117
+ CompLabel.Caption := 'Ruby will be installed into ' + ExpandConstant('{app}') + ' and MSYS2 will be installed into ' + ExpandConstant('{app}\{#MsysDir}') + '. Please run `ridk install` on the last installer page to initialize it. It can be updated later per `ridk install` as well.'
118
+ else
119
+ CompLabel.Caption := 'Ruby will be installed into ' + ExpandConstant('{app}') + ' without MSYS2. It''s possible to install MSYS2 at the last page of the installer or to reuse an existing MSYS2 installation.';
120
+
121
+ ComplistPrevClickCheck(Sender);
122
+ end;
123
+
124
+ procedure EnableMsys2Component(enable: Boolean);
125
+ begin
126
+ {* InnoSetup doesn't provide corresponding setter for IsComponentSelected, so that we alter the ComponentsList directly. *}
127
+ if WizardForm.ComponentsList.Items.Count > 1 then
128
+ WizardForm.ComponentsList.Checked[1] := enable;
129
+ end;
130
+
131
+ procedure InitializeGUI;
132
+ var
133
+ ChkBoxCurrentY: Integer;
134
+ Page: TWizardPage;
135
+ HostPage: TNewNotebookPage;
136
+ URLText, TmpLabel: TNewStaticText;
137
+ begin
138
+
139
+ {* Add label to components list *}
140
+
141
+ CompLabel := TLabel.Create(WizardForm);
142
+ CompLabel.Parent := WizardForm.SelectComponentsPage;
143
+ CompLabel.Left := WizardForm.ComponentsList.Left;
144
+ CompLabel.Width := WizardForm.ComponentsList.Width;
145
+ CompLabel.Height := ScaleY(40);
146
+ CompLabel.Top :=
147
+ WizardForm.ComponentsList.Top + WizardForm.ComponentsList.Height - CompLabel.Height;
148
+ CompLabel.AutoSize := False;
149
+ CompLabel.WordWrap := True;
150
+
151
+ WizardForm.ComponentsList.Height :=
152
+ WizardForm.ComponentsList.Height - CompLabel.Height - ScaleY(8);
153
+
154
+ {* Bypass click event on ComponentsList *}
155
+ ComplistPrevClickCheck := WizardForm.ComponentsList.OnClickCheck;
156
+ WizardForm.ComponentsList.OnClickCheck := @ComplistClickCheck;
157
+
158
+ {* Path, and file association task check boxes *}
159
+
160
+ Page := PageFromID(wpSelectDir);
161
+ ChkBoxCurrentY := ChkBoxBaseY;
162
+
163
+ PathChkBox := TCheckBox.Create(Page);
164
+ PathChkBox.Parent := Page.Surface;
165
+ PathChkBox.State := cbChecked;
166
+ PathChkBox.Caption := CustomMessage('AddPath');
167
+ PathChkBox.Hint := CustomMessage('AddPathHint');
168
+ PathChkBox.ShowHint := True;
169
+ PathChkBox.Alignment := taRightJustify;
170
+ PathChkBox.Top := ScaleY(ChkBoxCurrentY);
171
+ PathChkBox.Left := ScaleX(ChkBoxBaseLeft);
172
+ PathChkBox.Width := Page.SurfaceWidth;
173
+ PathChkBox.Height := ScaleY(ChkBoxBaseHeight);
174
+ ChkBoxCurrentY := ChkBoxCurrentY + ChkBoxBaseHeight;
175
+
176
+ PathExtChkBox := TCheckBox.Create(Page);
177
+ PathExtChkBox.Parent := Page.Surface;
178
+ PathExtChkBox.State := cbChecked;
179
+ PathExtChkBox.Caption := CustomMessage('AssociateExt');
180
+ PathExtChkBox.Hint := CustomMessage('AssociateExtHint');
181
+ PathExtChkBox.ShowHint := True;
182
+ PathExtChkBox.Alignment := taRightJustify;
183
+ PathExtChkBox.Top := ScaleY(ChkBoxCurrentY);
184
+ PathExtChkBox.Left := ScaleX(ChkBoxBaseLeft);
185
+ PathExtChkBox.Width := Page.SurfaceWidth;
186
+ PathExtChkBox.Height := ScaleY(ChkBoxBaseHeight);
187
+ ChkBoxCurrentY := ChkBoxCurrentY + ChkBoxBaseHeight;
188
+
189
+ Utf8ChkBox := TCheckBox.Create(Page);
190
+ Utf8ChkBox.Parent := Page.Surface;
191
+ Utf8ChkBox.State := cbChecked;
192
+ Utf8ChkBox.Caption := CustomMessage('DefaultUtf8');
193
+ Utf8ChkBox.Hint := CustomMessage('DefaultUtf8Hint');
194
+ Utf8ChkBox.ShowHint := True;
195
+ Utf8ChkBox.Alignment := taRightJustify;
196
+ Utf8ChkBox.Top := ScaleY(ChkBoxCurrentY);
197
+ Utf8ChkBox.Left := ScaleX(ChkBoxBaseLeft);
198
+ Utf8ChkBox.Width := Page.SurfaceWidth;
199
+ Utf8ChkBox.Height := ScaleY(ChkBoxBaseHeight);
200
+
201
+ {* Single Ruby installation tip message *}
202
+
203
+ TmpLabel := TNewStaticText.Create(Page);
204
+ TmpLabel.Parent := Page.Surface;
205
+ TmpLabel.Top := ScaleY(ChkBoxCurrentY + 30);
206
+ TmpLabel.Left := ScaleX(6);
207
+ TmpLabel.Width := Page.SurfaceWidth;
208
+ TmpLabel.WordWrap := True;
209
+ TmpLabel.Caption := CustomMessage('MouseoverHint');
210
+
211
+ {* Labels and links back to RubyInstaller project pages *}
212
+
213
+ HostPage := WizardForm.FinishedPage;
214
+
215
+ DevkitChkBox := TCheckBox.Create(HostPage);
216
+ DevkitChkBox.Parent := HostPage;
217
+ if WizardSilent then DevkitChkBox.State := cbUnchecked
218
+ else DevkitChkBox.State := cbChecked;
219
+ DevkitChkBox.Caption := CustomMessage('DevkitInstall');
220
+ DevkitChkBox.Hint := CustomMessage('DevkitInstallHint');
221
+ DevkitChkBox.ShowHint := True;
222
+ DevkitChkBox.Alignment := taRightJustify;
223
+ DevkitChkBox.Top := ScaleY(160);
224
+ DevkitChkBox.Left := ScaleX(176);
225
+ DevkitChkBox.Width := HostPage.Width;
226
+
227
+ TmpLabel := TNewStaticText.Create(HostPage);
228
+ TmpLabel.Parent := HostPage;
229
+ TmpLabel.Top := DevkitChkBox.Top + 20;
230
+ TmpLabel.Left := DevkitChkBox.Left + 17;
231
+ TmpLabel.AutoSize := True;
232
+ TmpLabel.Caption := CustomMessage('DevkitInstall2');
233
+
234
+ TmpLabel := TNewStaticText.Create(HostPage);
235
+ TmpLabel.Parent := HostPage;
236
+ TmpLabel.Top := ScaleY(240);
237
+ TmpLabel.Left := ScaleX(176);
238
+ TmpLabel.AutoSize := True;
239
+ TmpLabel.Caption := CustomMessage('WebSiteLabel');
240
+
241
+ URLText := TNewStaticText.Create(HostPage);
242
+ URLText.Parent := HostPage;
243
+ URLText.Top := TmpLabel.Top;
244
+ URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
245
+ URLText.AutoSize := True;
246
+ URLText.Caption := 'http://rubyinstaller.org';
247
+ URLText.Cursor := crHand;
248
+ URLText.Font.Color := clBlue;
249
+ URLText.OnClick := @URLText_OnClick;
250
+
251
+ TmpLabel := TNewStaticText.Create(HostPage);
252
+ TmpLabel.Parent := HostPage;
253
+ TmpLabel.Top := ScaleY(256);
254
+ TmpLabel.Left := ScaleX(176);
255
+ TmpLabel.AutoSize := True;
256
+ TmpLabel.Caption := CustomMessage('SupportGroupLabel');
257
+
258
+ URLText := TNewStaticText.Create(HostPage);
259
+ URLText.Parent := HostPage;
260
+ URLText.Top := TmpLabel.Top;
261
+ URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
262
+ URLText.AutoSize := True;
263
+ URLText.Caption := 'http://groups.google.com/group/rubyinstaller';
264
+ URLText.Cursor := crHand;
265
+ URLText.Font.Color := clBlue;
266
+ URLText.OnClick := @URLText_OnClick;
267
+
268
+ TmpLabel := TNewStaticText.Create(HostPage);
269
+ TmpLabel.Parent := HostPage;
270
+ TmpLabel.Top := ScaleY(272);
271
+ TmpLabel.Left := ScaleX(176);
272
+ TmpLabel.AutoSize := True;
273
+ TmpLabel.Caption := CustomMessage('WikiLabel');
274
+
275
+ URLText := TNewStaticText.Create(HostPage);
276
+ URLText.Parent := HostPage;
277
+ URLText.Top := TmpLabel.Top;
278
+ URLText.Left := TmpLabel.Left + TmpLabel.Width + ScaleX(4);
279
+ URLText.AutoSize := True;
280
+ URLText.Caption := 'https://wiki.github.com/larskanis/rubyinstaller2';
281
+ URLText.Cursor := crHand;
282
+ URLText.Font.Color := clBlue;
283
+ URLText.OnClick := @URLText_OnClick;
284
+
285
+ ParseSilentTasks;
286
+ end;