Skip to content

Commit

Permalink
Merge branch 'master' of github.com:HashLoad/delphi-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
snakeice committed Apr 9, 2019
2 parents 0c9eaae + 8596a36 commit 688eafd
Show file tree
Hide file tree
Showing 42 changed files with 1,376 additions and 5,669 deletions.
19 changes: 10 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@

# Created by https://www.gitignore.io/api/delphi
# Edit at https://www.gitignore.io/?templates=delphi

### Delphi ###
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#
# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
#*.res
#
# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
#
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
# Uncomment this if you are not using diagrams or use newer Delphi version.
#*.ddp
#
# Visual LiveBindings file. Added in Delphi XE2.
# Uncomment this if you are not using LiveBindings Designer.
#*.vlb
#
# Deployment Manager configuration file for your project. Added in Delphi XE2.
# Uncomment this if it is not mobile development and you do not use remote debug feature.
#*.deployproj
#
# C++ object files produced when C/C++ Output file generation is configured.
# Uncomment this if you are not using external objects (zlib library for example).
#*.obj
#

# Delphi compiler-generated binaries (safe to delete)
*.exe
Expand Down Expand Up @@ -61,9 +60,11 @@
__history/
__recovery/
*.~*
modules/

# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat
*.cbk
modules

# Boss dependency manager vendor folder https://github.com/HashLoad/boss
modules/

# End of https://www.gitignore.io/api/delphi
13 changes: 4 additions & 9 deletions DelphiDocker.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ requires

contains
OpenToolApi.Register in 'Src\OpenToolApi\OpenToolApi.Register.pas',
OpenToolApi.ToolBarItem in 'Src\OpenToolApi\OpenToolApi.ToolBarItem.pas' {ToolBarItem: TDataModule},
Command.Runner in 'Src\Command\Command.Runner.pas',
OpenToolApi.CommandMessage in 'Src\OpenToolApi\OpenToolApi.CommandMessage.pas',
OpenToolApi.LocalMenuItem in 'Src\OpenToolApi\OpenToolApi.LocalMenuItem.pas',
OpenToolApi.Events in 'Src\OpenToolApi\OpenToolApi.Events.pas',
UtilityFunctions in 'Src\OpenToolApi\UtilityFunctions.pas',
Command.Cmd in 'Src\Command\Command.Cmd.pas',
Command.Message in 'Src\Command\Command.Message.pas',
Docker.Utils in 'Src\Docker\Docker.Utils.pas',
Wrapper.Docker in 'Src\Wrapper\Wrapper.Docker.pas',
Wrapper.DockerCompose in 'Src\Wrapper\Wrapper.DockerCompose.pas',
Docker.RunWithDocker in 'Src\Docker\Docker.RunWithDocker.pas';
OpenToolApi.Tools in 'Src\OpenToolApi\OpenToolApi.Tools.pas',
Docker.RunWithDocker in 'Src\Docker\Docker.RunWithDocker.pas',
Constants.Version in 'Src\Constants\Constants.Version.pas',
OpenToolApi.MenuItem in 'Src\OpenToolApi\OpenToolApi.MenuItem.pas';

end.
15 changes: 3 additions & 12 deletions DelphiDocker.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,13 @@
<DCCReference Include="rtl.dcp"/>
<DCCReference Include="designide.dcp"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.Register.pas"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.ToolBarItem.pas">
<Form>ToolBarItem</Form>
<FormType>dfm</FormType>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="Src\Command\Command.Runner.pas"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.CommandMessage.pas"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.LocalMenuItem.pas"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.Events.pas"/>
<DCCReference Include="Src\OpenToolApi\UtilityFunctions.pas"/>
<DCCReference Include="Src\Command\Command.Cmd.pas"/>
<DCCReference Include="Src\Command\Command.Message.pas"/>
<DCCReference Include="Src\Docker\Docker.Utils.pas"/>
<DCCReference Include="Src\Wrapper\Wrapper.Docker.pas"/>
<DCCReference Include="Src\Wrapper\Wrapper.DockerCompose.pas"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.Tools.pas"/>
<DCCReference Include="Src\Docker\Docker.RunWithDocker.pas"/>
<DCCReference Include="Src\Constants\Constants.Version.pas"/>
<DCCReference Include="Src\OpenToolApi\OpenToolApi.MenuItem.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
Expand Down
Binary file removed DelphiDocker.res
Binary file not shown.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# delphi-docker
# delphi-docker
Visual tool integrated with the IDE to aid in the execution and creation of containers Docker.

### For install in your project using [boss](https://github.com/HashLoad/boss):
``` sh
$ boss install -g github.com/HashLoad/delphi-docker
```
79 changes: 0 additions & 79 deletions Src/Command/Command.Cmd.pas

This file was deleted.

63 changes: 0 additions & 63 deletions Src/Command/Command.Message.pas

This file was deleted.

66 changes: 40 additions & 26 deletions Src/Command/Command.Runner.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,68 @@
interface

uses
DOSCommand, OpenToolApi.CommandMessage;
DOSCommand, OpenToolApi.CommandMessage, OpenToolApi.Tools, System.Classes;

function Runner(APath, ACommand: string): Integer; overload;
function Runner(ACommand: string): Integer; overload;
type
TRunnerReturn = record
ExitCode: Integer;
Output: string;
constructor Create(AExitCode: Integer; AOutput: string);
end;

function Runner(APath, ACommand: string): TRunnerReturn; overload;
function Runner(ACommand: string): TRunnerReturn; overload;

implementation

uses
System.SysUtils, Vcl.Forms;

var
FMonitorLock: TObject;
procedure OnReadLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType);
begin
TCommandMessage.GetInstance.WriteLn(ANewLine);
end;

function DoRunner(APath, ACommand: string): Integer;
function DoRunner(APath, ACommand: string): TRunnerReturn;
var
LDosCommand: TDosCommand;
begin
//System.TMonitor.Enter(FMonitorLock);
LDosCommand := TDosCommand.Create(nil);
try
LDosCommand := TDosCommand.Create(nil);
try
// LDosCommand.InputToOutput := False;
LDosCommand.CurrentDir := APath;
LDosCommand.CommandLine := ACommand;
LDosCommand.Execute;

while LDosCommand.IsRunning do
begin
Application.ProcessMessages;
end;

Result := LDosCommand.ExitCode;
finally
LDosCommand.Free;
TCommandMessage.GetInstance.WriteLn(APath + '>' + ACommand);
LDosCommand.OnNewLine := OnReadLine;
LDosCommand.InputToOutput := False;
LDosCommand.CurrentDir := APath;
LDosCommand.CommandLine := ACommand;
LDosCommand.Execute;

while LDosCommand.IsRunning do
begin
Application.ProcessMessages;
end;

Result := TRunnerReturn.Create(LDosCommand.ExitCode, LDosCommand.Lines.Text);
finally
// System.TMonitor.Exit(FMonitorLock);
LDosCommand.Free;
end;
end;

function Runner(ACommand: string): Integer;
function Runner(ACommand: string): TRunnerReturn;
begin
Result := DoRunner('C:/', ACommand);
Result := DoRunner(ExtractFilePath(ActiveProject.FileName), ACommand);
end;

function Runner(APath, ACommand: string): Integer;
function Runner(APath, ACommand: string): TRunnerReturn;
begin
Result := DoRunner(APath, ACommand);
end;

{ TRunnerReturn }

constructor TRunnerReturn.Create(AExitCode: Integer; AOutput: string);
begin
ExitCode := AExitCode;
Output := AOutput;
end;

end.
Loading

0 comments on commit 688eafd

Please sign in to comment.