Skip to content

Commit

Permalink
Merge 8c0275d into 17e176d
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Escalante committed Jul 22, 2014
2 parents 17e176d + 8c0275d commit 0fed283
Show file tree
Hide file tree
Showing 63 changed files with 1,277 additions and 980 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ root = true

[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.DS_Store
test/fixtures/deployers/**/*.conf
test/fixtures/deployers/**/*.conf
config.coffee
encrypt-config.sh
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test
src
examples
Makefile
contributing.md
.editorconfig
.travis.yml
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
language: node_js
node_js:
- 0.10
- 0.1
after_script:
- npm run coveralls
before_script:
- openssl aes-256-cbc -k "$secret" -in config.coffee.enc -d -a -out config.coffee
env:
global:
- secure: MBEFvlT4702JjIK0JUaI59np0jELZX0sV1BYvwotfo6cf245AXt4/ae6bsslZ+cxu3dGeVhCokQVBQJOCdUWN/lDsz9i3bTTA2w4DHD5e1Gz0ZVv58559HqMrrU921yRu5GZNpVcM8B+Az9qNwnznA1Fbh+sLh+gpQ3zmzd7JmA=
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build:
mv lib src
coffee -o lib -c src
cp -R lib src
coffee -c lib
find lib -iname "*.coffee" -exec rm '{}' ';'

unbuild:
rm -rf lib
Expand Down
20 changes: 12 additions & 8 deletions bin/ship
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
require('coffee-script/register');
require('colors');

var argv = require('optimist').alias('e', 'environment').argv,
colors = require('colors'),
ship = require('../lib'),
Commands = require('../lib/commands');
var cli = new (require('../lib/cli')),
pkg = require('../package.json'),
notifier = require('update-notifier')({
packageName: pkg.name,
packageVersion: pkg.version,
});

default_cmd = new Commands['default'](argv._, argv.environment)
notifier.notify();

default_cmd.run(function(err, res){
if (err) return console.error(err.red);
});
cli.on('info', function(m){ console.log(("▸ " + m).grey); });
cli.on('success', function(m){ console.log(("✓ " + m).green); });
cli.on('err', function(err){ console.error("✘ ".red + err); });

cli.run(process.argv.slice(2));
5 changes: 5 additions & 0 deletions config.coffee.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
U2FsdGVkX1/sRbll1blWaxdY5ERFFDefn36pUItH4yy+Bkhcs/d4FoeVqDF828r9
PuKhYGgPOesDrYitfdrrhA5zGDBTOuLA1y3cGoq69U7Kd/2DxXLl+yrGiK1SyMtN
F5LL+pPVUdqKdIfBSoWYeeicBl8KR/KRuLep/fSXBFv6APbpADM4T73EE60wRkLp
oDYai8rqA5Kiy4KVXZO2eB+PGHrR26yKZGxcMzEbv4xnHLILcm5uNlw/hOyCEhqn
gpBUOQwTQ+8Gejlsr12Ha1KEzsHb4LgOxdA6C6L8BWL74Z309scRsLzsU2JzqFIz
30 changes: 30 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing to Ship

Hello there! First of all, thanks for being interested in ship and helping out. We all think you are awesome, and by contributing to open source projects, you are making the world a better place. That being said, there are a few ways to make the process of contributing code to ship smoother, detailed below:

### Filing Issues

If you are opening an issue about a bug, make sure that you include clear steps for how we can reproduce the problem. _If we can't reproduce it, we can't fix it_. If you are suggesting a feature, make sure your explanation is clear and detailed.

### Getting Set Up

- Clone the project down
- Make sure [nodejs](http://nodejs.org) has been installed and is above version `0.10.x`
- Run `npm install`
- Put in work

### Testing

This project is constantly evolving, and to ensure that things are secure and working for everyone, we need to have tests. If you are adding a new feature, please make sure to add a test for it. The test suite for this project uses [mocha](http://visionmedia.github.io/mocha/) and [should](https://github.com/visionmedia/should.js/)/

To run the test suite, make sure you have installed mocha (`npm install mocha -g`), then you can use the `npm test` or simply `mocha` command to run the tests.

### Code Style

To keep a consistant coding style in the project, we're using [Polar Mobile's guide](https://github.com/polarmobile/coffeescript-style-guide), with one difference begin that much of this project uses `under_scores` rather than `camelCase` for variable naming. For any inline documentation in the code, we're using [JSDoc](http://usejsdoc.org/).

### Commit Cleanliness

It's ok if you start out with a bunch of experimentation and your commit log isn't totally clean, but before any pull requests are accepted, we like to have a nice clean commit log. That means [well-written and clear commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) and commits that each do something significant, rather than being typo or bug fixes.

If you submit a pull request that doesn't have a clean commit log, we will ask you to clean it up before we accept. This means being familiar with rebasing - if you are not, [this guide](https://help.github.com/articles/interactive-rebase) by github should help you to get started. And if you are still confused, feel free to ask!
63 changes: 0 additions & 63 deletions lib/arg_parser.coffee

This file was deleted.

74 changes: 74 additions & 0 deletions lib/cli.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
path = require 'path'
pkg = require '../package.json'
ArgParse = require('argparse').ArgumentParser
EventEmitter = require('events').EventEmitter
util = require 'util'
Ship = require './index'

###*
* @class CLI
* @classdesc command line interface to sprout
###

class CLI extends EventEmitter

###*
* Sets up the arguments and program info through argparse
* @param {Object} opts - additional options, currently only debug
###

constructor: (opts = {}) ->
@parser = new ArgParse
version: pkg.version
description: pkg.description
debug: opts.debug ? false

@parser.addArgument ['-to', '--to'],
help: "Where you'd like to deploy your site to"

@parser.addArgument ['-e', '--env'],
help: "The environment you'd like to deploy to"

@parser.addArgument ['root'],
nargs: '?'
defaultValue: process.cwd()
help: "Path to the folder you'd like to deploy, defaults to pwd"

###*
* Execute the deploy through the cli with the provided argument, configuring
* if necessary.
*
* @param {Array|String} args - array or space-separated string of arguments
* @return {Promise} promise for completed and configured deploy
###

run: (args) ->
if typeof args is 'string' then args = args.split(' ')
args = @parser.parseArgs(args)
try ship = new Ship(root: args.root, deployer: args.to, env: args.env)
catch err then return @emit('err', err)

if not ship.is_configured()
ship.config_prompt().with(ship)
.then(ship.write_config)
.then(deploy.bind(@, ship))
else
deploy.call(@, ship)

###*
* Run a deploy, monitor the progress, and finish up emitting the right info
* through the cli.
*
* @param {Ship} ship - a Ship instance
* @return {Promise} promise for a finished deploy
###

deploy = (ship) ->
ship.deploy()
.progress(@emit.bind(@, 'info'))
.done (res) =>
@emit("success", "deploy to #{res.deployer} successful!")
if res.url then @emit("success", "Live at: #{res.url}")
, @emit.bind(@, 'err')

module.exports = CLI
92 changes: 0 additions & 92 deletions lib/commands/default.coffee

This file was deleted.

1 change: 0 additions & 1 deletion lib/commands/index.coffee

This file was deleted.

30 changes: 0 additions & 30 deletions lib/deployers/deployer.coffee

This file was deleted.

Loading

0 comments on commit 0fed283

Please sign in to comment.