forked from zamronypj/fano-cli
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add capability to set to Fano specific release tag
- Loading branch information
Showing
6 changed files
with
215 additions
and
54 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
src/Tasks/Implementations/Project/Core/AddFanoRepoTaskImpl.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
(*!------------------------------------------------------------ | ||
* Fano CLI Application (https://fanoframework.github.io) | ||
* | ||
* @link https://github.com/fanoframework/fano-cli | ||
* @copyright Copyright (c) 2018 - 2020 Zamrony P. Juhara | ||
* @license https://github.com/fanoframework/fano-cli/blob/master/LICENSE (MIT) | ||
*------------------------------------------------------------- *) | ||
unit AddFanoRepoTaskImpl; | ||
|
||
interface | ||
|
||
{$MODE OBJFPC} | ||
{$H+} | ||
|
||
uses | ||
|
||
TaskOptionsIntf, | ||
TaskIntf, | ||
BaseGitRepoTaskImpl; | ||
|
||
type | ||
|
||
(*!-------------------------------------- | ||
* Task that add fano web framework git repository | ||
* as submodule | ||
* | ||
* @author Zamrony P. Juhara <zamronypj@yahoo.com> | ||
*---------------------------------------*) | ||
TAddFanoRepoTask = class(TBaseGitRepoTask) | ||
public | ||
function run( | ||
const opt : ITaskOptions; | ||
const longOpt : shortstring | ||
) : ITask; override; | ||
end; | ||
|
||
implementation | ||
|
||
uses | ||
|
||
sysutils; | ||
|
||
function TAddFanoRepoTask.run( | ||
const opt : ITaskOptions; | ||
const longOpt : shortstring | ||
) : ITask; | ||
var outputString : string; | ||
begin | ||
//need to call parent run() so baseDirectory can be initialized | ||
inherited run(opt, longOpt); | ||
|
||
// following line equals calling following command on shell | ||
// $ git submodule add fano_repo_url vendor/fano | ||
runGit(baseDirectory, ['submodule', 'add', FANO_REPO, 'vendor/fano'], outputString); | ||
writeln(outputString); | ||
result := self; | ||
end; | ||
end. |
69 changes: 69 additions & 0 deletions
69
src/Tasks/Implementations/Project/Core/CheckoutFanoRepoTaskImpl.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
(*!------------------------------------------------------------ | ||
* Fano CLI Application (https://fanoframework.github.io) | ||
* | ||
* @link https://github.com/fanoframework/fano-cli | ||
* @copyright Copyright (c) 2018 - 2020 Zamrony P. Juhara | ||
* @license https://github.com/fanoframework/fano-cli/blob/master/LICENSE (MIT) | ||
*------------------------------------------------------------- *) | ||
unit CheckoutFanoRepoTaskImpl; | ||
|
||
interface | ||
|
||
{$MODE OBJFPC} | ||
{$H+} | ||
|
||
uses | ||
|
||
TaskOptionsIntf, | ||
TaskIntf, | ||
BaseGitRepoTaskImpl; | ||
|
||
type | ||
|
||
(*!-------------------------------------- | ||
* Task that checkout fano web framework | ||
* to a specific release version | ||
* | ||
* @author Zamrony P. Juhara <zamronypj@yahoo.com> | ||
*---------------------------------------*) | ||
TCheckoutFanoRepoTask = class(TBaseGitRepoTask) | ||
public | ||
function run( | ||
const opt : ITaskOptions; | ||
const longOpt : shortstring | ||
) : ITask; override; | ||
end; | ||
|
||
implementation | ||
|
||
uses | ||
|
||
sysutils; | ||
|
||
function TCheckoutFanoRepoTask.run( | ||
const opt : ITaskOptions; | ||
const longOpt : shortstring | ||
) : ITask; | ||
var outputString : string; | ||
branch, fanoAbsDir : string; | ||
begin | ||
//need to call parent run() so baseDirectory can be initialized | ||
inherited run(opt, longOpt); | ||
|
||
if opt.hasOption('fano-ver') then | ||
begin | ||
branch := opt.getOptionValueDef('fano-ver', 'master'); | ||
fanoAbsDir := getCurrentDir() + '/' + baseDirectory + '/vendor/fano'; | ||
// following line equals calling following command on shell | ||
// $ cd vendor/fano | ||
// $ git checkout [[tag/branch]] | ||
runGit(fanoAbsDir, ['checkout', branch ], outputString); | ||
if (branch <> 'master') then | ||
begin | ||
runGit(fanoAbsDir, ['checkout', '-b', 'fano-' + branch ], outputString); | ||
end; | ||
writeln(outputString); | ||
end; | ||
result := self; | ||
end; | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/Tasks/Implementations/Project/Core/StageRepoTaskImpl.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
(*!------------------------------------------------------------ | ||
* Fano CLI Application (https://fanoframework.github.io) | ||
* | ||
* @link https://github.com/fanoframework/fano-cli | ||
* @copyright Copyright (c) 2018 - 2020 Zamrony P. Juhara | ||
* @license https://github.com/fanoframework/fano-cli/blob/master/LICENSE (MIT) | ||
*------------------------------------------------------------- *) | ||
unit StageRepoTaskImpl; | ||
|
||
interface | ||
|
||
{$MODE OBJFPC} | ||
{$H+} | ||
|
||
uses | ||
|
||
TaskOptionsIntf, | ||
TaskIntf, | ||
BaseGitRepoTaskImpl; | ||
|
||
type | ||
|
||
(*!-------------------------------------- | ||
* Task that stage new files so it is | ||
*ready for commit | ||
* | ||
* @author Zamrony P. Juhara <zamronypj@yahoo.com> | ||
*---------------------------------------*) | ||
TStageRepoTask = class(TBaseGitRepoTask) | ||
public | ||
function run( | ||
const opt : ITaskOptions; | ||
const longOpt : shortstring | ||
) : ITask; override; | ||
end; | ||
|
||
implementation | ||
|
||
uses | ||
|
||
sysutils; | ||
|
||
function TStageRepoTask.run( | ||
const opt : ITaskOptions; | ||
const longOpt : shortstring | ||
) : ITask; | ||
var outputString : string; | ||
begin | ||
//need to call parent run() so baseDirectory can be initialized | ||
inherited run(opt, longOpt); | ||
|
||
// following line equals calling following command on shell | ||
// $ git add . | ||
runGit(baseDirectory, ['add', '.'], outputString); | ||
writeln(outputString); | ||
|
||
result := self; | ||
end; | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters