Skip to content

Commit

Permalink
Initial non working version
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Feb 10, 2013
0 parents commit 974b068
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

node_modules
npm-debug.log

test/out/
test/render-out/
out/
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.travis*
Makefile

src/
out/test/
test/
125 changes: 125 additions & 0 deletions Cakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# This file was originally created by Benjamin Lupton <b@lupton.cc> (http://balupton.com)
# and is currently licensed under the Creative Commons Zero (http://creativecommons.org/publicdomain/zero/1.0/)
# making it public domain so you can do whatever you wish with it without worry (you can even remove this notice!)
#
# If you change something here, be sure to reflect the changes in:
# - the scripts section of the package.json file
# - the .travis.yml file


# -----------------
# Variables

WINDOWS = process.platform.indexOf('win') is 0
NODE = process.execPath
NPM = if WINDOWS then process.execPath.replace('node.exe','npm.cmd') else 'npm'
EXT = (if WINDOWS then '.cmd' else '')
APP = process.cwd()
BIN = "#{APP}/node_modules/.bin"
CAKE = "#{BIN}/cake#{EXT}"
COFFEE = "#{BIN}/coffee#{EXT}"
OUT = "#{APP}/out"
SRC = "#{APP}/src"
TEST = "#{APP}/test"


# -----------------
# Requires

pathUtil = require('path')
{exec,spawn} = require('child_process')
safe = (next,fn) ->
return (err) ->
return next(err) if err
return fn()


# -----------------
# Actions

clean = (opts,next) ->
(next = opts; opts = {}) unless next?
args = [
'-Rf'
OUT
pathUtil.join(APP,'node_modules')
pathUtil.join(APP,'*out')
pathUtil.join(APP,'*log')
pathUtil.join(TEST,'node_modules')
pathUtil.join(TEST,'*out')
pathUtil.join(TEST,'*log')
]
spawn('rm', args, {stdio:'inherit',cwd:APP}).on('exit',next)

compile = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(COFFEE, ['-bco', OUT, SRC], {stdio:'inherit',cwd:APP}).on('exit',next)

watch = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(COFFEE, ['-bwco', OUT, SRC], {stdio:'inherit',cwd:APP}).on('exit',next)

install = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(NPM, ['install'], {stdio:'inherit',cwd:APP}).on 'exit', safe next, ->
spawn(NPM, ['install'], {stdio:'inherit',cwd:TEST}).on('exit',next)

reset = (opts,next) ->
(next = opts; opts = {}) unless next?
clean opts, safe next, -> install opts, safe next, -> compile opts, next

setup = (opts,next) ->
(next = opts; opts = {}) unless next?
install opts, safe next, ->
compile opts, next

test = (opts,next) ->
(next = opts; opts = {}) unless next?
spawn(NPM, ['test'], {stdio:'inherit',cwd:APP}).on('exit',next)

finish = (err) ->
throw err if err
console.log('OK')


# -----------------
# Commands

# clean
task 'clean', 'clean up instance', ->
clean finish

# compile
task 'compile', 'compile our files', ->
compile finish

# dev/watch
task 'dev', 'watch and recompile our files', ->
watch finish
task 'watch', 'watch and recompile our files', ->
watch finish

# install
task 'install', 'install dependencies', ->
install finish

# reset
task 'reset', 'reset instance', ->
reset finish

# setup
task 'setup', 'setup for development', ->
setup finish

# test
task 'test', 'run our tests', ->
test finish

# test-debug
task 'test-debug', 'run our tests in debug mode', ->
test {debug:true}, finish

# test-prepare
task 'test-prepare', 'prepare out tests', ->
setup finish

3 changes: 3 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# History

None yet
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# GitHub Pages Deployer Plugin for [DocPad](http://docpad.org)

Under construction.



## History
You can discover the history inside the `History.md` file


## License
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright &copy; 2013+ [Bevry Pty Ltd](http://bevry.me)
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "docpad-plugin-ghpages",
"version": "2.0.0",
"description": "Deploy to Github Pages easily via `docpad deploy-ghpages`",
"homepage": "http://docpad.org/plugin/ghpages",
"keywords": [
"docpad",
"docpad-plugin", "docpad-deployer",
"github", "github-pages", "ghpages"
],
"author": "Bevry Pty Ltd <us@bevry.me> (http://bevry.me)",
"maintainers": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"contributors": [
"Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)"
],
"bugs": {
"url": "http://docpad.org/plugin/ghpages/issues"
},
"repository" : {
"type": "git",
"url": "https://github.com/docpad/docpad-plugin-ghpages.git"
},
"engines" : {
"node": ">=0.4",
"docpad": ">=6.21 <7"
},
"dependencies": {
"bal-util": "~1.6.1"
},
"devDependencies": {
"coffee-script": "~1.4.0"
},
"main": "./out/ghpages.plugin.js",
"scripts": {
"test": "node ./out/ghpages.test.js"
}
}
48 changes: 48 additions & 0 deletions src/ghpages.plugin.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Prepare
balUtil = require('bal-util')

# Export
module.exports = (BasePlugin) ->
# Define
class GitHubPagesPlugin extends BasePlugin
# Name
name: 'ghpages'

# Config
config:
deployBranch: 'gh-pages'
sourceBranch: 'master'
environment: 'static'

# =============================
# Events

# Console Setup
consoleSetup: (opts) ->
# Prepare
{consoleInterface,commander} = opts
config = @config
docpad = @docpad

console.log 'add deploy-ghpages command'

# Deploy
commander
.command('deploy-ghpages')
.description("deploys your #{config.environment} website to the #{config.deployBranch} branch")
.action consoleInterface.wrapAction (next) ->
console.log 'do initial checkout here'
docpad.action 'generate', {env:opts.environment}, (err) ->
console.log 'do github deploy stuff here'
next(err)

# Chain
@


# =================================
# Actions

generate: (next) =>
@docpad.action('generate',next)
@

0 comments on commit 974b068

Please sign in to comment.