Skip to content
This repository has been archived by the owner on Sep 26, 2021. It is now read-only.

Commit

Permalink
Fix metrics bugs on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
  • Loading branch information
jmorganca committed Nov 6, 2015
1 parent 07d75d5 commit d5dca18
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 108 deletions.
5 changes: 1 addition & 4 deletions Dockerfile.osx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN curl -fsSL -o /vbox.dmg http://download.virtualbox.org/virtualbox/$VBOX_VERS

# Download the Docker parts

ENV INSTALLER_VERSION 1.9.0
ENV INSTALLER_VERSION 1.9.0a
ENV DOCKER_VERSION 1.9.0
# RUN curl -fsSL -o /docker https://test.docker.com/builds/Darwin/x86_64/docker-$DOCKER_VERSION
RUN curl -fsSL -o docker https://get.docker.com/builds/Darwin/x86_64/docker-$DOCKER_VERSION
Expand Down Expand Up @@ -192,9 +192,6 @@ RUN sed -i \
RUN sed -i \
-e "s/%INSTALLER_VERSION%/$INSTALLER_VERSION/g" \
mpkg/Resources/en.lproj/welcome.rtfd/TXT.rtf
RUN sed -i \
-e "s/%INSTALLER_VERSION%/$INSTALLER_VERSION/g" \
mpkg/Resources/en.lproj/Installed.html
RUN sed -i \
-e "s/%VBOX_VERSION%/$VBOX_VERSION/g" \
/mpkg/Distribution && \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN cd innosetup && \
wine "./innounp.exe" -e "is-unicode.exe"

# installer components
ENV INSTALLER_VERSION 1.9.0
ENV INSTALLER_VERSION 1.9.0a
ENV DOCKER_VERSION 1.9.0
ENV DOCKER_MACHINE_VERSION 0.5.0
ENV DOCKER_COMPOSE_VERSION 1.5.0
Expand Down
19 changes: 8 additions & 11 deletions osx/installerplugins/overviewplugin/Base.lproj/overviewplugin.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="15A263e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15C27e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="InstallerSection">
Expand Down Expand Up @@ -31,9 +31,6 @@
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="checkboxChanged:" target="Qsn-FY-4qK" id="mbj-pc-e04"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xi8-N0-Reb">
<rect key="frame" x="18" y="63" width="382" height="51"/>
Expand All @@ -47,20 +44,20 @@
</textField>
<scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="0.0" verticalPageScroll="0.0" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e5n-p7-Zro">
<rect key="frame" x="14" y="149" width="390" height="170"/>
<clipView key="contentView" misplaced="YES" id="GuL-k4-Axf">
<rect key="frame" x="1" y="1" width="223" height="133"/>
<clipView key="contentView" ambiguous="YES" id="GuL-k4-Axf">
<rect key="frame" x="0.0" y="0.0" width="390" height="170"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView horizontalCompressionResistancePriority="250" editable="NO" importsGraphics="NO" verticallyResizable="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="cgA-DY-Gw8">
<rect key="frame" x="0.0" y="0.0" width="223" height="190"/>
<textView horizontalCompressionResistancePriority="250" ambiguous="YES" editable="NO" importsGraphics="NO" verticallyResizable="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" allowsNonContiguousLayout="YES" quoteSubstitution="YES" dashSubstitution="YES" spellingCorrection="YES" smartInsertDelete="YES" id="cgA-DY-Gw8">
<rect key="frame" x="0.0" y="0.0" width="390" height="207"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<size key="minSize" width="390" height="170"/>
<size key="maxSize" width="463" height="170"/>
<size key="maxSize" width="463" height="207"/>
<color key="insertionPointColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="390" height="170"/>
<size key="maxSize" width="463" height="170"/>
<size key="maxSize" width="463" height="207"/>
</textView>
</subviews>
<animations/>
Expand Down
1 change: 0 additions & 1 deletion osx/installerplugins/overviewplugin/overviewpluginPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import <InstallerPlugins/InstallerPlugins.h>

@interface overviewpluginPane : InstallerPane
- (IBAction)checkboxChanged:(id)sender;
@property (unsafe_unretained) IBOutlet NSTextView *textView;
@property (weak) IBOutlet NSButton *checkbox;
@end
Binary file not shown.
Binary file not shown.
14 changes: 0 additions & 14 deletions osx/mpkg/Resources/en.lproj/Installed.html

This file was deleted.

90 changes: 21 additions & 69 deletions windows/Toolbox.iss
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Source: ".\start.sh"; DestDir: "{app}"; Flags: ignoreversion; Components: "Docke
Source: ".\delete.sh"; DestDir: "{app}"; Flags: ignoreversion; Components: "Docker"
Source: "{#dockerMachineCli}"; DestDir: "{app}"; Flags: ignoreversion; Components: "DockerMachine"
Source: "{#dockerComposeCli}"; DestDir: "{app}"; Flags: ignoreversion; Components: "DockerCompose"
Source: ".\migrate.sh"; DestDir: "{app}"; Flags: ignoreversion; Components: "DockerMachine"
Source: ".\migrate.bat"; DestDir: "{app}"; Flags: ignoreversion; Components: "DockerMachine"
Source: "{#kitematic}\*"; DestDir: "{app}\kitematic"; Flags: ignoreversion recursesubdirs; Components: "Kitematic"
Source: "{#b2dIsoPath}"; DestDir: "{app}"; Flags: ignoreversion; Components: "DockerMachine"; AfterInstall: CopyBoot2DockerISO()
Source: "{#git}"; DestDir: "{app}\installers\git"; DestName: "git.exe"; AfterInstall: RunInstallGit(); Components: "Git"
Expand Down Expand Up @@ -98,7 +96,7 @@ Root: HKCU; Subkey: "Environment"; ValueType:string; ValueName:"DOCKER_TOOLBOX_I
var
restart: boolean;
TrackingDisabled: Boolean;
TrackingDisabled: Boolean;
TrackingCheckBox: TNewCheckBox;
function uuid(): String;
Expand Down Expand Up @@ -140,15 +138,20 @@ begin
end;
end;
procedure TrackEvent(name: String);
procedure TrackEventWithProperties(name: String; properties: String);
var
payload: String;
WinHttpReq: Variant;
tracking: String;
begin
if TrackingDisabled or WizardSilent() then
exit;
if Length(properties) > 0 then
properties := ', ' + properties;
try
payload := Encode64(Format(ExpandConstant('{{"event": "%s", "properties": {{"token": "{#MixpanelToken}", "distinct_id": "%s", "os": "win32", "os version": "%s", "version": "{#MyAppVersion}"}}'), [name, uuid(), WindowsVersionString()]));
payload := Encode64(Format(ExpandConstant('{{"event": "%s", "properties": {{"token": "{#MixpanelToken}", "distinct_id": "%s", "os": "win32", "os version": "%s", "version": "{#MyAppVersion}" %s}}'), [name, uuid(), WindowsVersionString(), properties]));
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('POST', 'https://api.mixpanel.com/track/?data=' + payload, false);
WinHttpReq.SetRequestHeader('Content-Type', 'application/json');
Expand All @@ -157,9 +160,9 @@ begin
end;
end;
function NeedRestart(): Boolean;
procedure TrackEvent(name: String);
begin
Result := restart;
TrackEventWithProperties(name, '');
end;
function NeedToInstallVirtualBox(): Boolean;
Expand All @@ -186,17 +189,6 @@ begin
Result := not DirExists('C:\Program Files\Git') or not FileExists('C:\Program Files\Git\git-bash.exe')
end;
procedure TrackingCheckBoxClicked(Sender: TObject);
begin
if TrackingCheckBox.Checked then begin
TrackingDisabled := False;
TrackEvent('Enabled Tracking');
end else begin
TrackEvent('Disabled Tracking');
TrackingDisabled := True;
end;
end;
procedure InitializeWizard;
var
WelcomePage: TWizardPage;
Expand All @@ -211,11 +203,10 @@ begin
TrackingCheckBox.Top := WizardForm.WelcomeLabel2.Top + WizardForm.WelcomeLabel2.Height + 10;
TrackingCheckBox.Left := WizardForm.WelcomeLabel2.Left;
TrackingCheckBox.Width := WizardForm.WelcomeLabel2.Width;
TrackingCheckBox.Height := 40;
TrackingCheckBox.Height := 28;
TrackingCheckBox.Caption := 'Help Docker improve Toolbox.';
TrackingCheckBox.Checked := True;
TrackingCheckBox.Parent := WelcomePage.Surface;
TrackingCheckBox.OnClick := @TrackingCheckboxClicked;
TrackingLabel := TLabel.Create(WizardForm);
TrackingLabel.Parent := WelcomePage.Surface;
Expand All @@ -226,8 +217,8 @@ begin
TrackingLabel.Visible := True;
TrackingLabel.Left := WizardForm.WelcomeLabel2.Left;
TrackingLabel.Width := WizardForm.WelcomeLabel2.Width;
TrackingLabel.Top := TrackingCheckBox.Top + TrackingCheckBox.Height + 20;
TrackingLabel.Height := 300;
TrackingLabel.Top := TrackingCheckBox.Top + TrackingCheckBox.Height + 5;
TrackingLabel.Height := 50;
// Don't do this until we can compare versions
// Wizardform.ComponentsList.Checked[3] := NeedToInstallVirtualBox();
Expand All @@ -245,7 +236,13 @@ end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpWelcome then begin
TrackEvent('Continued from Overview');
if TrackingCheckBox.Checked then begin
TrackEventWithProperties('Continued from Overview', '"Tracking Enabled": "Yes"');
TrackingDisabled := False;
end else begin
TrackEventWithProperties('Continued from Overview', '"Tracking Enabled": "No"');
TrackingDisabled := True;
end;
end;
Result := True
end;
Expand Down Expand Up @@ -329,49 +326,6 @@ begin
Result := true
end;
function MigrateVM() : Boolean;
var
ResultCode: Integer;
begin
if NeedToInstallGit() or NeedToInstallVirtualBox() or not FileExists(ExpandConstant('{app}\docker-machine.exe')) then begin
Result := true
exit
end;
ExecAsOriginalUser(VBoxPath() + 'VBoxManage.exe', 'showvminfo default', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
if ResultCode <> 1 then begin
Result := true
exit
end;
ExecAsOriginalUser(VBoxPath() + 'VBoxManage.exe', 'showvminfo boot2docker-vm', '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
if ResultCode <> 0 then begin
Result := true
exit
end;
TrackEvent('Boot2Docker Migration Started');
WizardForm.StatusLabel.Caption := 'Migrating Boot2Docker VM...'
WizardForm.FilenameLabel.Caption := 'This will take a minute...'
ExecAsOriginalUser(ExpandConstant('{app}\docker-machine.exe'), ExpandConstant('rm -f default > nul 2>&1'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
DelTree(ExpandConstant('{userdocs}\..\.docker\machine\machines\default'), True, True, True);
ExecAsOriginalUser(ExpandConstant('{app}\migrate.bat'), ExpandConstant('> {localappdata}\Temp\toolbox-migration-logs.txt 2>&1'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
if ResultCode = 0 then
begin
TrackEvent('Boot2Docker Migration Succeeded');
MsgBox('Succcessfully migrated Boot2Docker VM to a Docker Machine VM named "default"', mbInformation, MB_OK);
end
else begin
TrackEvent('Boot2Docker Migration Failed');
MsgBox('Migration of Boot2Docker VM failed. Please file an issue with the migration logs at https://github.com/docker/toolbox/issues/new.', mbCriticalError, MB_OK);
Exec(ExpandConstant('{win}\notepad.exe'), ExpandConstant('{localappdata}\Temp\toolbox-migration-logs.txt'), '', SW_SHOW, ewNoWait, ResultCode)
Result := false
WizardForm.Close;
exit;
end;
Result := true
end;
const
ModPathName = 'modifypath';
ModPathType = 'user';
Expand All @@ -390,6 +344,7 @@ begin
Success := True;
if CurStep = ssPostInstall then
begin
trackEvent('Installing Files Succeeded');
if IsTaskSelected(ModPathName) then
ModPath();
if not WizardSilent() then
Expand All @@ -399,9 +354,6 @@ begin
if CanUpgradeVM() then begin
Success := UpgradeVM();
end;
// else begin
// Success := MigrateVM();
// end;
end;
end;
Expand Down
4 changes: 0 additions & 4 deletions windows/migrate.bat

This file was deleted.

4 changes: 0 additions & 4 deletions windows/migrate.sh

This file was deleted.

0 comments on commit d5dca18

Please sign in to comment.