From 57caa45bf8a76ffc851df8e482399207bb408ef6 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 5 Jun 2012 13:59:13 +0200 Subject: [PATCH] write current version to Ox.json and patch Ox.VERSION if loaded via dev/Ox.js --- index.js | 2 +- readme/html/_downloads.html | 4 ++-- source/Ox.js | 3 ++- tests/js/tests.js | 4 ++-- tools/build/build.py | 8 +++++--- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index b578519f..6ea4222b 100644 --- a/index.js +++ b/index.js @@ -292,7 +292,7 @@ Ox.load(function() { /:\/\/oxjs.org\//.test(window.location.href) ? 'The latest version is' : 'You\'re currently running version' - ) + ' ' + app.data.version + '.' + ) + ' ' + Ox.VERSION + '.' } ] }, diff --git a/readme/html/_downloads.html b/readme/html/_downloads.html index ef308f9d..116ef369 100644 --- a/readme/html/_downloads.html +++ b/readme/html/_downloads.html @@ -1,5 +1,5 @@

Downloads

-

Please note that these are a pre-release versions. {version}

+

Please note that these are pre-release versions. {version}


Source

Development version, including everything but the kitchen sink.

@@ -31,4 +31,4 @@

For the development version, use OxJS/dev/Ox.js instead. And to include Ox.UI, start with Ox.load('UI', function() { ... }).


License

-

Dual-licensed, GPL/MIT. 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.

\ No newline at end of file +

Dual-licensed, GPL/MIT. 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.

diff --git a/source/Ox.js b/source/Ox.js index 557b4b71..3af9577e 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -19,7 +19,8 @@ window.Ox = { path = getPath(); loadJSON(function(data) { - loadScripts(data, function() { + loadScripts(data.files, function() { + Ox.VERSION = data.version; if (args.length == 1) { callback() } else { diff --git a/tests/js/tests.js b/tests/js/tests.js index 28970b0d..0474b32c 100644 --- a/tests/js/tests.js +++ b/tests/js/tests.js @@ -1,5 +1,5 @@ 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') .css({ @@ -23,7 +23,7 @@ Ox.load({Geo: {}, Image: {}, UI: {}, Unicode: {}}, function() { setBackground($tests, true); tests( - Ox.flatten(files).sort().map(function(file) { + Ox.flatten(data.files).sort().map(function(file) { return '../dev/' + file; }).concat([ '../dev/Ox.Geo/Ox.Geo.js', diff --git a/tools/build/build.py b/tools/build/build.py index cb0b210c..63183fa2 100755 --- a/tools/build/build.py +++ b/tools/build/build.py @@ -126,7 +126,10 @@ def build_oxjs(downloads=False, geo=False): ox_files[2].append(js_dir + filename) js = re.sub("Ox.VERSION = '([\d\.]+)'", "Ox.VERSION = '%s'" % version, js) 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 js = '' @@ -183,8 +186,7 @@ def build_oxjs(downloads=False, geo=False): lambda x: not re.search('^[\._]', x), os.listdir(root_path + 'readme/html/') ) - ), - 'version': version + ) } write_file(root_path + 'index.json', json.dumps(data, indent=4, sort_keys=True))