framework-one / fw1-commands

A collection of CommandBox commands for working with FW/1
MIT License
11 stars 4 forks source link
cli commandbox fw1

FW/1 Commands

A collection of CommandBox commands for working with FW/1

Installation

  1. First, make sure you have CommandBox installed.
  2. Fire up your terminal and drop into CommandBox by entering box.
  3. Install FW/1 Commands by entering install fw1-commands.
  4. Done!


Getting Started

Application Skeleton Generation With fw1 create app

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.

A simple example:

fw1 create app MyApp Basic

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.


A Deeper Look Into create app

create app can take up to 5 parameters.


Available Skeletons


Choosing A Directory to Generate In

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.

Example:

fw1 create app MyApp basic path/to/my/directory


Including Framework One With Your New Application

By default, FW/1 is not included with generated skeletons. The option to to use the master or development release is up to you.

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.

Examples installing FW/1:

Create in current working directory. - fw1 create app MyApp basic --installFw1
Create in a specified directory. - fw1 create app MyApp basic path/to/directory true

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.


Generating Your Application as a Package

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.

By default this option is set to true but can be altered like so: fw1 create app MyApp basic / false false


Scaffolding Individual Parts of Your Application

Generating Views With fw1 create view

create view takes up to 2 parameters.
Examples:

Create in current working directory. - fw1 create view myView
Create in specified directory. - fw1 create view myView my/directory


Generating Controllers With fw1 create controller

create controller takes up to 6 parameters.
Examples:

Create in current working directory. - fw1 create controller myController
Create with multiple actions. - fw1 create controller myController list,add,edit,delete
Create and open in editor. - fw1 create controller myController myAction --open
Create in specified directory. fw1 create controller myController myAction my/controller/directory
Create and generate views for each action. - fw1 create controller myController myAction controllers true
Create controller, views and specify the views directory. - fw1 create controller myController myAction controllers true my/view/directory
Create controller, views and open in editor. - fw1 create controller myController myAction controllers true my/view/directory true


Generating Layouts With fw1 create layout

create layout takes up to 2 parameters.
Examples:

Create in current working directory. - fw1 create layout myLayout
Create in specified directory. fw1 create layout myLayout my/layouts


Generating Beans With fw1 create bean

create bean takes up to 4 parameters.
Examples:

Create in current working directory. - fw1 create bean MyBean
Create and open in editor. - fw1 create bean MyBean --open
Create and specify package directory structure. - fw1 create bean package/path/for/MyBean
Create multiple beans. - fw1 create bean MyBean,MyOtherBean
Create in specified directory. - fw1 create bean MyBean path/to/beans
Create without camel case formatted file name. - fw1 create bean MyBean model/beans false
Create without camel case formatted file name and open in editor. - fw1 create bean MyBean model/beans false true


Generating Services With fw1 create service

create service takes up to 4 parameters.
Examples:

Create in current working directory. - fw1 create service MyService
Create and open in editor. - fw1 create service MyService --open
Create and specify package directory structure. - fw1 create service package/path/for/MyService
Create multiple services. - fw1 create service MyService,MyOtherService
Create in specified directory. - fw1 create service MyService path/to/services
Create without camel case formatted file name. - fw1 create service MyService model/services false
Create without camel case formatted file name and open in editor. - fw1 create service MyService model/services false true


Generating Subsytem Skeletons With fw1 create subsystem

create subsystem takes up to 2 parameters and will generate a bare bones subsytem file structure.
Examples:

Create from current working directory. - fw1 create subsystem mysubsystem
Create in specified directory. - fw1 create subsystem mysubsystem my/subsystems


Generating Clojure Controllers For FW/1 3.5+ With fw1 create clj-controller

create clj-controller takes up to 4 parameters.
Examples:

Create in current working directory. fw1 create clj-controller my-controller
Create with multiple actions. - fw1 create clj-controller my-controller list,add,edit,delete
Create and open in editor. - fw1 create clj-controller my-controller --open
Create in specified directory. - fw1 create clj-controller my-controller my-action my/controller/directory
Create, specify actions, directory and open in editor. - fw1 create clj-controller my-controller my-action controllers true


Generating Clojure Services For FW/1 3.5+ With fw1 create clj-service

create clj-service takes up to 3 parameters.
Examples:

Create in current working directory. - fw1 create clj-service my-service
Create and open in editor. - fw1 create clj-service my-service --open
Create and specify package directory structure. - fw1 create clj-service package/path/for/my-service
Create multiple services. - fw1 create clj-service my-service,my-other-service
Create in specified directory. - fw1 create clj-service my-service path/to/services
Create, specify directory and open in editor. - fw1 create clj-service my-service services true