UNPKG

4.85 kBMarkdownView Raw
1# Axiom
2
3Axiom is a system for formalizing productive workflows, and defining the runtime of your application in a decoupled, extensible way.
4
5At its core, Axiom is:
6
7* A protocol for sub-system communication
8* A standard for sub-system definition
9
10Sub-systems are stored as NPM modules, and may include:
11
12* A configuration
13* Processes for:
14 * Install/Uninstall
15 * Build
16 * Test
17 * Runtime
18 * Feature Scaffolding
19
20These processes can extend existing life-cycles or define their own.
21
22# Alternatives
23
24* Yeoman - Used for formalizing workflows, workflows are not extensible, there is no standard for organizing/extending the application runtime.
25* FireShell - Ditto.
26* Anvil.js - Very similar design goals to Axiom, and in fact we use the same underlying message bus (Postal.js). Whereas Anvil.js decided to bake in the lifecycles, we wanted these to be extensible and therefore we have a more lightweight core than Anvil ships with. We also wanted to extend the decoupled approach of tasks to building out the application runtime.
27
28# Installation
29
30```bash
31npm install -g axiom
32```
33
34# Usage
35
36```bash
37axiom core create
38# Creates a new app (creates the directory as well).
39# This is the only command designed to be run outside the project directory.
40# If you already have a directory that you would like to start with, running any
41# install (or install with no args) should check all required baseline artifacts
42# and install them if they don't exist.
43
44axiom [module] install
45# Automatically does the following:
46# 1) npm install axiom-[module] --save
47# 2) require axiom-[module]
48# 3) run 'install' if it exists
49
50axiom [module] uninstall
51# Automatically does the following:
52# 1) require axiom-[module]
53# 2) run 'uninstall' if it exists
54# 3) npm uninstall axiom-[module] --save
55
56axiom [module] [task]
57axiom client build
58# If you have installed an axiom named "client" and it has a task called "build", this
59# will run that task.
60
61axiom client test
62axiom server test
63# Again, these assume axioms/tasks that exist with those names.
64```
65
66# Building Axioms
67
68Simply publish on npm a module with the name format 'axiom-yourname'. This will then be discovered by `axiom install`, and once installed will be automatically referanceable from the Axiom CLI.
69
70Your module should export an object containing the keys:
71
72* config - A javascript object describing how to wire up the services in this module.
73* services - Functions of a standard signature which implement your intended functionality.
74
75Services should contain:
76
77* install - A function to install the axiom. Include any generation code here.
78* uninstall - A function to uninstall the axiom. Remove all the generated code and directories/files that would have resulted from the installation.
79* [anything_else] - A function to generate some files, deploy something, start a server, or run a task.
80
81Services are in the format of:
82
83```coffee-script
84(args, done) ->
85 {foo, bar} = args
86 done null, {message: 'hello'}
87```
88
89These conform to the specification for Law services, so if you want some middleware to help you out (argument validations, access controls, filters for common functionality), check out the Law documentation:
90
91https://github.com/torchlightsoftware/law
92
93Here's an example module definition using Law:
94
95```coffee-script
96law = require 'law'
97serviceDefs = law.load './services'
98
99module.exports =
100 config:
101 test:
102 base: 'task'
103 stages: ['prepare', 'test', 'cleanup']
104
105 services: law.create {
106 services: serviceDefs
107 policy: require './policy'
108 }
109
110```
111
112## DISCLAIMER
113
114Modules in the Axiom ecosystem are the property of their respective authors. We make no guarantee for the quality, usefulness, or intent of any module.
115
116## LICENSE
117
118(MIT License)
119
120Copyright (c) 2013 Torchlight Software <info@torchlightsoftware.com>
121
122Permission is hereby granted, free of charge, to any person obtaining
123a copy of this software and associated documentation files (the
124"Software"), to deal in the Software without restriction, including
125without limitation the rights to use, copy, modify, merge, publish,
126distribute, sublicense, and/or sell copies of the Software, and to
127permit persons to whom the Software is furnished to do so, subject to
128the following conditions:
129
130The above copyright notice and this permission notice shall be
131included in all copies or substantial portions of the Software.
132
133THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
134EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
136NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
137LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
138OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
139WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.