Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

lucy

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucy

Code templating and automation

Source
npmnpm
Version
0.0.7
Version published
Weekly downloads
8
-38.46%
Maintainers
1
Weekly downloads
 
Created
Source

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

sudo npm install -g lucy
lucy adduser



Usage

Build an existing package

lucy build definition:package config.json

Push a new definition

Note: define is currently only open to beta testers. Join the beta for access

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

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

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

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

{
  "name": "hello-world",
  "description": "A hello world example for lucy",
  "sample_input": {
    "greeting": "Hello",
    "person": "world"
  }
}

and run:

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.ejs

console.log('<%- greeting %> <%- person %>');


pkg/package.json

{
  "lucy_def": "hello-world",
  "package_name": "js",
  "files": [{
    "from": "hello.ejs",
    "to": "hello.js",
    "method": "render"
  }]
}

and run

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

{
  "greeting": "Yo",
  "person": "lucy"
}

and run

lucy build hello-world:js config.json

which will generate this file in the working directory:

hello.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.ejs ```java public class HelloWorld { public static void main(String[] args) { System.out.println("<%- greeting %> <%- person %>"); } } ```


package.json

{
  "lucy_def": "hello-world",
  "package_name": "java",
  "files": [{
    "from": "hello.ejs",
    "to": "HelloWorld.java",
    "method": "render"
  }]
}



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

FAQs

Package last updated on 24 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts