Skip to content

Commit

Permalink
Release-v0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 28, 2013
1 parent 331bcc6 commit e78fb82
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 67 deletions.
49 changes: 20 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
var fs = require('fs'),
path = require('path'),
semver = require('semver')

module.exports = function( grunt ) {

grunt.initConfig({
Expand All @@ -17,7 +13,7 @@ module.exports = function( grunt ) {
src: '.',
dest: 'dist'
},
unit: {
test: {
options: {
name: 'vue.test'
},
Expand Down Expand Up @@ -53,13 +49,7 @@ module.exports = function( grunt ) {
build: {
options: {
compress: true,
mangle: true,
banner:
'/*\n' +
' VueJS v<%= version %>\n' +
' (c) 2013 Evan You\n' +
' License: MIT\n' +
'*/\n'
mangle: true
},
files: {
'dist/vue.min.js': 'dist/vue.js'
Expand All @@ -68,51 +58,52 @@ module.exports = function( grunt ) {
},

watch: {
options: {
nospawn: true
},
dev: {
files: ['src/**/*.js', 'component.json'],
files: ['src/**/*.js', './component.json'],
tasks: ['componentbuild', 'jsc']
}
}

})

grunt.loadNpmTasks( 'grunt-contrib-watch' )
grunt.loadNpmTasks( 'grunt-contrib-jshint' )
grunt.loadNpmTasks( 'grunt-contrib-uglify' )
grunt.loadNpmTasks( 'grunt-component-build' )
grunt.loadNpmTasks( 'grunt-mocha' )
// load npm tasks
require('load-grunt-tasks')(grunt)

// load custom tasks
grunt.file.recurse('tasks', function (path) {
require('./' + path)(grunt)
})

grunt.registerTask( 'build', [
'componentbuild:build',
grunt.registerTask( 'dist', [
'uglify',
'banner',
'size'
])

grunt.registerTask( 'build', [
'componentbuild:build',
'dist'
])

grunt.registerTask( 'unit', [
'componentbuild:unit',
'componentbuild:test',
'jsc',
'mocha'
])

grunt.registerTask( 'e2e', [
'componentbuild:build',
'casper'
])

grunt.registerTask( 'test', [
'unit',
'e2e'
'componentbuild:build',
'casper'
])

grunt.registerTask( 'default', [
'jshint',
'test',
'uglify',
'size'
'dist'
])

}
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "vue",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/vue.js",
"ignore": [
".*",
"examples",
"src",
"test",
"tasks",
"Gruntfile.js",
"*.json",
"*.md"
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue",
"version": "0.7.1",
"version": "0.7.2",
"main": "src/main.js",
"description": "Data-driven View Models",
"keywords": ["mvvm", "framework", "data binding"],
Expand Down
40 changes: 26 additions & 14 deletions dist/vue.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
VueJS v0.7.2
(c) 2013 Evan You
License: MIT
*/
;(function(){

/**
Expand Down Expand Up @@ -778,6 +783,9 @@ var utils = module.exports = {
warn: function() {
if (!config.silent && console) {
console.warn(join.call(arguments, ' '))
if (config.debug) {
console.trace()
}
}
},

Expand Down Expand Up @@ -1262,25 +1270,27 @@ CompilerProto.define = function (key, binding) {
log(' defined root binding: ' + key)

var compiler = this,
data = compiler.data,
vm = compiler.vm,
value = binding.value = data[key] // save the value before redefinening it

if (utils.typeOf(value) === 'Object' && value.$get) {
compiler.markComputed(binding)
}
data = compiler.data,
vm = compiler.vm,
ob = data.__observer__

if (!(key in data)) {
data[key] = undefined
}

// if the data object is already observed, that means
// this binding is created late. we need to observe it now.
if (data.__observer__) {
// if the data object is already observed, but the key
// is not observed, we need to add it to the observed keys.
if (ob && !(key in ob.values)) {
Observer.convert(data, key)
}

var value = binding.value = data[key]
if (utils.typeOf(value) === 'Object' && value.$get) {
compiler.markComputed(binding)
}

Object.defineProperty(vm, key, {
enumerable: !binding.isComputed,
get: binding.isComputed
? function () {
return compiler.data[key].$get()
Expand Down Expand Up @@ -1821,14 +1831,16 @@ function convert (obj, key) {
if ((keyPrefix === '$' || keyPrefix === '_') && key !== '$index') {
return
}
var observer = obj.__observer__,
val = obj[key],
values = observer.values
values[key] = val
// emit set on bind
// this means when an object is observed it will emit
// a first batch of set events.
var observer = obj.__observer__,
values = observer.values,
val = values[key] = obj[key]
observer.emit('set', key, val)
if (Array.isArray(val)) {
observer.emit('set', key + '.length', val.length)
}
Object.defineProperty(obj, key, {
get: function () {
var value = values[key]
Expand Down
4 changes: 2 additions & 2 deletions dist/vue.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue",
"version": "0.7.1",
"version": "0.7.2",
"author": {
"name": "Evan You",
"email": "yyx990803@gmail.com",
Expand All @@ -25,12 +25,13 @@
"grunt": "~0.4.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-component-build": "~0.4.1",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-uglify": "~0.2.7",
"grunt-mocha": "~0.4.6",
"jscoverage": "~0.3.8",
"jshint-stylish": "0.1.3",
"jshint-stylish": "~0.1.4",
"semver": "~2.2.1",
"shell-task": "~0.1.1"
"shell-task": "~0.1.1",
"load-grunt-tasks": "~0.2.1"
}
}
29 changes: 29 additions & 0 deletions tasks/banner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var fs = require('fs')

var bannerText =
'/*\n' +
' VueJS v<%= version %>\n' +
' (c) 2013 Evan You\n' +
' License: MIT\n' +
'*/\n'

module.exports = function (grunt) {

grunt.registerTask('banner', function () {
var done = this.async(),
banner = new Buffer(grunt.template.process(bannerText)),
written = 0
addBanner('dist/vue.js', banner, next)
addBanner('dist/vue.min.js', banner, next)
function next () {
if (written) return done()
written++
}
})

function addBanner (file, banner, next) {
fs.readFile(file, function (err, buf) {
fs.writeFile(file, Buffer.concat([banner, buf]), next)
})
}
}
22 changes: 8 additions & 14 deletions tasks/jsc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
var fs = require('fs')
var fs = require('fs'),
jsc = require('jscoverage')

module.exports = function (grunt) {
grunt.registerTask( 'jsc', function () {
var done = this.async()
grunt.util.spawn({
cmd: './node_modules/jscoverage/bin/jscoverage',
args: ['./test/vue.test.js'],
opts: {
stdio: 'inherit'
}
}, function (err, res) {
if (err) grunt.fail.fatal(res.stdout || 'Jscoverage instrumentation failed')
grunt.log.writeln(res.stdout)
fs.unlinkSync('./test/vue.test.js')
done()
})
jsc.processFile(
'./test/vue.test.js',
'./test/vue.test-cov.js',
null, {}
)
fs.unlink('./test/vue.test.js', this.async())
})
}
3 changes: 1 addition & 2 deletions tasks/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ module.exports = function (grunt) {
'jshint',
'test',
'version:' + next,
'uglify',
'size',
'dist',
'git:' + next
])
}
Expand Down

0 comments on commit e78fb82

Please sign in to comment.