Permalink
Browse files

more docs on api

  • Loading branch information...
1 parent 7bd8982 commit d343a300620cf31f1f0289aaacbbb23c68fce646 Hsiaoming Yang committed Mar 26, 2013
Showing with 118 additions and 13 deletions.
  1. +23 −3 docs/api/grunt.md
  2. +79 −8 docs/api/index.md
  3. +16 −2 docs/api/yuan.md
View
26 docs/api/grunt.md
@@ -1,14 +1,34 @@
# grunt
-- pubdate: 2013-03-20
+- pubdate: 2013-03-26
- index: 10
Hack the grunt.
-----
+spm hacks in grunt, extends grunt methods.
-## invokeTask
+```js
+var grunt = require('spm').sdk.grunt;
+```
+It contains everything of grunt, and more.
-## loadGlobalTasks
+## invokeTask(name, options)
+
+Invoke/call a task.
+
+```js
+grunt.invokeTask('build', {
+ fallback: function(grunt) {
+ console.log('fallback')
+ }
+})
+```
+
+It will search the gruntfiles and detect if the task name in the gruntfile. If the task is in the gruntfile, it will run the task, if not, it will call the fallback function.
+
+## loadGlobalTasks(name)
+
+Load tasks in the global `NODE_PATH`. Just like `loadNpmTasks`, it can load task collections.
View
87 docs/api/index.md
@@ -1,6 +1,6 @@
# spm
-- pubdate: 2013-03-20
+- pubdate: 2013-03-26
- index: 0
The API of spm.
@@ -21,21 +21,85 @@ The version of spm.
Always use `spm.log` in your program, never use `console`.
+```js
+spm.log('install', 'arale/class')
+```
+
## spm.plugin
-- spm.plugin.install
-- spm.plugin.uninstall
-- spm.plugin.show
-- spm.plugin.plugins
+API for plugins.
+
+### spm.plugin.install(options)
+
+Install a plugin, used by postinstall hook in npm:
+
+```js
+spm.plugin.install({
+ name: 'init',
+ bin: 'spm-init',
+ description: 'init …'
+})
+```
+
+### spm.plugin.uninstall(name)
+
+Uninstall a plugin, used by uninstall hook in npm:
+
+```js
+spm.plugin.uninstall('init')
+```
+
+### spm.plugin.plugins
+
+All installed plugins:
+
+```
+var plugins = spm.plugin.plugins;
+```
+
## spm.config
Interact with `~/.spm/spmrc` config file.
-- spm.config.config
-- spm.config.remove
-- spm.config.show
+### spm.config.get(key)
+
+Get information in spmrc:
+
+```
+spm.config.get('user')
+spm.config.get('user.username')
+```
+
+### spm.config.set(key, value)
+
+Set section in spmrc:
+
+```
+spm.config.set('user.username', 'lepture')
+```
+
+### spm.config.remove(section)
+
+Remove a section in spmrc:
+
+```
+spm.config.remove('user')
+```
+
+## spm.build(options)
+
+Build the module.
+
+### spm.build.loadBuildTasks(options, pkg)
+
+Load build tasks: `spm-build`.
+
+This is a task collection which is [grunt-spm-build](https://github.com/spmjs/grunt-spm-build). You can bind and load this task too.
+
+## spm.login(options)
+Login/register spmjs.org.
## spm.install(options)
@@ -49,6 +113,10 @@ Get information of a module from spmjs.org.
Search modules from spmjs.org.
+```
+spm.search({query: 'jquery'})
+```
+
## spm.publish(options)
Publish a package to spmjs.org.
@@ -57,6 +125,9 @@ Publish a package to spmjs.org.
Unpublish a package from spmjs.org.
+```
+spm.unpublish({query: 'arale/class@1.0.0'})
+```
## spm.sdk
View
18 docs/api/yuan.md
@@ -1,6 +1,6 @@
# yuan
-- pubdate: 2013-03-20
+- pubdate: 2013-03-26
- index: 5
communication with spmjs.org.
@@ -11,16 +11,30 @@ communication with spmjs.org.
var yuan = require('spm').sdk.yuan
```
-This is a lower API, for higher API, use `spm.publish` or `spm.install`.
+This is a lower API, for higher API, use:
+
+- `spm.publish`
+- `spm.unpublish`
+- `spm.info`
+- `spm.search`
+- `spm.login`
## login
Login your account.
+```
+yuan(options).login(user, callback)
+```
+
## register
Register an account.
+```
+yuan(options).register(user, callback)
+```
+
## info
Get information of a module.

0 comments on commit d343a30

Please sign in to comment.