An open API service indexing awesome lists of open source software.

https://github.com/rbren/lucy

A tool for sharing, coordinating, and automating code in any language
https://github.com/rbren/lucy

Last synced: 7 months ago
JSON representation

A tool for sharing, coordinating, and automating code in any language

Awesome Lists containing this project

README

          

Lucy
====
Lucy is a tool for sharing, coordinating, and automating code in any language. Lucy works by feeding JSON into code templates, producing customized code that compiles and runs.



Lucy is just getting started, but you can keep up with the latest news and learn about what lucy can do here:

http://lucybot.github.io/blog/



Want to get an early peek at everything lucy can do? Join the beta!




## Installation
You'll need nodejs to run lucy:

https://github.com/joyent/node/wiki/installing-node.js-via-package-manager

```bash
sudo npm install -g lucy
lucy adduser
```



## Usage
### Build an existing package
```bash
lucy build definition:package config.json
```

### Push a new definition
Note: define is currently only open to beta testers. Join the beta for access
```bash
lucy define definition.json
```

### Add a package to an existing definition
Note: publish is currently only open to beta testers. Join the beta for access
```bash
lucy publish /path/to/directory/containing/package.json
```



## About
There are two main components to a lucy module:

* DEFINITION - this is JSON that describes what kind of code is being generated, and provides a sample configuration.

* PACKAGE - this is a set of code templates, scripts, and files that will be used to generate code. There can be multiple packages per definition.

Most users will simply run ```lucy build``` to generate code from an existing lucy package. However, you can also create your own definitions and packages to share with others. Let's walk through a "hello world" example.

Note that while we're in beta, the ```define``` and ```publish``` commands won't work unless you're signed up. Feel free to jump ahead to ```build``` though!

### Quickstart
To download all the files described in this tutorial, enter a new directory and run
```bash
lucy build hello-world-starter '{"username": "SOME_UNIQUE_ID"}'
```
choosing a unique id that won't collide with other hello-world-* definitions.

you can then run
```bash
lucy define def.json

lucy publish pkg
lucy build hello-world-YOUR_UNIQUE_ID:js config.json

lucy publish javapkg
lucy build hello-world-YOUR_UNIQUE_ID:java config.json
```

### The Definition
We start with a definition:


def.json
```js
{
"name": "hello-world",
"description": "A hello world example for lucy",
"sample_input": {
"greeting": "Hello",
"person": "world"
}
}
```
(you'll need to replace "hello-world" with something unique)

and run:
```bash
lucy define def.json
```
which pushes the definition to lucy's servers.


### The Package
Now we create a package by starting a new directory 'pkg'


pkg/hello.js
```js
console.log('<%- greeting %> <%- person %>');
```


pkg/package.json
```js
{
"lucy_def": "hello-world",
"package_name": "js",
"files": [{
"from": "hello.js"
}]
}
```

and run
```bash
lucy publish pkg
```
which will zip up the directory and upload the resulting tarball.


### Build!
Now anyone can create a config.json like


config.json
```js
{
"greeting": "Yo",
"person": "lucy"
}
```

and run
```bash
lucy build hello-world:js config.json
```

which will generate this file in the working directory:


hello.js
```js
console.log("Yo lucy");
```


### Extend!
What's more, you (or anyone else) can add other packages to the hello-world definition, for example:


Hello.java
```java
public class Hello {
public static void main(String[] args) {
System.out.println("<%- greeting %> <%- person %>");
}
}
```


package.json
```js
{
"lucy_def": "hello-world",
"package_name": "java",
"files": [{
"from": "Hello.java"
}]
}
```



Join the beta if you're intersted in giving it a shot!