|
1 | | -# fw1-commands (v0.4.1) |
2 | | -A collection of commands to be used with CommandBox for working with FW/1 |
| 1 | +# fw1-commands (v1.0.0) |
| 2 | +### A collection of CommandBox commands for working with FW/1 |
3 | 3 |
|
4 | | -### Installation |
| 4 | +## Installation |
5 | 5 |
|
6 | | -- First of all, make sure you have <a href="http://ortus.gitbooks.io/commandbox-documentation/content/setup/installation.html" target="_blank">CommandBox installed</a>. |
7 | | -- Open up your favorite terminal and enter `box install fw1-commands`. |
8 | | -- Done! Super simple. |
| 6 | +1. First, make sure you have <a href="http://ortus.gitbooks.io/commandbox-documentation/content/setup/installation.html" target="_blank">CommandBox installed</a>. |
| 7 | +2. Fire up your terminal and drop into CommandBox by entering `box`. |
| 8 | +3. Install FW/1 Commands by entering `install fw1-commands`. |
| 9 | +4. Done! |
9 | 10 |
|
10 | | -### What's available? (so far...) |
| 11 | +<br> |
11 | 12 |
|
12 | | -####App Skeleton Generation |
| 13 | +## Getting Started |
13 | 14 |
|
14 | | -`fw1 create app myApp basic` |
| 15 | +#### Application Skeleton Generation With `fw1 create app` |
15 | 16 |
|
16 | | -**Here's a list of available skeletons...** |
| 17 | +To get started quickly, _FW/1 Commands_ comes with a `create app` command that can be used to generate a ready-to-go application skeleton for you. |
17 | 18 |
|
18 | | -- Examples (the examples and introduction folders from the FW/1 repo) - `fw1 create app myApp examples` |
19 | | -- Skeleton (the skeleton folder from the FW/1 repo) - `fw1 create app myApp skeleton` |
20 | | -- Basic (a bare bones setup for a single application) - `fw1 create app myApp basic` |
21 | | -- Subsystem (a bare bones setup for a application with subsystems) - `fw1 create app myApp subsystem` |
| 19 | +###### _A simple example:_ |
22 | 20 |
|
23 | | -#### Create Views |
| 21 | +> `fw1 create app MyApp Basic` |
24 | 22 |
|
25 | | -`fw1 create view myView` |
| 23 | +To break it down further, `fw1` is the alias used that tells CommandBox that we are using _FW/1 Commands_. `create app` is instructing to use the `app` command located in the `create` driectory (check out the actual file structure of the command bundle to get a better idea). `MyApp` is the first parameter to be passed to the `app` command. This is the name of your application. `Basic` is the skeleton we chose to use as the base medium for out application structure. |
26 | 24 |
|
27 | | -#### Create Controllers |
| 25 | +<br> |
28 | 26 |
|
29 | | -`fw1 create controller myController default,add,edit,delete` |
| 27 | +## A Deeper Look Into `create app` |
30 | 28 |
|
31 | | -#### Create Beans |
| 29 | +###### `create app` can take up to 5 parameters. |
32 | 30 |
|
33 | | -`fw1 create bean MyBean` |
| 31 | +- `name` (type: string) - The name of your application. Defaults to "My FW/1 App" if no name is supplied. |
| 32 | +- `skeleton` (type: string) - The skeleton structure to generate. Defaults to `basic`. |
| 33 | +- `directory` (type: string) - The directory to generate the application skeleton in. If it does not exist, it will be created. Defaults to the current working directory. |
| 34 | +- `installFW1` (type: boolean) - Flags whether to install the latest version FW/1. Defaults to `false`. |
| 35 | +- `package` (type: boolean) - Flags whether to create a `box.json`. Defaults to `true`. |
34 | 36 |
|
35 | | -#### Create Layouts |
| 37 | +<br> |
36 | 38 |
|
37 | | -`fw1 create layout myLayout` |
| 39 | +#### Available Skeletons |
38 | 40 |
|
39 | | -#### Create Subsystems |
| 41 | +- *Examples*: (the examples and introduction folders from the FW/1 repo) - `fw1 create app myApp examples` |
| 42 | +- *Skeleton*: (the skeleton folder from the FW/1 repo) - `fw1 create app myApp skeleton` |
| 43 | +- *Basic*: (a bare bones setup for a single application) - `fw1 create app myApp basic` |
| 44 | +- *Subsystem*: (a bare bones setup for a application using subsystems 2.0 released with FW/1 3.5) - `fw1 create app myApp subsystem` |
| 45 | +- *Subsystem Legacy*: (a bare bones setup for a application using subsystems prior to 2.0) - `fw1 create app myApp subsystem-legacy` |
40 | 46 |
|
41 | | -`fw1 create subsystem mySubsystem` |
| 47 | +<br> |
42 | 48 |
|
43 | | -### A work in progress! |
| 49 | +#### Choosing A Directory to Generate In |
44 | 50 |
|
45 | | -This is all still being pieced together so some features may change and new features will be added so stay tuned! |
| 51 | +By default, _FW/1 Commands_ assumes that the current directory you are in on the command line is your current working directory and will generate the application in said directory. Should you need to install elsewhere, you can override this by passing in a path as the third parameter. |
| 52 | + |
| 53 | +###### _Example:_ |
| 54 | + |
| 55 | +> `fw1 create app MyApp basic path/to/my/directory` |
| 56 | +
|
| 57 | +<br> |
| 58 | + |
| 59 | +#### Including Framework One With Your New Application |
| 60 | + |
| 61 | +By default, FW/1 is not included with generated skeletons. The option to to use the master or development release is up to you. |
| 62 | + |
| 63 | +`create app` comes with a fourth parameter, `installFW1`, that when set to `true` will install the latest stable releast of FW/1. When you are in the working directory you want FW/1 to be installed in, you can pass the parmaeter in with double dashes. |
| 64 | + |
| 65 | +###### _Examples installing FW/1:_ |
| 66 | + |
| 67 | +> _Create in current working directory._ - `fw1 create app MyApp basic --installFw1` |
| 68 | +> _Create in a specified directory._ - `fw1 create app MyApp basic path/to/directory true` |
| 69 | +
|
| 70 | +To manually install the latest version of FW/1 all you need to do is enter this command in the command line: `install fw1`. To include the dev release, it's the same command but with that release's version number. For example: `install fw1-4.0.0`. Note that the version number must reflect what is available on ForgeBox. To install directly from Github you can do this: `install https://github.com/framework-one/fw1/archive/develop.zip`. |
| 71 | + |
| 72 | +<br> |
| 73 | + |
| 74 | +#### Generating Your Application as a Package |
| 75 | + |
| 76 | +To follow in the CommandBox/ForgeBox scheme of things, a `box.json` with basic package information is generated with your application. This makes your app capable of being added to ForgeBox for others to use and also makes installing it with CommandBox super simple. |
| 77 | + |
| 78 | +By default this option is set to `true` but can be altered like so: `fw1 create app MyApp basic / false false` |
| 79 | + |
| 80 | +<br> |
| 81 | + |
| 82 | +## Scaffolding Individual Parts of Your Application |
| 83 | + |
| 84 | +#### Generating Views With `fw1 create view` |
| 85 | + |
| 86 | +###### `create view` takes up to 2 parameters. |
| 87 | + |
| 88 | +- `name` (type: string, _required_) - The name of your view. |
| 89 | +- `directory` (type: string) - The directory to generate the view in. If it does not exist, it will be created. Defaults to looking for the `views` directory in your current working directory. |
| 90 | + |
| 91 | +###### _Examples:_ |
| 92 | + |
| 93 | +> _Create in current working directory._ - `fw1 create view myView` |
| 94 | +> _Create in specified directory._ - `fw1 create view myView my/directory` |
| 95 | +
|
| 96 | +<br> |
| 97 | + |
| 98 | +#### Generating Controllers With `fw1 create controller` |
| 99 | + |
| 100 | +###### `create controller` takes up to 6 parameters. |
| 101 | + |
| 102 | +- `name` (type: string, _required_) - The name of your controller. |
| 103 | +- `actions` (type: string) - The actions to be included in your controller. A comma delimited list of action names can be passed to create multiple actions. By default, only `default` is generated in the controller. |
| 104 | +- `directory` (type: string) - The directory to generate the controller in. If it does not exist, it will be created. Defaults to looking for the `controllers` directory in your current working directory. |
| 105 | +- `views` (type: boolean) - A flag to determine whether to generate views for each action. Defaults to `true`. |
| 106 | +- `viewsDirectory` (type: string) - The directory to generate the controller's views in. If it does not exist, it will be created. Defaults to looking for the `views` directory in path supplied to the `directory` parameter. |
| 107 | +- `open` (type: boolean) - A flag to determine whether to open the generated controller for editing right away. Opens in your machine's default editor. Defaults to `false`. |
| 108 | + |
| 109 | +###### _Examples:_ |
| 110 | + |
| 111 | +> _Create in current working directory._ - `fw1 create controller myController` |
| 112 | +> _Create with multiple actions._ - `fw1 create controller myController list,add,edit,delete` |
| 113 | +> _Create and open in editor._ - `fw1 create controller myController myAction --open` |
| 114 | +> _Create in specified directory._ `fw1 create controller myController myAction my/controller/directory` |
| 115 | +> _Create and generate views for each action._ - `fw1 create controller myController myAction controllers true` |
| 116 | +> _Create controller, views and specify the views directory._ - `fw1 create controller myController myAction controllers true my/view/directory` |
| 117 | +> _Create controller, views and open in editor._ - `fw1 create controller myController myAction controllers true my/view/directory true` |
| 118 | +
|
| 119 | +<br> |
| 120 | + |
| 121 | +#### Generating Layouts With `fw1 create layout` |
| 122 | + |
| 123 | +###### `create layout` takes up to 2 parameters. |
| 124 | + |
| 125 | +- `name` (type: string, _required_) - The name of your layout. |
| 126 | +- `directory` (type: string) - The directory to generate the layout in. If it does not exist, it will be created. Defaults to looking for the `layouts` directory in your current working directory. |
| 127 | + |
| 128 | +###### _Examples:_ |
| 129 | + |
| 130 | +> _Create in current working directory._ - `fw1 create layout myLayout` |
| 131 | +> _Create in specified directory._ `fw1 create layout myLayout my/layouts` |
| 132 | +
|
| 133 | +<br> |
| 134 | + |
| 135 | +#### Generating Beans With `fw1 create bean` |
| 136 | + |
| 137 | +###### `create bean` takes up to 4 parameters. |
| 138 | + |
| 139 | +- `name` (type: string, _required_) - The name of your bean. A comma delimited list of beans can be passed to be created in bulk. To specify "package" directorys, include the base path to be found/generated. Example: package/path/to/Bean. |
| 140 | +- `directory` (type: string) - The directory to generate the bean in. If it does not exist, it will be created. Defaults to looking for the `model/beans` directory in your current working directory. |
| 141 | +- `camelCase` (type: boolean) - A flag to determine the naming convention of the bean file to be in _camel case_ format. For example: _MyBean.cfc_. Defaults to `true`. |
| 142 | +- `open` (type: boolean) - A flag to determine whether to open the generated bean for editing right away. Opens in your machine's default editor. Defaults to `false`. |
| 143 | + |
| 144 | +###### _Examples:_ |
| 145 | + |
| 146 | +> _Create in current working directory._ - `fw1 create bean MyBean` |
| 147 | +> _Create and open in editor._ - `fw1 create bean MyBean --open` |
| 148 | +> _Create and specify package directory structure._ - `fw1 create bean package/path/for/MyBean` |
| 149 | +> _Create multiple beans._ - `fw1 create bean MyBean,MyOtherBean` |
| 150 | +> _Create in specified directory._ - `fw1 create bean MyBean path/to/beans` |
| 151 | +> _Create without camel case formatted file name._ - `fw1 create bean MyBean model/beans false` |
| 152 | +> _Create without camel case formatted file name and open in editor._ - `fw1 create bean MyBean model/beans false true` |
| 153 | +
|
| 154 | +<br> |
| 155 | + |
| 156 | +#### Generating Services With `fw1 create service` |
| 157 | + |
| 158 | +###### `create service` takes up to 4 parameters. |
| 159 | + |
| 160 | +- `name` (type: string, _required_) - The name of your service. A comma delimited list of services can be passed to be created in bulk. To specify "package" directorys, include the base path to be found/generated. Example: package/path/to/Service. |
| 161 | +- `directory` (type: string) - The directory to generate the service in. If it does not exist, it will be created. Defaults to looking for the `model/services` directory in your current working directory. |
| 162 | +- `camelCase` (type: boolean) - A flag to determine the naming convention of the service file to be in _camel case_ format. For example: _MyService.cfc_. Defaults to `true`. |
| 163 | +- `open` (type: boolean) - A flag to determine whether to open the generated service for editing right away. Opens in your machine's default editor. Defaults to `false`. |
| 164 | + |
| 165 | +###### _Examples:_ |
| 166 | + |
| 167 | +> _Create in current working directory._ - `fw1 create service MyService` |
| 168 | +> _Create and open in editor._ - `fw1 create service MyService --open` |
| 169 | +> _Create and specify package directory structure._ - `fw1 create service package/path/for/MyService` |
| 170 | +> _Create multiple services._ - `fw1 create service MyService,MyOtherService` |
| 171 | +> _Create in specified directory._ - `fw1 create service MyService path/to/services` |
| 172 | +> _Create without camel case formatted file name._ - `fw1 create service MyService model/services false` |
| 173 | +> _Create without camel case formatted file name and open in editor._ - `fw1 create service MyService model/services false true` |
| 174 | +
|
| 175 | +<br> |
| 176 | + |
| 177 | +#### Generating Subsytem Skeletons With `fw1 create subsystem` |
| 178 | + |
| 179 | +###### `create subsystem` takes up to 2 parameters and will generate a bare bones subsytem file structure. |
| 180 | + |
| 181 | +- `name` (type: string, _required_) - The name of your subsystem. |
| 182 | +- `directory` (type: string) - The directory to generate the subsystem in. If it does not exist, it will be created. Defaults to looking for the `subsystems` directory in your current working directory based on the Subsystem 2.0 convention released with FW/1 3.5. |
| 183 | + |
| 184 | +###### _Examples:_ |
| 185 | + |
| 186 | +> _Create from current working directory._ - `fw1 create subsystem mysubsystem` |
| 187 | +> _Create in specified directory._ - `fw1 create subsystem mysubsystem my/subsystems` |
| 188 | +
|
| 189 | +<br> |
| 190 | + |
| 191 | +#### Generating Clojure Controllers For FW/1 3.5+ With `fw1 create clj-controller` |
| 192 | + |
| 193 | +###### `create clj-controller` takes up to 4 parameters. |
| 194 | + |
| 195 | +- `name` (type: string, _required_) - The name of your controller. |
| 196 | +- `actions` (type: string) - The actions to be included in your controller. A comma delimited list of action names can be passed to create multiple actions. By default, only `default` is generated in the controller. |
| 197 | +- `directory` (type: string) - The directory to generate the controller in. If it does not exist, it will be created. Defaults to looking for the `controllers` directory in your current working directory. |
| 198 | +- `open` (type: boolean) - A flag to determine whether to open the generated controller for editing right away. Opens in your machine's default editor. Defaults to `false`. |
| 199 | + |
| 200 | +###### _Examples:_ |
| 201 | + |
| 202 | +> _Create in current working directory._ `fw1 create clj-controller my-controller` |
| 203 | +> _Create with multiple actions._ - `fw1 create clj-controller my-controller list,add,edit,delete` |
| 204 | +> _Create and open in editor._ - `fw1 create clj-controller my-controller --open` |
| 205 | +> _Create in specified directory._ - `fw1 create clj-controller my-controller my-action my/controller/directory` |
| 206 | +> _Create, specify actions, directory and open in editor._ - `fw1 create clj-controller my-controller my-action controllers true` |
| 207 | +
|
| 208 | +<br> |
| 209 | + |
| 210 | +#### Generating Clojure Services For FW/1 3.5+ With `fw1 create clj-service` |
| 211 | + |
| 212 | +###### `create clj-service` takes up to 3 parameters. |
| 213 | + |
| 214 | +- `name` (type: string, _required_) - The name of your service. A comma delimited list of services can be passed to be created in bulk. To specify "package" directorys, include the base path to be found/generated. Example: package/path/to/Service. |
| 215 | +- `directory` (type: string) - The directory to generate the service in. If it does not exist, it will be created. Defaults to looking for the `services` directory in your current working directory. |
| 216 | +- `open` (type: boolean) - A flag to determine whether to open the generated service for editing right away. Opens in your machine's default editor. Defaults to `false`. |
| 217 | + |
| 218 | +###### _Examples:_ |
| 219 | + |
| 220 | +> _Create in current working directory._ - `fw1 create clj-service my-service` |
| 221 | +> _Create and open in editor._ - `fw1 create clj-service my-service --open` |
| 222 | +> _Create and specify package directory structure._ - `fw1 create clj-service package/path/for/my-service` |
| 223 | +> _Create multiple services._ - `fw1 create clj-service my-service,my-other-service` |
| 224 | +> _Create in specified directory._ - `fw1 create clj-service my-service path/to/services` |
| 225 | +> _Create, specify directory and open in editor._ - `fw1 create clj-service my-service services true` |
0 commit comments