Skip to content

Commit df7e208

Browse files
committed
Bump version, remove module loaded twice and don't depend on bakerhelper
1 parent 1d9dc26 commit df7e208

File tree

5 files changed

+156
-39
lines changed

5 files changed

+156
-39
lines changed

CHANGELOG

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# CHANGELOG
22

3-
## 0.3.0
3+
## 3.0.1
4+
5+
* There's a problem with npm modules and [bakerhelper](https://github.com/dsimard/bakerhelper) is not being installed correctly. Use a local copy for the moment.
6+
7+
## 3.0.0
48

59
This version is not compatible with previous versions of ready.js
610

Cakefile

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
{log, error} = console
33
util = require 'util'
44
{inspect} = util
5-
fs = require 'fs'
6-
path = require 'path'
7-
#extrafs = require './node_modules/fs-extra'
8-
coffee = require './node_modules/coffee-script'
9-
_ = require './node_modules/underscore'
10-
bakerhelper = require './node_modules/bakerhelper'
5+
bakerhelper = require './lib/cake_module/bakerhelper.coffee'
116

127
task 'doc', 'Regenerate doc', (options)->
138
bakerhelper.generateDoccoHusky ['lib/', 'bin/']

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ You can use a configuration file with ready.js. It has to be a JSON with that fo
4242

4343
## Contribute
4444

45-
Give what you want to contribute to open-source :
46-
47-
[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q2QAJSHP8Y8Y)
48-
4945
You can create [issues](https://github.com/dsimard/ready.js/issues).
5046

5147
You can also contribute code :

lib/cake_module/bakerhelper.coffee

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
path = require 'path'
2+
fs = require 'fs'
3+
{exec} = require 'child_process'
4+
{log, error} = console
5+
{inspect} = require 'util'
6+
7+
coffee = require '../../node_modules/coffee-script'
8+
_ = require '../../node_modules/underscore'
9+
colors = require '../../node_modules/colors'
10+
11+
r =
12+
# ### exec(cmd, options, callback)
13+
#
14+
# Overrides `child_process.r.exec` to log to console and exit if there's an error
15+
#
16+
# bakerhelper.exec 'rm *.js', {cwd:'./lib'}, (err, stdout, stderr)->
17+
#
18+
# `options` : See (`child_process`)[http://nodejs.org/api/child_process.html#child_process_child_process_r.exec_command_options_callback] documentation
19+
#
20+
# The callback is passed three arguments (`err`, `stdout`, `stderr`)
21+
exec : (cmd, options, callback=null)->
22+
[callback, options] = [options, {}] if not callback?
23+
log "#{'Executing'.bold.green} `#{cmd}`"
24+
exec cmd, options, (err, stdout, stderr)->
25+
if err?
26+
error stderr.red
27+
process.exit 1
28+
29+
log stdout.grey if stdout? && stdout != ''
30+
callback?(err, stdout, stderr)
31+
32+
# ### compileCoffeescripts(directory, option={})
33+
#
34+
# Compile all the coffeescripts into javascript files from a directory (not recursive)
35+
#
36+
# bakerhelper.compileCoffeescripts './lib/'
37+
# bakerhelper.compileCoffeescripts './bin/', {shebang:true}
38+
#
39+
# `options.shebang` : If it should add a shebang at the top of the file
40+
compileCoffeescripts: (directory, options={})->
41+
# Compile each coffee in js in bin
42+
directory = path.resolve directory
43+
fs.readdir directory, (err, files)->
44+
files.forEach (file)->
45+
# Check if it's a coffee file
46+
if path.extname(file) is '.coffee'
47+
filename = "#{directory}/#{file}"
48+
log "#{'Read'.bold} #{filename.italic}"
49+
fs.readFile filename, (err, data)->
50+
console.error err and process.exit 1 if err?
51+
52+
log "#{'Compile'.bold} #{filename.italic}"
53+
js = coffee.compile(data.toString())
54+
55+
# Add a shebang on top
56+
js = "#!/usr/bin/env node\n#{js}" if options.shebang
57+
58+
# Save to file
59+
filename = filename.replace /\.coffee$/, '.js'
60+
log "#{'Write'.bold} to #{filename.italic}"
61+
62+
fs.writeFile filename, js, 'utf8', (err)->
63+
error err and process.exit 1 if err?
64+
65+
# ### generateDoccoHusky(directories=[])
66+
#
67+
# Generate doc with [docco-husky](https://github.com/mbrevoort/docco-husky)
68+
# and push it to the `gh-pages` branch.
69+
#
70+
# bakerhelper.compileCoffeescripts ['./lib/', './bin']
71+
generateDoccoHusky: (directories)->
72+
directories = (_.flatten([directories])).join ' '
73+
directory = path.resolve './'
74+
75+
# Create a tmp directoryectory
76+
r.exec 'mktemp -d', (err, stdout, stderr)->
77+
error err if err?
78+
tmp = stdout.replace(/^\s*|\s*$/g, '')
79+
80+
# clone the git in that temp directory
81+
r.exec "git clone #{directory} #{tmp}", (err, stdout, stderr)->
82+
error err if err?
83+
log stdout
84+
85+
# Change branch to gh-pages
86+
r.exec "git checkout gh-pages", {cwd:tmp}, (err, stdout, stderr)->
87+
error err if err?
88+
log stdout
89+
90+
# Create doc
91+
r.exec "docco-husky #{directories}", (err, stdout, stderr)->
92+
error err if err?
93+
log stdout
94+
95+
# Move the doc to the tmp directory
96+
r.exec "cp #{directory}/docs/* #{tmp} -r", (err, stdout, stderr)->
97+
error err if err?
98+
log stdout
99+
100+
# Commit to gh-pages
101+
r.exec "git add . && git commit -am 'Generated automatically'", {cwd:tmp}, (err, stdout, stderr)->
102+
error err if err?
103+
log stdout
104+
105+
# Push to gh-pages
106+
r.exec "git push origin gh-pages", {cwd:tmp}, (err, stdout, stderr)->
107+
error err if err?
108+
log stdout
109+
110+
# Remove the docs directory
111+
r.exec "rm -r #{directory}/docs/"
112+
113+
module.exports = r

package.json

+37-28
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
{
2-
"name" : "ready.js",
3-
"version" : "3.0.0",
4-
"description" : "continuous javascript integration",
5-
"keywords" : ["continuous integration", "jslint", "javascript", "minifier", "compiler", "ci", "uglifier"],
6-
"author" : "dsimard <[email protected]> (http://github.com/dsimard)",
7-
"bin" : { "readyjs" : "./bin/ready.js" },
8-
"repository" : {
9-
"type" : "git",
10-
"url" : "https://[email protected]/dsimard/ready.js.git"
1+
{
2+
"name": "ready.js",
3+
"version": "3.0.1",
4+
"description": "continuous javascript integration",
5+
"keywords": [
6+
"continuous integration",
7+
"jslint",
8+
"javascript",
9+
"minifier",
10+
"compiler",
11+
"ci",
12+
"uglifier"
13+
],
14+
"author": "dsimard <[email protected]> (http://github.com/dsimard)",
15+
"bin": {
16+
"readyjs": "./bin/ready.js"
17+
},
18+
"repository": {
19+
"type": "git",
20+
"url": "https://[email protected]/dsimard/ready.js.git"
1121
},
1222
"scripts": {
1323
"test": "node ./node_modules/.bin/mocha --compilers coffee:coffee-script tests/*.coffee",
@@ -20,24 +30,23 @@
2030
"url": "https://raw.github.com/dsimard/ready.js/master/LICENSE"
2131
}
2232
],
23-
"dependencies" : {
24-
"optimist" : "~0.3.1",
25-
"colors" : "~0.6.0",
26-
"uglify-js" : "~2.2.2",
27-
"jshint" : "~0.9.1",
28-
"underscore" : "~1.4.3",
29-
"async" : "~0.1.22",
30-
"readdirp" : ">= 0.2.2",
31-
"minimatch" : "~0.2.9",
32-
"fs-extra" : "~0.3.2"
33+
"dependencies": {
34+
"optimist": "~0.3.1",
35+
"colors": "~0.6.0",
36+
"uglify-js": "~2.2.2",
37+
"jshint": "~0.9.1",
38+
"underscore": "~1.4.3",
39+
"async": "~0.1.22",
40+
"readdirp": ">= 0.2.2",
41+
"minimatch": "~0.2.9",
42+
"fs-extra": "~0.6.0"
3343
},
34-
"devDependencies" : {
35-
"mocha" : "latest",
36-
"should" : "latest",
37-
"coffee-script" : "latest",
38-
"fs-extra" : "latest",
39-
"docco-husky" : "latest",
40-
"bakerhelper" : "~0.0.1"
44+
"devDependencies": {
45+
"mocha": "latest",
46+
"should": "latest",
47+
"coffee-script": "latest"
4148
},
42-
"engines" : {"node" : ">=0.4.0"}
49+
"engines": {
50+
"node": ">=0.4.0"
51+
}
4352
}

0 commit comments

Comments
 (0)