2020-05-28 22:35:45 +02:00
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// Delphi MVC Framework
|
|
|
|
//
|
2024-01-02 17:04:27 +01:00
|
|
|
// Copyright (c) 2010-2024 Daniele Teti and the DMVCFramework Team
|
2020-05-28 22:35:45 +02:00
|
|
|
//
|
|
|
|
// https://github.com/danieleteti/delphimvcframework
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
//
|
|
|
|
// This IDE expert is based off of the one included with the DUnitX
|
2024-04-12 12:28:34 +02:00
|
|
|
// project. Original source by Robert Love. Adapted by Nick Hodges and Daniele Teti.
|
2020-05-28 22:35:45 +02:00
|
|
|
//
|
|
|
|
// The DUnitX project is run by Vincent Parrett and can be found at:
|
|
|
|
//
|
|
|
|
// https://github.com/VSoftTechnologies/DUnitX
|
|
|
|
// ***************************************************************************
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
unit DMVC.Expert.CodeGen.NewDMVCProject;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
ToolsAPI,
|
2024-04-12 12:28:34 +02:00
|
|
|
DMVC.Expert.CodeGen.NewProject, JsonDataObjects;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
type
|
|
|
|
TDMVCProjectFile = class(TNewProjectEx)
|
2016-02-24 22:37:13 +01:00
|
|
|
private
|
2024-04-12 12:28:34 +02:00
|
|
|
fConfigModelRef: TJsonObject;
|
2016-02-23 01:41:13 +01:00
|
|
|
protected
|
|
|
|
function NewProjectSource(const ProjectName: string): IOTAFile; override;
|
|
|
|
function GetFrameworkType: string; override;
|
|
|
|
public
|
|
|
|
constructor Create; overload;
|
2024-04-12 12:28:34 +02:00
|
|
|
constructor Create(const APersonality: string; const ConfigModelRef: TJSONObject); overload;
|
2016-02-23 01:41:13 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
DMVC.Expert.CodeGen.SourceFile,
|
2024-04-12 12:28:34 +02:00
|
|
|
System.SysUtils,
|
|
|
|
DMVC.Expert.CodeGen.Executor,
|
|
|
|
DMVC.Expert.Commands.Templates,
|
|
|
|
DMVC.Expert.Commons;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
constructor TDMVCProjectFile.Create;
|
|
|
|
begin
|
2016-02-24 22:37:13 +01:00
|
|
|
// TODO: Figure out how to make this be DMVCProjectX where X is the next available.
|
|
|
|
// Return Blank and the project will be 'ProjectX.dpr' where X is the next available number
|
2023-10-23 11:05:07 +02:00
|
|
|
inherited;
|
2016-02-23 01:41:13 +01:00
|
|
|
FFileName := '';
|
|
|
|
end;
|
|
|
|
|
2024-04-12 12:28:34 +02:00
|
|
|
constructor TDMVCProjectFile.Create(const APersonality: string; const ConfigModelRef: TJSONObject);
|
2016-02-23 01:41:13 +01:00
|
|
|
begin
|
|
|
|
Create;
|
|
|
|
Personality := APersonality;
|
2024-04-12 12:28:34 +02:00
|
|
|
fConfigModelRef := ConfigModelRef;
|
2016-02-23 01:41:13 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TDMVCProjectFile.GetFrameworkType: string;
|
|
|
|
begin
|
|
|
|
Result := 'VCL';
|
|
|
|
end;
|
|
|
|
|
|
|
|
function TDMVCProjectFile.NewProjectSource(const ProjectName: string): IOTAFile;
|
|
|
|
begin
|
2024-04-12 12:28:34 +02:00
|
|
|
fConfigModelRef.S[TConfigKey.program_name] := ProjectName;
|
|
|
|
Result := TSourceFile.Create(
|
|
|
|
procedure (Gen: TMVCCodeGenerator)
|
|
|
|
begin
|
|
|
|
FillProgramTemplates(Gen);
|
|
|
|
end,
|
|
|
|
fConfigModelRef);
|
2016-02-24 22:37:13 +01:00
|
|
|
end;
|
|
|
|
|
2016-02-23 01:41:13 +01:00
|
|
|
end.
|