Permalink
Browse files

Finally resolved npmjs.org README issue, see https://github.com/isaac…

  • Loading branch information...
1 parent 2b430bb commit d1ab38015e25657710dd6693c1ff52ff4a59e9a0 @srackham committed Oct 13, 2012
Showing with 28 additions and 11 deletions.
  1. +27 −10 Jakefile.coffee
  2. +1 −1 clisms.coffee
  3. 0 clisms.js
View
@@ -2,11 +2,13 @@
path = require 'path'
fs = require 'fs'
-DEFAULT_BUILD = 'build.ts' # The published executable is built from TypeScript.
+PUBLISHED_BUILD = 'build.ts' # The published executable is built from TypeScript.
CS_SRC = path.join __dirname, 'clisms.coffee'
TS_SRC = path.join __dirname, 'clisms.ts'
JS_EXE = path.join __dirname, 'clisms.js'
+NPM_README = path.join __dirname, 'README.md'
+GITHUB_README = path.join __dirname, 'README.asciidoc'
EXEC_PRINT_OPTS = printStdout: true, printStderr: true
@@ -16,13 +18,21 @@ addShebang = (script, linesep = '\n') ->
desc 'List Jake tasks.'
task 'default', -> jake.exec ['jake -T'], EXEC_PRINT_OPTS
+# Used internally to compile JavaScript executable.
+# Invoked with compile command string.
+task 'build', async: true, ['validate'], (compile_cmd)->
+ jake.exec [compile_cmd], ->
+ addShebang JS_EXE
+ complete()
+ , EXEC_PRINT_OPTS
+
desc 'Build JavaScript executable from CoffeeScript source.'
-task 'build.coffee', ['validate'], ->
- jake.exec ["coffee -c '#{CS_SRC}'"], (-> addShebang JS_EXE), EXEC_PRINT_OPTS
+task 'build.coffee', ->
+ jake.Task['build'].invoke "coffee -c '#{CS_SRC}'"
desc 'Build JavaScript executable from TypeScript source.'
-task 'build.ts', ['validate'], ->
- jake.exec ["tsc '#{TS_SRC}'"], (-> addShebang JS_EXE), EXEC_PRINT_OPTS
+task 'build.ts', ->
+ jake.Task['build'].invoke "tsc '#{TS_SRC}'"
desc 'Validate package.json.'
task 'validate', ->
@@ -31,12 +41,19 @@ task 'validate', ->
catch error
fail "package.json: invalid JSON: #{error.message}"
-desc 'Publish the package to NPM.'
-task 'publish', [DEFAULT_BUILD], ->
- jake.exec ['npm publish --force'], EXEC_PRINT_OPTS
-
+desc 'Publish the package to npmjs.org'
+task 'publish', async: true, [PUBLISHED_BUILD], ->
+ # Create stub Markdown README because npmjs.org only handles Markdown.
+ fs.writeFileSync NPM_README, "See <https://github.com/srackham/clisms>"
+ # Temporarily move the github README out of the way so it's no published.
+ fs.renameSync GITHUB_README, 'publish.tmp'
+ jake.exec ['npm publish --force'], ->
+ fs.renameSync 'publish.tmp', GITHUB_README
+ complete()
+ , breakOnError: false, printStdout: true, printStderr: true
+
desc 'Commit with message in file COMMIT.'
-task 'commit', [DEFAULT_BUILD], ->
+task 'commit', [PUBLISHED_BUILD], ->
jake.exec ['git commit -a -F COMMIT'], EXEC_PRINT_OPTS
desc 'Push project to github.'
View
@@ -92,7 +92,7 @@ MSG_STATUS =
String::startsWith = (s) -> s == this[0...s.length]
String::endsWith = (s) -> s == this[-s.length..]
-# Execute shell command. 'cmd' is executable path; 'opts' is arguments arrary;
+# Execute shell command. 'cmd' is executable path; 'opts' is arguments array;
# 'callback' is executed and passed the process exit code when the command
# exits.
shell = (cmd, opts, callback) ->
View
0 clisms.js 100755 → 100644
No changes.

0 comments on commit d1ab380

Please sign in to comment.