Giter Club home page Giter Club logo

cupboard's Introduction

Your Project Command Center

Alt screenshot

Features

  • All projects accessible via the cbd cli.
  • easily identify which projects have been updated.
  • Customizable actions: publish, bump, etc.
  • Push to both NPM, and GIT with one command.
  • Run processes in parallel
  • Install third-party plugins via beanpole
  • Ability to call a command against multiple projects. e.g:
    • cbd ignore --all node_modules adds node_modules to all .gitignore files.
    • cbd open my-app+another-app opens the given applications in finder.

Requirements

Installation

Assuming you already have node.js, and NPM installed, just call:

npm install cupboard

Or call the ./install script.

Plugins

  • Github Plugin - basic commands: launch github page, launch github issues page.
  • Scaffolding Plugin - quickly create coffeescript/html5-boilerplate/etc. based projects.
  • Growl Plugin - get notified when commands are executed - useful for watching projects.

Installation

cbd install beanpoll-growl
cbd install cupboard-bootstrap
cbd install cupboard-github

or all together:

cbd install bean.notify.growl bean.cupboard.github bean.cupboard.scaffold

Basic Usage

For each project you want to use in cupboard, simply call this command in your project directory:

cbd init               

You can also provide a path:

cbd init /path/to/project

That'll setup a basic GIT configuration. There are however a few additional options. If you want to add NPM and GIT, just swap in the template like so:

cbd init --tpl=git+npm

Templates

templates allow to easily specify a set of custom commands for any given project. Here's an example:

[template:svn:commands]
publish=svn commit ...
my-custom-command

When writing custom templates, or any custom configuration, they should be placed in ~/.cupboard/my_conf/. The example above might be written to ~/.cupboard/my_conf/svn.conf. After that, you can start using it:

cbd init --tpl=svn

Default

The following templates come with cupboard:

  • git+npm
  • git

Commands

You can specify custom commands for each project. There are few ways to do so. The first option would be to create a /path/to/project/.cupboard file. An example might be:

[commands]
say-hello=echo Hello $@

The other option is to modify the project setting under ~/.cupboard/projects.conf. Like so:

[project:my-project:commands]
say-hello=echo Hello $@

The example say-hello in both bases produce the same result:

Alt terminal


Commands:               
         help                            Shows the help menu                             
         init                            Adds a project in cwd to cupboard                      
         list                            List all projects                                        
         updates                         List all projects with updates                             
         uninstall <plugin>              Uninstalls a plugin                                      
         install <plugin>                Installs a plugin                            
         plugins                         Lists installed plugins                            
         details <proj>                  Shows project details                                    
         dir <proj>                      Returns the project path                   
         execute <proj> <script.js>      executes a script against project                               
         link <proj>                     Links project globally                            
         find-link <proj> <link>         Finds project link against all projects                       
         publish <proj>                  Publishes project                                        
         untouch <proj>                  Marks project as published                               
         version <proj> <vers>           Sets the project version                                 
         remove <proj>                   Removes project from cupboard        
         <cmd> <proj>                    Calls custom project command                    

Examples:
         cd `cbd dir <proj>`             Changes the current working directory to given project  
         execute my-proj change-git.js                                                            
         scaffold my-proj sublime+node                                                            
         link <proj> --global            Links given project against all projects                 
         make+start project --watch                                             

Watching Projects

You can easily watch any project, and invoke commands on change by adding --watch. Here's an example:

cbd make+start my-project --watch  

That command will watch my-project, and invoke make and start on any change - in that order. Here's what you get:

Alt terminal

In some cases, you may want to ignore certain directories from triggering --watch. You can easily do that by adding a .ignorewatch file.

API

cupboard.getProjects(projects, callback)

Returns all the projects registered in cupboard.

  • projects - can be a string, or an array of projects. String can also be --all, or project+another-project.
var cupboard = require('cupboard');

cupboard.getProjects('bonsai', function(err, projects) {
	
	projects.forEach(function(project) {
		
		console.log('Listing %s changes:', project.name());
		
		//return list of changed files for given project
		project.getUpdatedFiles(function(err, files) {
			
			
		});
	});
});

Project.name()

Returns the name of the given project.

Project.path()

Returns the symlink path of the given project.

Project.get(property)

Returns a property specified in the projects.conf file under the given project.

Project.untouch()

"Untouches" project so no changes will be listed.

Project.watch():FileWatcher

Watches file for any file changes.

Project.loadConfig(callback)

Loads all configuration settings for given project, including all target specific commands.

Project.execute(ops, callback)

Executes a command against the given project.

  • ops
    • command - Command to execute against the project.
    • args - Arguments to pass onto given command.

Project.getScript(command, callback)

Returns script assigned to command

FileWatcher.on(event, callback)

  • event
    • change - file changed
    • add - file added
    • remove - file removed

An example:

In the .cupboard file located in path/to/my-project:

[commands]
say-hello=echo Hello $@

In your node.js script:

cupboard.getProjects('my-project', function(err, projects) {
	
	var myProject = projects[0];
	
	
	myProject.execute({ command: 'say-hello' args: ['Craig'] }); //terminal print "Hello Craig!"
	myProject.execute({ command: 'publish', args: ['Some commit message']})
});

Writing Plugins

  • TODO - see github plugin for now.

Useful tricks

Easily change to the directory of any project:

cd `cbd dir my-project`

Invoke a command against all project directories:

for DIR in `cbd dir --all`; 
	echo $DIR; # do stuff here
done;

Bumping a project version:

cbd version my-project +0.0.1 # bump
cbd version my-project # show version

Assuming you have make, and start specified in your project commands, you can easily start your project, and restart it whenever it's changed:

cbd make+start my-project --watch

cupboard's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cupboard's Issues

Not compatible with Node 0.6.0?

ι ~ % npm install git://github.com/spiceapps/cupboard.git
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: [email protected]
npm ERR! Required: {"node":"~0.4.12"}
npm ERR! Actual:   {"npm":"1.0.104","node":"0.6.0"}
npm ERR! 
npm ERR! System Linux 3.0-ARCH
npm ERR! command "node" "/usr/bin/npm" "install" "git://github.com/spiceapps/cupboard.git"
npm ERR! cwd /home/manveru
npm ERR! node -v v0.6.0
npm ERR! npm -v 1.0.104
npm ERR! code ENOTSUP
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/manveru/npm-debug.log
npm not ok

cupboard list running processes script

use hook.io+daisy to connect processes together. commands may include:

cbd ps
cbd restart procid
cbd kill procid

useful for having centralized management where cbd arguments are variable (watching projects, grouped commands, etc.)

cbd --help error

MBP% cbd --help

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
TypeError: Cannot call method 'split' of undefined
    at getSearch (/usr/local/lib/node_modules/cupboard/lib/cupboard.js:40:33)
    at Object.hasProject (/usr/local/lib/node_modules/cupboard/lib/cupboard.js:50:18)
    at Object.execute (/usr/local/lib/node_modules/cupboard/lib/commands/execute.js:31:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/cupboard/bin/cupboard:56:26)
    at Module._compile (module.js:411:26)
    at Object..js (module.js:417:10)
    at Module.load (module.js:343:31)
    at Function._load (module.js:302:12)
    at Array.<anonymous> (module.js:430:10)
    at EventEmitter._tickCallback (node.js:126:26)

npm is spelled `npm`

Just a nitpick. npm is not capitalized.
Cheers and super excited that you're working on this project!
D

npm install cupboard throw errors

MBP% npm install cupboard -g
npm ERR! error installing [email protected] Error: version not found: 0.1.0 : celeri/0.1.0
npm ERR! error installing [email protected]     at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:180:12)
npm ERR! error installing [email protected]     at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:99:22)
npm ERR! error installing [email protected]     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:361:18)
npm ERR! error installing [email protected]     at Request.emit (events.js:64:17)
npm ERR! error installing [email protected]     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:327:16)
npm ERR! error installing [email protected]     at IncomingMessage.emit (events.js:81:20)
npm ERR! error installing [email protected]     at HTTPParser.onMessageComplete (http.js:133:23)
npm ERR! error installing [email protected]     at CleartextStream.ondata (http.js:1231:22)
npm ERR! error installing [email protected]     at CleartextStream._push (tls.js:303:27)
npm ERR! error installing [email protected]     at SecurePair.cycle (tls.js:577:20)
npm ERR! Error: version not found: 0.1.0 : celeri/0.1.0
npm ERR!     at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:180:12)
npm ERR!     at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:99:22)
npm ERR!     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:361:18)
npm ERR!     at Request.emit (events.js:64:17)
npm ERR!     at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:327:16)
npm ERR!     at IncomingMessage.emit (events.js:81:20)
npm ERR!     at HTTPParser.onMessageComplete (http.js:133:23)
npm ERR!     at CleartextStream.ondata (http.js:1231:22)
npm ERR!     at CleartextStream._push (tls.js:303:27)
npm ERR!     at SecurePair.cycle (tls.js:577:20)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 10.8.0
...
npm ERR! node -v v0.4.12
npm ERR! npm -v 1.0.104
...
npm not ok

I tried npm install celeri -g but this error remain.

process bean

ability to start project processes using supervisord, and gittyup

Ideas

Nice tool!

Just throwing this out there. Ideal for my workflow would be

  • move .cupboard to home directory
  • mark watchable project by cd'ing int them and marking them via cbd init (putting them into ~/.cupboard)
  • I think having cli interface asking me for project name and commands should not be done
  • assume project title is name of the directory
  • assume default publish command

Global installation

Maybe I use npm wrong but I would like to install this program to global so I have this available in my PATH.

npm install -g cupboard

It installs fine but upon execution of cbd init I get

/usr/local/lib/node_modules/cupboard/lib/commands/init.js:104
                name: config.project.name,  
                        ^
TypeError: Cannot read property 'name' of undefined
    at onConfig (/usr/local/lib/node_modules/cupboard/lib/commands/init.js:104:25)
    at Object.<anonymous> (/usr/local/lib/node_modules/cupboard/lib/commands/init.js:66:3)
    at /usr/local/lib/node_modules/cupboard/node_modules/celeri/lib/index.js:67:13
    at Object.<anonymous> (/usr/local/lib/node_modules/cupboard/node_modules/celeri/lib/index.js:52:19)
    at Object._onTimeout (timers.js:180:18)
    at Timer.ontimeout (timers.js:84:39)

Bug after install

$cbd

/usr/local/lib/node_modules/cupboard/lib/index.js:20
    ops.command.split('+').forEach(function(command) {
             ^
TypeError: Cannot call method 'split' of undefined
    at execute2 (/usr/local/lib/node_modules/cupboard/lib/index.js:20:14)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/cupboard/lib/index.js:87:3)
    at EventEmitter.emit (events.js:67:17)
    at Reader.<anonymous> (/usr/local/lib/node_modules/cupboard/lib/bootstrap.js:40:7)
    at Reader.<anonymous> (/usr/local/lib/node_modules/cupboard/node_modules/beanpoll/lib/io/reader.js:131:27)
    at Reader.emit (events.js:88:20)
    at Response.<anonymous> (/usr/local/lib/node_modules/cupboard/node_modules/beanpoll/lib/io/reader.js:26:24)
    at Response.emit (events.js:64:17)
    at Response.end (/usr/local/lib/node_modules/cupboard/node_modules/beanpoll/lib/io/writer.js:38:12)
    at Object.end (/usr/local/lib/node_modules/cupboard/node_modules/vine/index.js:241:23)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.