Skip to content

Commit 688eafd

Browse files
committed
Merge branch 'master' of github.com:HashLoad/delphi-docker
2 parents 0c9eaae + 8596a36 commit 688eafd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1376
-5669
lines changed

.gitignore

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1+
2+
# Created by https://www.gitignore.io/api/delphi
3+
# Edit at https://www.gitignore.io/?templates=delphi
4+
5+
### Delphi ###
16
# Uncomment these types if you want even more clean repository. But be careful.
27
# It can make harm to an existing project source. Read explanations below.
38
#
49
# Resource files are binaries containing manifest, project icon and version info.
510
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
611
#*.res
7-
#
812
# Type library file (binary). In old Delphi versions it should be stored.
913
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
1014
#*.tlb
11-
#
1215
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
1316
# Uncomment this if you are not using diagrams or use newer Delphi version.
1417
#*.ddp
15-
#
1618
# Visual LiveBindings file. Added in Delphi XE2.
1719
# Uncomment this if you are not using LiveBindings Designer.
1820
#*.vlb
19-
#
2021
# Deployment Manager configuration file for your project. Added in Delphi XE2.
2122
# Uncomment this if it is not mobile development and you do not use remote debug feature.
2223
#*.deployproj
23-
#
2424
# C++ object files produced when C/C++ Output file generation is configured.
2525
# Uncomment this if you are not using external objects (zlib library for example).
2626
#*.obj
27-
#
2827

2928
# Delphi compiler-generated binaries (safe to delete)
3029
*.exe
@@ -61,9 +60,11 @@
6160
__history/
6261
__recovery/
6362
*.~*
64-
modules/
6563

6664
# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
6765
*.stat
68-
*.cbk
69-
modules
66+
67+
# Boss dependency manager vendor folder https://github.com/HashLoad/boss
68+
modules/
69+
70+
# End of https://www.gitignore.io/api/delphi

DelphiDocker.dpk

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,12 @@ requires
3535

3636
contains
3737
OpenToolApi.Register in 'Src\OpenToolApi\OpenToolApi.Register.pas',
38-
OpenToolApi.ToolBarItem in 'Src\OpenToolApi\OpenToolApi.ToolBarItem.pas' {ToolBarItem: TDataModule},
3938
Command.Runner in 'Src\Command\Command.Runner.pas',
4039
OpenToolApi.CommandMessage in 'Src\OpenToolApi\OpenToolApi.CommandMessage.pas',
4140
OpenToolApi.LocalMenuItem in 'Src\OpenToolApi\OpenToolApi.LocalMenuItem.pas',
42-
OpenToolApi.Events in 'Src\OpenToolApi\OpenToolApi.Events.pas',
43-
UtilityFunctions in 'Src\OpenToolApi\UtilityFunctions.pas',
44-
Command.Cmd in 'Src\Command\Command.Cmd.pas',
45-
Command.Message in 'Src\Command\Command.Message.pas',
46-
Docker.Utils in 'Src\Docker\Docker.Utils.pas',
47-
Wrapper.Docker in 'Src\Wrapper\Wrapper.Docker.pas',
48-
Wrapper.DockerCompose in 'Src\Wrapper\Wrapper.DockerCompose.pas',
49-
Docker.RunWithDocker in 'Src\Docker\Docker.RunWithDocker.pas';
41+
OpenToolApi.Tools in 'Src\OpenToolApi\OpenToolApi.Tools.pas',
42+
Docker.RunWithDocker in 'Src\Docker\Docker.RunWithDocker.pas',
43+
Constants.Version in 'Src\Constants\Constants.Version.pas',
44+
OpenToolApi.MenuItem in 'Src\OpenToolApi\OpenToolApi.MenuItem.pas';
5045

5146
end.

DelphiDocker.dproj

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,13 @@
115115
<DCCReference Include="rtl.dcp"/>
116116
<DCCReference Include="designide.dcp"/>
117117
<DCCReference Include="Src\OpenToolApi\OpenToolApi.Register.pas"/>
118-
<DCCReference Include="Src\OpenToolApi\OpenToolApi.ToolBarItem.pas">
119-
<Form>ToolBarItem</Form>
120-
<FormType>dfm</FormType>
121-
<DesignClass>TDataModule</DesignClass>
122-
</DCCReference>
123118
<DCCReference Include="Src\Command\Command.Runner.pas"/>
124119
<DCCReference Include="Src\OpenToolApi\OpenToolApi.CommandMessage.pas"/>
125120
<DCCReference Include="Src\OpenToolApi\OpenToolApi.LocalMenuItem.pas"/>
126-
<DCCReference Include="Src\OpenToolApi\OpenToolApi.Events.pas"/>
127-
<DCCReference Include="Src\OpenToolApi\UtilityFunctions.pas"/>
128-
<DCCReference Include="Src\Command\Command.Cmd.pas"/>
129-
<DCCReference Include="Src\Command\Command.Message.pas"/>
130-
<DCCReference Include="Src\Docker\Docker.Utils.pas"/>
131-
<DCCReference Include="Src\Wrapper\Wrapper.Docker.pas"/>
132-
<DCCReference Include="Src\Wrapper\Wrapper.DockerCompose.pas"/>
121+
<DCCReference Include="Src\OpenToolApi\OpenToolApi.Tools.pas"/>
133122
<DCCReference Include="Src\Docker\Docker.RunWithDocker.pas"/>
123+
<DCCReference Include="Src\Constants\Constants.Version.pas"/>
124+
<DCCReference Include="Src\OpenToolApi\OpenToolApi.MenuItem.pas"/>
134125
<BuildConfiguration Include="Release">
135126
<Key>Cfg_2</Key>
136127
<CfgParent>Base</CfgParent>

DelphiDocker.res

-664 Bytes
Binary file not shown.

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
# delphi-docker
1+
# delphi-docker
2+
Visual tool integrated with the IDE to aid in the execution and creation of containers Docker.
3+
4+
### For install in your project using [boss](https://github.com/HashLoad/boss):
5+
``` sh
6+
$ boss install -g github.com/HashLoad/delphi-docker
7+
```

Src/Command/Command.Cmd.pas

Lines changed: 0 additions & 79 deletions
This file was deleted.

Src/Command/Command.Message.pas

Lines changed: 0 additions & 63 deletions
This file was deleted.

Src/Command/Command.Runner.pas

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,54 +3,68 @@
33
interface
44

55
uses
6-
DOSCommand, OpenToolApi.CommandMessage;
6+
DOSCommand, OpenToolApi.CommandMessage, OpenToolApi.Tools, System.Classes;
77

8-
function Runner(APath, ACommand: string): Integer; overload;
9-
function Runner(ACommand: string): Integer; overload;
8+
type
9+
TRunnerReturn = record
10+
ExitCode: Integer;
11+
Output: string;
12+
constructor Create(AExitCode: Integer; AOutput: string);
13+
end;
14+
15+
function Runner(APath, ACommand: string): TRunnerReturn; overload;
16+
function Runner(ACommand: string): TRunnerReturn; overload;
1017

1118
implementation
1219

1320
uses
1421
System.SysUtils, Vcl.Forms;
1522

16-
var
17-
FMonitorLock: TObject;
23+
procedure OnReadLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType);
24+
begin
25+
TCommandMessage.GetInstance.WriteLn(ANewLine);
26+
end;
1827

19-
function DoRunner(APath, ACommand: string): Integer;
28+
function DoRunner(APath, ACommand: string): TRunnerReturn;
2029
var
2130
LDosCommand: TDosCommand;
2231
begin
23-
//System.TMonitor.Enter(FMonitorLock);
32+
LDosCommand := TDosCommand.Create(nil);
2433
try
25-
LDosCommand := TDosCommand.Create(nil);
26-
try
27-
// LDosCommand.InputToOutput := False;
28-
LDosCommand.CurrentDir := APath;
29-
LDosCommand.CommandLine := ACommand;
30-
LDosCommand.Execute;
31-
32-
while LDosCommand.IsRunning do
33-
begin
34-
Application.ProcessMessages;
35-
end;
36-
37-
Result := LDosCommand.ExitCode;
38-
finally
39-
LDosCommand.Free;
34+
TCommandMessage.GetInstance.WriteLn(APath + '>' + ACommand);
35+
LDosCommand.OnNewLine := OnReadLine;
36+
LDosCommand.InputToOutput := False;
37+
LDosCommand.CurrentDir := APath;
38+
LDosCommand.CommandLine := ACommand;
39+
LDosCommand.Execute;
40+
41+
while LDosCommand.IsRunning do
42+
begin
43+
Application.ProcessMessages;
4044
end;
45+
46+
Result := TRunnerReturn.Create(LDosCommand.ExitCode, LDosCommand.Lines.Text);
4147
finally
42-
// System.TMonitor.Exit(FMonitorLock);
48+
LDosCommand.Free;
4349
end;
4450
end;
4551

46-
function Runner(ACommand: string): Integer;
52+
function Runner(ACommand: string): TRunnerReturn;
4753
begin
48-
Result := DoRunner('C:/', ACommand);
54+
Result := DoRunner(ExtractFilePath(ActiveProject.FileName), ACommand);
4955
end;
5056

51-
function Runner(APath, ACommand: string): Integer;
57+
function Runner(APath, ACommand: string): TRunnerReturn;
5258
begin
5359
Result := DoRunner(APath, ACommand);
5460
end;
5561

62+
{ TRunnerReturn }
63+
64+
constructor TRunnerReturn.Create(AExitCode: Integer; AOutput: string);
65+
begin
66+
ExitCode := AExitCode;
67+
Output := AOutput;
68+
end;
69+
5670
end.

0 commit comments

Comments
 (0)