Skip to content

Commit 3dc4e6b

Browse files
author
Tony Junkes
committed
Add create subsystem / cleanup
1 parent 88c261f commit 3dc4e6b

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ A collection of commands to be used with CommandBox for working with FW/1
3232

3333
`fw1 create layout myLayout`
3434

35+
#### Create Subsystems
36+
37+
`fw1 create subsystem mySubsystem`
38+
3539
### A work in progress!
3640

3741
This is all still being pieced together so some features may change and new features will be added so stay tuned!

box.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "FW/1 Commands",
33
"slug" : "fw1-commands",
4-
"version" : "0.3.0",
4+
"version" : "0.4.0",
55
"author" : "Tony Junkes @cfchef",
66
"location" : "https://github.com/cfchef/fw1-commands/archive/master.zip",
77
"createPackageDirectory" : true,

fw1/create/app.cfc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ component displayname="FW/1 Create Application Command"
3939
}
4040

4141
/**
42-
* @name The name of the app being created.
43-
* @skeleton The name of the app skeleton to generate.
42+
* @name.hint The name of the app being created.
43+
* @skeleton.hint The name of the app skeleton to generate.
4444
* @skeleton.options Examples, Skeleton, Basic, Subsystem
45-
* @directory The directory to create the app in. Defaults to current working directory.
46-
* @installFW1 Install the latest stable version of FW/1 from ForgeBox.
47-
* @package Generate a box.json to make the current directory a package.
45+
* @directory.hint The directory to create the app in. Defaults to current working directory.
46+
* @installFW1.hint Install the latest stable version of FW/1 from ForgeBox.
47+
* @package.hint Generate a box.json to make the current directory a package.
4848
*/
4949
public void function run(
5050
name = "My FW/1 App",

fw1/create/subsystem.cfc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// BASED FROM THE COLDBOX "APP.CFC" COMMAND - https://github.com/Ortus-Solutions/commandbox/tree/master/src/cfml/commands/coldbox/create
2+
/**
3+
* Create a individual FW/1 subsystem skeleton structure.
4+
* .
5+
* {code:bash}
6+
* fw1 create subsystem mySubsystem
7+
* {code}
8+
* .
9+
* By default, the subsystem will be created in the current working directory
10+
* but can be overridden.
11+
* .
12+
* {code:bash}
13+
* fw1 create subsystem mySubsystem myDirectory
14+
* {code}
15+
*/
16+
component displayname="FW/1 Create Subsystem Command"
17+
extends="commandbox.system.BaseCommand"
18+
excludeFromHelp=false
19+
{
20+
/**
21+
* @name.hint The name of the app being created.
22+
* @directory.hint The directory to create the app in. Defaults to the subsystem name passed in.
23+
*/
24+
public void function run(
25+
required name,
26+
directory = getCWD()
27+
) {
28+
var skeletonLocation = getDirectoryFromPath( getCurrentTemplatePath() ) & "/../resources/templates/";
29+
// This will make the directory canonical and absolute
30+
arguments.directory = fileSystemUtil.resolvePath( arguments.directory );
31+
// Validate directory, if it doesn't exist, create it
32+
if ( !directoryExists( arguments.directory & "/" & arguments.name ) ) {
33+
directoryCreate( arguments.directory & "/" & arguments.name );
34+
}
35+
// Unzip the skeleton
36+
zip action="unzip" destination="#arguments.directory#/#arguments.name#" file="#skeletonLocation#SubsystemTemplate.zip";
37+
// Success message
38+
print.line().greenLine(
39+
"#arguments.name# FW/1 subsystem successfully created in [#arguments.directory#]"
40+
);
41+
}
42+
}
1.58 KB
Binary file not shown.

0 commit comments

Comments
 (0)