Skip to content

Commit

Permalink
Merge branch 'release/0.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
agate committed Jan 1, 2012
2 parents 0abcc9f + aa4a6ba commit 43caa8b
Show file tree
Hide file tree
Showing 23 changed files with 88 additions and 77 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@
Gemfile.lock
pkg/*
*.swp
npm-debug.log
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,3 +1,9 @@
0.4.4
----------
* fixed gem package build error
* fixed npm bin execute probelm
* added ms-parse and ms-run in gem's bin dir
* improved gem/npm publish command

0.4.3.pre5
----------
Expand Down
33 changes: 17 additions & 16 deletions Rakefile
Expand Up @@ -34,8 +34,6 @@ namespace :test do

desc "run all tests on node platform"
task :node => :compile do
require "./platforms/gem/lib/mochiscript"

get_files.each do |f|
puts "Testing: " + f
unless system("./bin/ms-run #{f}")
Expand All @@ -62,32 +60,35 @@ end

desc "compile src to target"
task :compile do
@boot = BOOT.collect { |f| parse("#{SRC_DIR}/#{f}.ms") }.join("\n")
@boot = BOOT.collect { |f| parse("#{SRC_DIR}/#{f}.ms") }.join("\n")
@parser = PARSER.collect { |f| parse("#{SRC_DIR}/#{f}.ms") }.join("\n")

{
# gem
'boot.js.erb' => './platforms/gem/vendor/assets/javascripts/mochiscript.js',
'core.rb.erb' => './platforms/gem/lib/mochiscript/core.rb',
'mochiscript.rb.erb' => './platforms/gem/lib/mochiscript.rb',

# npm
'node.js.erb' => './platforms/npm/lib/mochiscript/mochiscript.js',
'package.json.erb' => './platforms/npm/package.json'
}.each_pair do |target, destination|
target = "./src/platforms/#{target}"
puts "Writing #{target} to #{destination}"
traverse_dir('./src/platforms') do |target|
destination = target.sub(/^\.\/src(.*)\.erb$/, '.\1')
puts "Compiling #{target}\n --> #{destination}"
File.open(destination, "w") { |t| t << ERB.new(File.read(target)).result(binding) }
end
end

desc "copy over bootstrap"
task :bootstrap do
[ './platforms/npm/lib/mochiscript/mochiscript.js' ].each do |f|
sh "cp #{f} ./bootstrap/"
sh "cp #{f} ./bootstrap/"
end
end

def parse(file)
`./bootstrap/ms-parse #{file}`
end

def traverse_dir(file_path)
if File.directory? file_path
Dir.foreach(file_path) do |file|
if file!="." and file!=".."
traverse_dir("#{file_path}/#{file}"){ |x| yield x }
end
end
else
yield file_path
end
end
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.4.3
0.4.4
1 change: 0 additions & 1 deletion bootstrap/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion bootstrap/ms-parse
@@ -1,6 +1,6 @@
#!/usr/bin/env node

var $m = require('mochiscript').mochi;
var $m = require('./mochiscript').mochi;
var fs = require('fs');

var file = process.argv[process.argv.length-1];
Expand Down
6 changes: 6 additions & 0 deletions platforms/gem/bin/ms-parse
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../lib/mochiscript'

ctx = Mochiscript::Context.new
puts ctx.parse(File.read(ARGV[0]))
6 changes: 6 additions & 0 deletions platforms/gem/bin/ms-run
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../lib/mochiscript'

ctx = Mochiscript::Context.new
ctx.eval_ms(File.read(ARGV[0]))
6 changes: 1 addition & 5 deletions platforms/gem/lib/mochiscript.rb
@@ -1,7 +1,3 @@
module Mochiscript
VERSION = "0.4.3".sub("-", '.')
end

require File.dirname(__FILE__) + '/mochiscript/version'
require File.dirname(__FILE__) + '/mochiscript/core'
require File.dirname(__FILE__) + '/mochiscript/rails/engine' if defined?(::Rails)

5 changes: 3 additions & 2 deletions platforms/gem/lib/mochiscript/core.rb
Expand Up @@ -601,18 +601,19 @@ class Parser
return parser.toString();
};
$m.toJSON = function (str) {
$m.toJSON = function (str, options) {
var parser = new $c.RootParser();
parser.parse(new $c.Tokens(str));
return parser.toJSON();
};
$m.pp = function (str) {
$m.pp = function (str, options) {
var parser = new $c.RootParser();
parser.parse(new $c.Tokens(str));
return parser.pp();
};
var OPTIONS = {};
$m.Class.extend("RootParser", function(KLASS, OO){
OO.addMember("handlers", {});
Expand Down
3 changes: 3 additions & 0 deletions platforms/gem/lib/mochiscript/version.rb
@@ -0,0 +1,3 @@
module Mochiscript
VERSION = "0.4.4"
end
2 changes: 1 addition & 1 deletion platforms/npm/bin/ms-parse
@@ -1,6 +1,6 @@
#!/usr/bin/env node

var $m = require('../lib/mochiscript').mochi;
var $m = require('../lib/mochiscript/mochiscript').mochi;
var fs = require('fs');

var file = process.argv[process.argv.length-1];
Expand Down
2 changes: 1 addition & 1 deletion platforms/npm/bin/ms-run
@@ -1,6 +1,6 @@
#!/usr/bin/env node

require('../lib/mochiscript');
require('../lib/mochiscript/mochiscript');

var file = process.env['PWD'] + '/' + process.argv[process.argv.length-1];
require(file);
5 changes: 3 additions & 2 deletions platforms/npm/lib/mochiscript/mochiscript.js
Expand Up @@ -567,18 +567,19 @@ $m.parse = function (str) {
return parser.toString();
};

$m.toJSON = function (str) {
$m.toJSON = function (str, options) {
var parser = new $c.RootParser();
parser.parse(new $c.Tokens(str));
return parser.toJSON();
};

$m.pp = function (str) {
$m.pp = function (str, options) {
var parser = new $c.RootParser();
parser.parse(new $c.Tokens(str));
return parser.pp();
};

var OPTIONS = {};

$m.Class.extend("RootParser", function(KLASS, OO){
OO.addMember("handlers", {});
Expand Down
29 changes: 13 additions & 16 deletions platforms/npm/package.json
@@ -1,21 +1,18 @@
{
"name": "mochiscript",
"description": "Javascript Dessert",
"keywords": ["javascript", "language", "mochiscript", "compiler"],
"author": "Jeff Su",
"version": "0.4.3",
"licenses": [{
"type": "MIT"
}],
"engines": {
"node": ">=0.4.0"
},
"directories" : {
"lib" : "./lib/mochiscript"
},
"name": "mochiscript",
"description": "Javascript Dessert",
"keywords": [ "javascript", "language", "mochiscript", "compiler" ],
"author": "Jeff Su",
"version": "0.4.4",
"licenses": [ { "type": "MIT" }],
"engines": { "node": ">=0.4.0" },
"directories": { "lib": "./lib/mochiscript" },
"main" : "./lib/mochiscript/mochiscript",
"bin": {},
"repository": {
"bin": {
"ms-parse": "./bin/ms-parse",
"ms-run": "./bin/ms-run"
},
"repository": {
"type": "git",
"url": "git://github.com/jeffsu/mochiscript.git"
}
Expand Down
5 changes: 3 additions & 2 deletions src/parsers.ms
Expand Up @@ -4,18 +4,19 @@ $m.parse = function (str) {
return parser.toString();
};

$m.toJSON = function (str) {
$m.toJSON = function (str, options) {
var parser = new $c.RootParser();
parser.parse(new $c.Tokens(str));
return parser.toJSON();
};

$m.pp = function (str) {
$m.pp = function (str, options) {
var parser = new $c.RootParser();
parser.parse(new $c.Tokens(str));
return parser.pp();
};

var OPTIONS = {};

class RootParser {
var handlers = {};
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions src/platforms/gem/lib/mochiscript/version.rb.erb
@@ -0,0 +1,3 @@
module Mochiscript
VERSION = "<%= VERSION.sub("-", '.') %>"
end
File renamed without changes.
7 changes: 0 additions & 7 deletions src/platforms/mochiscript.rb.erb

This file was deleted.

File renamed without changes.
19 changes: 19 additions & 0 deletions src/platforms/npm/package.json.erb
@@ -0,0 +1,19 @@
{
"name": "mochiscript",
"description": "Javascript Dessert",
"keywords": [ "javascript", "language", "mochiscript", "compiler" ],
"author": "Jeff Su",
"version": "<%= VERSION.sub(/\.pre.*(\d+)$/, '-pre-\1') %>",
"licenses": [ { "type": "MIT" }],
"engines": { "node": ">=0.4.0" },
"directories": { "lib": "./lib/mochiscript" },
"main" : "./lib/mochiscript/mochiscript",
"bin": {
"ms-parse": "./bin/ms-parse",
"ms-run": "./bin/ms-run"
},
"repository": {
"type": "git",
"url": "git://github.com/jeffsu/mochiscript.git"
}
}
22 changes: 0 additions & 22 deletions src/platforms/package.json.erb

This file was deleted.

0 comments on commit 43caa8b

Please sign in to comment.