This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Elixir.iss
135 lines (114 loc) · 4.3 KB
/
Elixir.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
; Elixir.iss - Elixir "Offline" Installer
; Copyright (c) Chris Hyndman
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; "Elixir" and the Elixir logo are copyright (c) 2012 Plataformatec.
; Determine version of Elixir from elixir\VERSION
#ifndef ElixirVersion
#if FileExists('elixir\VERSION')
#define VersionFileHandle = FileOpen('elixir\VERSION')
#define ElixirVersion = FileRead(VersionFileHandle)
#expr FileClose(VersionFileHandle)
#else
#error elixir\VERSION not found
#endif
#endif
#define ELIXIR_PATH '{app}\bin'
#define ESCRIPT_PATH '%USERPROFILE%\.mix\escripts'
[Setup]
AppName=Elixir
AppPublisherURL=http://elixir-lang.org/
AppVersion={#ElixirVersion}
ChangesEnvironment=yes
DefaultDirName={pf}\Elixir
DefaultGroupName=Elixir
OutputBaseFilename=elixir-v{#ElixirVersion}-setup
AllowNoIcons=yes
#ifdef SkipWelcome
DisableWelcomePage=yes
#else
DisableWelcomePage=no
#endif
; Web installer: no need to compress, since the installer is built directly on the machine
#ifdef NoCompression
Compression=none
#endif
; Visual
SetupIconFile=assets\drop.ico
WizardImageFile=assets\drop_banner.bmp
WizardSmallImageFile=assets\null.bmp
UninstallDisplayIcon={app}\drop.ico
[Files]
Source: "assets\drop.ico"; DestDir: "{app}"
Source: "elixir\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs
[Icons]
Name: "{group}\Elixir"; Filename: "{code:GetScriptString|ErlangBinPath}\werl.exe"; WorkingDir: "%userprofile%"; IconFilename: "{app}\drop.ico"; IconIndex: 0; Parameters: "-env ERL_LIBS ""{app}\lib"" -user Elixir.IEx.CLI -extra --no-halt"
[Tasks]
Name: erlangpath; Description: "Append {code:GetScriptString|ErlangBinPath} to system PATH"; Check: CheckToAppendErlangPath
Name: elixirpath; Description: "Append {#ELIXIR_PATH} to system PATH"; Check: CheckToAppendElixirPath
Name: escriptpath; Description: "Append {#ESCRIPT_PATH} to system PATH"; Check: CheckToAppendEscriptPath
[Code]
#include "src\Util.iss"
#include "src\Path.iss"
#include "src\ErlangInstall.iss"
var
GlobalPageErlangDir: TInputDirWizardPage;
function GetScriptString(Param: String): String;
begin
Result := '';
if Param = 'ErlangBinPath' then
Result := GlobalPageErlangDir.Values[0] + '\bin';
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
if IsTaskSelected('erlangpath') then
AppendPath(GetScriptString('ErlangBinPath'));
if IsTaskSelected('elixirpath') then
AppendPath(ExpandConstant('{#ELIXIR_PATH}'));
if IsTaskSelected('escriptpath') then
AppendPath(ExpandConstant('{#ESCRIPT_PATH}'));
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
SelTaskString: String;
begin
if CurUninstallStep = usUninstall then begin
SelTaskString := '';
RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\Elixir_is1', 'Inno Setup: Selected Tasks', SelTaskString);
if Pos('elixirpath', SelTaskString) <> 0 then
DeletePath(ExpandConstant('{#ELIXIR_PATH}'));
if Pos('escriptpath', SelTaskString) <> 0 then
DeletePath(ExpandConstant('{#ESCRIPT_PATH}'));
end;
end;
procedure InitializeWizard();
begin
GlobalPageErlangDir := CreateInputDirPage(
wpWelcome,
'Confirm Erlang Directory',
'Confirm the location of your Erlang installation, then click Next.',
'Setup will configure Elixir to use the following Erlang installation path.',
False, ''
);
GlobalPageErlangDir.Add('');
GlobalPageErlangDir.Values[0] := GetLatestErlangPath();
end;
function CheckToAppendErlangPath: Boolean; begin
Result := not ContainsPath(GetScriptString('ErlangBinPath')); end;
function CheckToAppendElixirPath: Boolean; begin
Result := not ContainsPath(ExpandConstant('{#ELIXIR_PATH}')); end;
function CheckToAppendEscriptPath: Boolean; begin
Result := not ContainsPath(ExpandConstant('{#ESCRIPT_PATH}')); end;