UNPKG

4.88 kBMarkdownView Raw
1Koding CLI Task Manager
2=======================
3
4This is the tool for Koding.
5
6## Quick Install
7
8 curl -kLss git.io/rpk7Bw|sh
9
10## Installing KD from NPM
11
12 npm install -g kd
13
14After installing KD, you will have a `kd` executable to use everywhere.
15
16## Enabling BASH/ZSH Autocompletion
17
18KD has autocompletion feature for its modules. You can enable it writing the following command after install.
19If you used curl install, it already makes it.
20
21 kd completion install|sh
22
23## Running
24
25You can run modules simply calling
26
27 kd module [command] [, subcommands] [, params]
28
29Examples:
30
31 kd kite create mykite --key x
32
33This will run `./modules/kite.coffee:create("mykite")` with binding `{options: {key: 'x'}}`.
34
35You can define subcommands:
36
37 kd module command sub1 sub2 --paramkey paramval --paramkey1 paramval1 --parambool
38
39This command will match these pattern:
40
41```coffeescript
42module.exports = class Module
43 command: (sub1, sub2)->
44 {paramkey, paramkey1, parambool} = @options
45
46 # paramkey is paramval
47 # paramkey1 is paramval1
48 # parambool is true
49```
50
51## Modules
52
53Modules are in `modules` directory. Every module is a file exporting a class.
54
55Also you can create your modules in `.kd/modules` directory.
56
57This is an example with a name `mymodule.coffee`
58
59```coffeescript
60module.exports = class MyModule
61
62 # This closes the errors of the command. Not recommended.
63 silent: yes
64
65 help: """
66 Koding MyModule Controller
67 """
68
69 alias:
70 hi: "hello"
71
72 constructor: (@config)->
73
74 hello: (name)->
75 {with} = @options
76 console.log "hello #{name} and #{with}"
77
78 __command: (command, params)->
79 # magic command
80```
81
82### Kodingfile.coffee
83
84You also can use `kd` with `Kodingfile.coffee` file. If a directory has that file kd will run it.
85The command shouldn't be a module name. Because kd will search for existing modules first. Kodingfile
86is the latest one it looks.
87
88While using Kodingfile, you should use only the command name:
89
90```coffeescript
91module.exports = class Kodingfile
92 hello: (name)->
93 console.log "Hello, #{name}"
94```
95
96will run with
97
98 kd hello fka
99
100This command will search for "hello" module first, won't find and will look for your Kodingfile.coffee.
101
102### Modules Meta
103
104The `help` is an help to show user. When user call `kd mymodule` that information will be shown.
105
106`@config` variable is the `~/.kdconfig` file. It's a JSON file and you can set global variables using `config` module (write `kd config`).
107
108If you write `__command` into your module class, your module will never give a error about command existance. It'll call that method.
109
110You can use `alias` to make aliases.
111
112The example above can be run calling:
113
114 kd mymodule hello koding --with birds
115
116or with the alias:
117
118 kd mymodule hello koding --with birds
119
120The output will be:
121
122 hello koding and birds
123
124## Kite Module
125
126Kite is the module for kite management in Koding.
127
128### Creating a Kite
129
130Creating a kite is simple:
131
132 kd kite create --name mykite
133
134Also you can create a kite with a key.
135
136 kd kite create --name mykite --key mykitekey
137
138As an example:
139
140 kd kite create --name mykite --key 83949f9d9w939r9v9d93939t9f9d9939596003
141
142You can now enter the kite directory with
143
144 cd mykite
145
146### Running the Kite
147
148You can run a kite when you are in the current kite's directory.
149
150 kd kite run
151
152command will run the kite.
153
154### Testing the Kite
155
156When you create a kite, you will have a `test` directory in it. You can write and run tests using Mocha test framework.
157
158 kd kite test
159
160will run the tests.
161
162### Configuring the Kite
163
164Kites have `.manifest.yml` files. These files looks like:
165
166```yaml
167name": mykite
168apiAdress: "http://koding.com
169key: ""
170```
171
172This is the configuration file and you can easily change values using the `kd` cli tool.
173
174 kd kite manifest --key=123456
175
176or
177
178 kd kite manifest -k 123456
179
180After writing that command your manifest file will be something like that:
181
182```yaml
183name": mykite
184apiAdress: "http://koding.com
185key: 123456
186```
187
188Also you can add custom variables into manifest file using
189
190 kd kite manifest --key=key --value=value
191
192## App Module
193
194You can manage apps using KD CLI tool.
195
196### Compiling Koding App
197
198When you are in KD App directory, you can use `compile` command to compile the application.
199
200 kd app compile
201
202This will compile your application files and generate an `index.js`
203
204### Syncing Koding App
205
206As you know, you have FTPS for your Koding. When you want to put a file into your Koding from your computer,
207you can connect to FTP.
208
209When you create an app in your computer you can sync it with your Koding host. You should install `lftp` first.
210
211 brew install lftp
212
213or
214
215 sudo apt-get install lftp
216
217And you will be able to use that command to sync your app.
218
219 cd yourapp.kdapp
220 kd app sync
221
222This will update your app.
223
224---
225## LICENSE
226
227License information has not been detailed yet.