write current version to Ox.json and patch Ox.VERSION if loaded via dev/Ox.js

This commit is contained in:
j 2012-06-05 13:59:13 +02:00
parent 01587f7348
commit 57caa45bf8
5 changed files with 12 additions and 9 deletions

View file

@ -292,7 +292,7 @@ Ox.load(function() {
/:\/\/oxjs.org\//.test(window.location.href) /:\/\/oxjs.org\//.test(window.location.href)
? 'The latest version is' ? 'The latest version is'
: 'You\'re currently running version' : 'You\'re currently running version'
) + ' <code>' + app.data.version + '.</code>' ) + ' <code>' + Ox.VERSION + '.</code>'
} }
] ]
}, },

View file

@ -1,5 +1,5 @@
<h1><b>Downloads</b></h1> <h1><b>Downloads</b></h1>
<p>Please note that these are a pre-release versions. {version}</p> <p>Please note that these are pre-release versions. {version}</p>
<br> <br>
<h2><b>Source</b></h2> <h2><b>Source</b></h2>
<p>Development version, including everything but the kitchen sink.</p> <p>Development version, including everything but the kitchen sink.</p>
@ -31,4 +31,4 @@
<p>For the development version, use <code>OxJS/dev/Ox.js</code> instead. And to include <code>Ox.UI</code>, start with <code>Ox.load('UI', function() { ... })</code>.</p> <p>For the development version, use <code>OxJS/dev/Ox.js</code> instead. And to include <code>Ox.UI</code>, start with <code>Ox.load('UI', function() { ... })</code>.</p>
<br> <br>
<h2><b>License</b></h2> <h2><b>License</b></h2>
<p>Dual-licensed, <a href=\"http://en.wikipedia.org/wiki/GNU_General_Public_License\">GPL</a>/<a href=\"http://en.wikipedia.org/wiki/MIT_License\">MIT</a>. You can pick either. In a nutshell, the former says no derived work may be more restrictive, while the latter avoids to make that restriction.</p> <p>Dual-licensed, <a href=\"http://en.wikipedia.org/wiki/GNU_General_Public_License\">GPL</a>/<a href=\"http://en.wikipedia.org/wiki/MIT_License\">MIT</a>. You can pick either. In a nutshell, the former says no derived work may be more restrictive, while the latter avoids to make that restriction.</p>

View file

@ -19,7 +19,8 @@ window.Ox = {
path = getPath(); path = getPath();
loadJSON(function(data) { loadJSON(function(data) {
loadScripts(data, function() { loadScripts(data.files, function() {
Ox.VERSION = data.version;
if (args.length == 1) { if (args.length == 1) {
callback() callback()
} else { } else {

View file

@ -1,5 +1,5 @@
Ox.load({Geo: {}, Image: {}, UI: {}, Unicode: {}}, function() { Ox.load({Geo: {}, Image: {}, UI: {}, Unicode: {}}, function() {
Ox.getJSON('../dev/Ox/json/Ox.json', function(files) { Ox.getJSON('../dev/Ox/json/Ox.json', function(data) {
var $body = $('body') var $body = $('body')
.css({ .css({
@ -23,7 +23,7 @@ Ox.load({Geo: {}, Image: {}, UI: {}, Unicode: {}}, function() {
setBackground($tests, true); setBackground($tests, true);
tests( tests(
Ox.flatten(files).sort().map(function(file) { Ox.flatten(data.files).sort().map(function(file) {
return '../dev/' + file; return '../dev/' + file;
}).concat([ }).concat([
'../dev/Ox.Geo/Ox.Geo.js', '../dev/Ox.Geo/Ox.Geo.js',

View file

@ -126,7 +126,10 @@ def build_oxjs(downloads=False, geo=False):
ox_files[2].append(js_dir + filename) ox_files[2].append(js_dir + filename)
js = re.sub("Ox.VERSION = '([\d\.]+)'", "Ox.VERSION = '%s'" % version, js) js = re.sub("Ox.VERSION = '([\d\.]+)'", "Ox.VERSION = '%s'" % version, js)
write_file(build_path + 'Ox.js', ox.js.minify(js, comment)) write_file(build_path + 'Ox.js', ox.js.minify(js, comment))
write_file(dev_path + '/Ox/json/' + 'Ox.json', json.dumps(ox_files, indent=4)) write_file(dev_path + '/Ox/json/' + 'Ox.json', json.dumps({
'files': ox_files,
'version': version
}, indent=4))
# Ox.UI # Ox.UI
js = '' js = ''
@ -183,8 +186,7 @@ def build_oxjs(downloads=False, geo=False):
lambda x: not re.search('^[\._]', x), lambda x: not re.search('^[\._]', x),
os.listdir(root_path + 'readme/html/') os.listdir(root_path + 'readme/html/')
) )
), )
'version': version
} }
write_file(root_path + 'index.json', json.dumps(data, indent=4, sort_keys=True)) write_file(root_path + 'index.json', json.dumps(data, indent=4, sort_keys=True))