Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michiel Kalkman
committed
Apr 9, 2012
0 parents
commit a3a1d64
Showing
21 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
npm-test.sh | ||
npm-test.js | ||
node_modules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
- The ASCII art goldfish used for the cli.js module was created by 'jgs'. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Copyright (c) 2011 Michiel Kalkman | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# ranchu | ||
|
||
ranchu is a command-line tool for developing Mendix JavaScript Custom widgets. | ||
It builds on nodejs, npm and many supporting libraries (see package.json and CREDITS). | ||
|
||
At the moment it isn't even ALPHA and very much under development. | ||
|
||
It is named after a Japanese goldfish http://en.wikipedia.org/wiki/Ranchu | ||
because Mendix has the goldfish as its mascot. | ||
|
||
Contributions are welcome - pull requests are preferred over feature requests. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env node | ||
|
||
console.log("** Running ranchu CLI"); | ||
console.log(" /-----\\ _, _,"); | ||
console.log(" | BLUP! | .' ( .-' /"); | ||
console.log(" \\-----/ _/..._'. .' /"); | ||
console.log(" \\ .-'` ` '-./ _.'"); | ||
console.log(" ( o) ;= <_"); | ||
console.log(" '-.,/__ __.-;`\\ '."); | ||
console.log(" \\) |`\\ \\) '. \\ "); | ||
console.log(" \\_/ jgs -._/ "); | ||
|
||
require('coffee-script'); | ||
require('../lib/ranchu').cli(); | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ranchu = require './ranchu' | ||
|
||
cli = module.exports = (args)-> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
fs = require 'fs' | ||
|
||
module.exports = ()-> | ||
is_ranchu = yes | ||
|
||
try | ||
file = fs.readFileSync 'config.json', 'utf-8' | ||
catch e | ||
is_ranchu = no | ||
|
||
if is_ranchu | ||
config = JSON.parse file | ||
console.log "Project #{config.name} at version #{config.version}" | ||
config | ||
else | ||
{} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
ranchu = require '../ranchu' | ||
|
||
build = module.exports = (args)-> | ||
|
||
config = ranchu.config() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ranchu = require '../ranchu' | ||
|
||
cli = module.exports = ()-> | ||
ranchu.log "Running cli.." | ||
argv = process.argv | ||
arg = argv[2] | ||
|
||
if arg? | ||
ranchu.log "Found #{arg}" | ||
if ranchu[arg] | ||
ranchu.log "Running #{arg}" | ||
ranchu[arg](argv.splice(3, argv.length)) | ||
else | ||
ranchu.log "No task #{arg} found" | ||
else | ||
ranchu.log "No parameters given, try help" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ranchu = require '../ranchu' | ||
|
||
jsp = require("uglify-js").parser | ||
pro = require("uglify-js").uglify | ||
|
||
module.exports = (code) -> | ||
ast = jsp.parse(code) | ||
ast = pro.ast_mangle(ast) | ||
ast = pro.ast_squeeze(ast) | ||
pro.gen_code(ast) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
ltx = require 'ltx' | ||
|
||
# <?xml version="1.0" encoding="utf-8" ?> | ||
# <package xmlns="http://www.mendix.com/package/1.0/"> | ||
# <clientModule name="boolslide" version="0.1" xmlns="http://www.mendix.com/clientModule/1.0/"> | ||
# <widgetFiles> | ||
# <widgetFile path="boolslide/Slider.xml"/> | ||
# </widgetFiles> | ||
# <files> | ||
# <file path="boolslide/"/> | ||
# </files> | ||
# </clientModule> | ||
# </package> | ||
|
||
module.exports = (config)-> | ||
el = new ltx.Element('package', { | ||
'xmlns' :'http://www.mendix.com/package/1.0/' | ||
}).c('clientModule', { | ||
'name' : config.name | ||
'version' : config.version, | ||
'xmlns' : 'http : //www.mendix.com/clientModule/1.0/' | ||
}) | ||
|
||
el.c('widgetFiles') | ||
for path in config.widgetFiles | ||
el.c('widgetFile', { | ||
'path' : path | ||
}).up() | ||
|
||
el.c('file') | ||
for path in config.files | ||
el.c('file', { | ||
'path' : path | ||
}).up() | ||
|
||
# cfg = { | ||
# name : 'ZorkName', | ||
# version : '1.0', | ||
# widgetFiles : [ | ||
# 'boolslider.xml' | ||
# ], | ||
# files : [ | ||
# 'boolslide' | ||
# ] | ||
# } | ||
# | ||
# console.log genpackage(cfg).toString() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
ranchu = require '../ranchu' | ||
|
||
help = module.exports = (args)-> | ||
ranchu.log "Help .." | ||
ranchu.log "Available commands are," | ||
ranchu.plugins.forEach (plugin) -> | ||
ranchu.log " #{plugin}" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ranchu = require '../ranchu' | ||
fs = require 'fs' | ||
|
||
module.exports = (args)-> | ||
project = args[0] | ||
ranchu.log "Creating new project #{project}.." | ||
|
||
fs.mkdirSync project | ||
process.chdir(project) | ||
|
||
["src", "build"].forEach (dir) -> | ||
fs.mkdirSync dir | ||
|
||
fs.writeFileSync "config.json", JSON.stringify({ | ||
"name" : project | ||
"version" : "0.0.1", | ||
"widgets" : [ | ||
], | ||
"compress" : true, | ||
"coffee" : false | ||
}, null, 4) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ranchu = require '../ranchu' | ||
|
||
config = require '../helpers/config' | ||
|
||
module.exports = (args)-> | ||
console.log "Testing ..." | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
path = require "path" | ||
fs = require "fs" | ||
|
||
logging = true | ||
|
||
console.log " *** Loading helpers" | ||
config = require './helpers/config' | ||
|
||
console.log " *** Loading plugins" | ||
|
||
pluginDirs = [ | ||
__dirname + "/plugins", | ||
"~/.ranchu/plugins" | ||
] | ||
|
||
plugins = pluginDirs.reduce((prev, curr) -> | ||
console.log " *** Checking #{curr}" | ||
if fs.existsSync curr | ||
prev.concat fs.readdirSync(curr).map (plugin)-> | ||
plugin.replace(/\.\w*$/, '') | ||
else | ||
prev | ||
|
||
, []) | ||
|
||
|
||
ranchu = module.exports = { | ||
config : config, | ||
plugins : plugins, | ||
version : '0.0.1', | ||
log : (str) -> | ||
if logging then console.log " *** #{str}" | ||
} | ||
|
||
plugins.forEach (plugin) -> | ||
ranchu.log "Adding plugin #{plugin}" | ||
ranchu[plugin] = require "./plugins/" + plugin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"name" : "ranchu", | ||
"version" : "0.0.1", | ||
"author" : "Michiel Kalkman <michielkalkman@gmail.com>", | ||
"directories" : { "lib" : "./lib" }, | ||
"main" : "./lib/ranchu", | ||
"bin" : "./bin/ranchu", | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "http://github.com/michiel/ranchu.git" | ||
}, | ||
"engines": { | ||
"node": ">= 0.6.0" | ||
}, | ||
"preferGlobal": false, | ||
"dependencies": { | ||
"ltx" : "0.x.x", | ||
"jshint" : "0.x.x", | ||
"uglify-js" : "0.x.x", | ||
"sequencer" : "0.x.x", | ||
"coffee-script" : "0.x.x" | ||
}, | ||
"description" : "A build tool for Mendix JavaScript custom widget development", | ||
"keywords" : [ | ||
"mendix" | ||
] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name" : "ZorkName", | ||
"version" : "1.0", | ||
"widgetFiles" : [ | ||
"zorkthing.xml" | ||
], | ||
"files" : [ | ||
"zorkthing" | ||
] | ||
} | ||
|
Empty file.
Empty file.