ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/RubyInstaller/ruby-installer.nsi
Revision: 1212
Committed: 2009-07-29T07:13:06-07:00 (15 years, 10 months ago) by douglas
File size: 4860 byte(s)
Log Message:
Fix ups.

File Contents

# Content
1 ; Ruby Installer
2 ;
3 ; Douglas Thrift
4 ;
5 ; $Id$
6
7 !ifndef RUBY_VERSION | GEMS_VERSION | RUBY_LICENSE | BASE
8 !error "RUBY_VERSION, GEMS_VERSION, RUBY_LICENSE, and BASE must be defined"
9 !endif
10
11 InstallDir "C:\ruby"
12 Name "Ruby"
13 OutFile "ruby-${RUBY_VERSION}-rubygems-${GEMS_VERSION}.exe"
14 SetCompressor /SOLID lzma
15 ShowInstDetails show
16 ShowUninstDetails show
17 XPStyle on
18
19 !define RUBY "Ruby ${RUBY_VERSION}"
20
21 !define UNINST_REG "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
22 !define UNINST_EXE "ruby-rubygems-uninst.exe"
23
24 !include "EnvVarUpdate.nsh"
25 !include "MUI2.nsh"
26
27 !define MUI_FINISHPAGE_NOAUTOCLOSE
28 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
29
30 !insertmacro MUI_PAGE_WELCOME
31 !insertmacro MUI_PAGE_LICENSE "${RUBY_LICENSE}"
32 !insertmacro MUI_PAGE_DIRECTORY
33 !insertmacro MUI_PAGE_INSTFILES
34 !insertmacro MUI_PAGE_FINISH
35
36 !insertmacro MUI_UNPAGE_WELCOME
37 !insertmacro MUI_UNPAGE_CONFIRM
38 !insertmacro MUI_UNPAGE_INSTFILES
39 !insertmacro MUI_UNPAGE_FINISH
40
41 !insertmacro MUI_LANGUAGE "English"
42
43 !include "WordFunc.nsh"
44
45 !insertmacro WordReplace
46
47 Section "-Uninstall Previous"
48 SetShellVarContext all
49 SetOutPath "$TEMP"
50 ReadRegStr $0 HKLM "${UNINST_REG}" "UninstallString"
51 ReadRegStr $1 HKLM "${UNINST_REG}" "InstallLocation"
52 IfErrors 0 +2
53 Return
54 ${WordReplace} "$0" '"' '' '{}' $0
55 CopyFiles /SILENT $0 "$TEMP\${UNINST_EXE}"
56 ExecWait '"$TEMP\${UNINST_EXE}" /S _?=$1'
57 Delete "$TEMP\${UNINST_EXE}"
58 SectionEnd
59
60 Var base
61
62 Section "$(^Name)"
63 SetOutPath "$INSTDIR"
64 WriteUninstaller "$INSTDIR\${UNINST_EXE}"
65 WriteRegStr HKLM "${UNINST_REG}" "DisplayName" "${RUBY} RubyGems ${GEMS_VERSION}"
66 WriteRegStr HKLM "${UNINST_REG}" "DisplayVersion" "${RUBY_VERSION} ${GEMS_VERSION}"
67 WriteRegStr HKLM "${UNINST_REG}" "InstallLocation" "$INSTDIR"
68 WriteRegStr HKLM "${UNINST_REG}" "Publisher" "Douglas Thrift"
69 WriteRegStr HKLM "${UNINST_REG}" "URLInfoAbout" "http://code.douglasthrift.net/trac/repos/browser/RubyInstaller"
70 WriteRegStr HKLM "${UNINST_REG}" "UninstallString" "$INSTDIR\${UNINST_EXE}"
71 WriteRegDWORD HKLM "${UNINST_REG}" "NoModify" 1
72 WriteRegDWORD HKLM "${UNINST_REG}" "NoRepair" 1
73 File "*.ico"
74 File /r "ruby\*"
75 ${WordReplace} "$INSTDIR" "\" "/" "+" $base
76 Push "$INSTDIR\bin\gem"
77 Call Replace
78 Push "$INSTDIR\bin\gem.bat"
79 Call Replace
80 WriteRegStr HKCR ".rb" "" "Ruby.File"
81 WriteRegStr HKCR ".rbw" "" "Ruby.NoConFile"
82 WriteRegStr HKCR "Ruby.File" "" "Ruby File"
83 WriteRegStr HKCR "Ruby.File\DefaultIcon" "" "$INSTDIR\rubyw.ico,0"
84 WriteRegStr HKCR "Ruby.File\Shell" "" "open"
85 WriteRegStr HKCR "Ruby.File\Shell\open\command" "" '"$INSTDIR\bin\ruby.exe" "%1" %*'
86 WriteRegStr HKCR "Ruby.NoConFile" "" "Ruby File (no console)"
87 WriteRegStr HKCR "Ruby.NoConFile\DefaultIcon" "" "$INSTDIR\rubyw.ico,0"
88 WriteRegStr HKCR "Ruby.NoConFile\Shell" "" "open"
89 WriteRegStr HKCR "Ruby.NoConFile\Shell\open\command" "" '"$INSTDIR\bin\rubyw.exe" "%1" %*'
90 ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
91 ${EnvVarUpdate} $0 "PATHEXT" "A" "HKLM" ".rb"
92 ${EnvVarUpdate} $0 "PATHEXT" "A" "HKLM" ".rbw"
93 ${EnvVarUpdate} $0 "RUBYOPT" "A" "HKLM" "-rubygems"
94 SectionEnd
95
96 SectionGroup /e "Shortcuts"
97 Section "Start Menu"
98 SetOutPath "$SMPROGRAMS\${RUBY}"
99 CreateShortCut "Ruby Interactive Shell.lnk" "$INSTDIR\bin\irb.bat" "" "$INSTDIR\Ruby.ico" 0
100 WriteINIStr "$SMPROGRAMS\${RUBY}\Why's (Poignant) Guide to Ruby.url" "InternetShortCut" "URL" "http://poignantguide.net/ruby/"
101 DetailPrint "Create shortcut: Why's (Poignant) Guide to Ruby.url"
102 SectionEnd
103 SectionGroupEnd
104
105 Section "un.^(Name)"
106 SetShellVarContext all
107 RMDir /r /REBOOTOK "$SMPROGRAMS\${RUBY}"
108 RMDir /r /REBOOTOK "$INSTDIR\bin"
109 RMDir /r /REBOOTOK "$INSTDIR\doc"
110 RMDir /r /REBOOTOK "$INSTDIR\lib"
111 RMDir /r /REBOOTOK "$INSTDIR\man"
112 RMDir /r /REBOOTOK "$INSTDIR\share"
113 Delete /REBOOTOK "$INSTDIR\MANIFEST"
114 Delete /REBOOTOK "$INSTDIR\README.1st"
115 Delete /REBOOTOK "$INSTDIR\ruby.ico"
116 Delete /REBOOTOK "$INSTDIR\rubyw.ico"
117 Delete /REBOOTOK "$INSTDIR\${UNINST_EXE}"
118 RMDir /REBOOTOK "$INSTDIR"
119 DeleteRegKey HKLM "${UNINST_REG}"
120 DeleteRegKey HKCR ".rb"
121 DeleteRegKey HKCR ".rbw"
122 DeleteRegKey HKCR "Ruby.File"
123 DeleteRegKey HKCR "Ruby.NoConFile"
124 ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin"
125 ${un.EnvVarUpdate} $0 "PATHEXT" "R" "HKLM" ".rb"
126 ${un.EnvVarUpdate} $0 "PATHEXT" "R" "HKLM" ".rbw"
127 ${un.EnvVarUpdate} $0 "RUBYOPT" "R" "HKLM" "-rubygems"
128 SectionEnd
129
130 Function Replace
131 Pop $0
132 DetailPrint "Replace: ${BASE}->$base in $0"
133 ClearErrors
134 FileOpen $1 $0 r
135 IfErrors fail
136 FileOpen $2 "$0.new" w
137 IfErrors fail loop
138
139 fail:
140 Abort
141
142 loop:
143 FileRead $1 $3
144 IfErrors done
145 ${WordReplace} "$3" "${BASE}" "$base" "+" $3
146 FileWrite $2 $3
147 Goto loop
148
149 done:
150 FileClose $1
151 FileClose $2
152 Delete $0
153 Rename "$0.new" $0
154 FunctionEnd

Properties

Name Value
svn:keywords Id
svn:mergeinfo