From: Alan Knowles Date: Mon, 10 May 2010 03:38:46 +0000 (+0800) Subject: Merge branch 'live' of http://private.akbkhome.com/gnome.introspection-doc-generator... X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=commitdiff_plain;h=75a33e8fbea0b516ddc8dd4e6207cb85a97bd6d3;hp=a884b7db7a6233cfbfc56458bc76525fb48d96e8 Merge branch 'live' of private.akbkhome.com/gnome.introspection-doc-generator into live --- diff --git a/File.js b/File.js index e788e59..a704c9e 100755 --- a/File.js +++ b/File.js @@ -88,6 +88,7 @@ var File = { var can = f.resolve_relative_path(''); return can.get_path(); }, + /** * write * @arg path {String} File to write to @@ -126,37 +127,72 @@ var File = { var f = Gio.file_new_for_path(String(path)); return f['delete'](); }, - // copy files recursively from fromDir, silently ignore them if they already exist in toDir - silentRecursiveCopy : function (fromDir, toDir) { + /** + * silentRecursiveCopy + * copy files recursively from fromDir, silently ignore them if they already exist in toDir + * unless you select overwrite.. + * @arg {String} src source path + * @arg {String} dest destination path + * @arg {Gio.FileCopyFlags} options (optional) - use Gio.FileCopyFlags.OVERWRITE to + * otherwise they will not be copied + * + */ + silentRecursiveCopy : function (fromDir, toDir, opts) { + var filesToCopy = File.recursiveListing(fromDir); var srcPath, destPath, src, dest; - + if (typeof(opts) =='undefined') { + opts = Gio.FileCopyFlags.NONE; + } + for (var index in filesToCopy) { - srcPath = File.join(String(fromDir), filesToCopy[index]); - destPath = File.join(String(toDir), filesToCopy[index]); - - if (File.isFile(srcPath) && !File.isFile(destPath)) { - File.copyFile(srcPath, destPath); - } - else if (File.isDirectory(srcPath) && !File.isDirectory(destPath)) { - File.mkdir(destPath); - } + srcPath = File.join(String(fromDir), filesToCopy[index]); + destPath = File.join(String(toDir), filesToCopy[index]); + if (File.isDirectory(srcPath) && !File.isDirectory(destPath)) { + File.mkdir(destPath); + continue; + } + // source is not file..?!?!? + if (!File.isFile(srcPath)) { + continue; + } + if (File.isFile(destPath) && opts == Gio.FileCopyFlags.NONE) { + // do not overwrite.. - if file exists and we are not flaged to overwrite. + continue; + } + + File.copyFile(srcPath, destPath, opts); + } }, - + + /** + * mkdir + * make a directory.. + * @arg {String} dstPath directory to make + */ mkdir : function (destPath) { var dest = Gio.file_new_for_path(String(destPath)); return dest.make_directory(null, null); }, - - copyFile : function (srcPath, destPath) { + /** + * copyFile + * @arg {String} src source path + * @arg {String} dest destination path + * @arg {Gio.FileCopyFlags} options (optional) - use Gio.FileCopyFlags.OVERWRITE to .. overwrite.. + * + */ + copyFile : function (srcPath, destPath, opts) { + if (typeof(opts) =='undefined') { + opts = Gio.FileCopyFlags.NONE; + } var dest = Gio.file_new_for_path(String(destPath)); var src = Gio.file_new_for_path(String(srcPath)); // a bit of a hack for the fact that Gio.File.copy arguments // can be nulled, but not according to the GIR file - return src.copy(dest, Gio.FileCopyFlags.NONE); + return src.copy(dest, opts); }, recursiveListing : function (dir) { diff --git a/JSDOC/Introspect.js b/JSDOC/Introspect.js index 1e4a4ca..f85d174 100644 --- a/JSDOC/Introspect.js +++ b/JSDOC/Introspect.js @@ -8,7 +8,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + xnew = imports['xnew.js'].xnew; @@ -142,6 +142,16 @@ Object.extend(Introspect, { continue; } } + + + var gi = GI.IRepository.get_default(); + var ver = gi.get_version(ns); + var pth = GI.IRepository.get_search_path (); + var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0'); + //console.log(fn); + ret.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir'; + ret.gir_filename = ns + '-' + ver + '.gir'; + //console.dump(this.ifaceList); return ret; diff --git a/JSDOC/Introspect/Base.js b/JSDOC/Introspect/Base.js index 39cfa76..8a2bd26 100644 --- a/JSDOC/Introspect/Base.js +++ b/JSDOC/Introspect/Base.js @@ -8,7 +8,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; Basic = imports['JSDOC/Introspect/Basic.js'].Basic; @@ -56,6 +56,15 @@ Base = Object.define( this.desc = Introspect.doc(this.alias ); + var gi = GI.IRepository.get_default(); + var ver = gi.get_version(ns); + var pth = GI.IRepository.get_search_path (); + var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0'); + //console.log(fn); + this.gir_file = gir_path + '/'+ ns + '-' + ver + '.gir'; + this.gir_filename = ns + '-' + ver + '.gir'; + + }, Basic, { diff --git a/JSDOC/Introspect/Basic.js b/JSDOC/Introspect/Basic.js index 74b340d..43c723f 100644 --- a/JSDOC/Introspect/Basic.js +++ b/JSDOC/Introspect/Basic.js @@ -7,7 +7,6 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Introspect/Callback.js b/JSDOC/Introspect/Callback.js index 143cf3a..f92f466 100644 --- a/JSDOC/Introspect/Callback.js +++ b/JSDOC/Introspect/Callback.js @@ -7,7 +7,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; Basic = imports['JSDOC/Introspect/Basic.js'].Basic; diff --git a/JSDOC/Introspect/Class.js b/JSDOC/Introspect/Class.js index e134ba7..08a103b 100644 --- a/JSDOC/Introspect/Class.js +++ b/JSDOC/Introspect/Class.js @@ -7,7 +7,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Introspect/Constant.js b/JSDOC/Introspect/Constant.js index f9558b2..bc64386 100644 --- a/JSDOC/Introspect/Constant.js +++ b/JSDOC/Introspect/Constant.js @@ -7,7 +7,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + diff --git a/JSDOC/Introspect/Enum.js b/JSDOC/Introspect/Enum.js index dcdf1a6..379b3ad 100644 --- a/JSDOC/Introspect/Enum.js +++ b/JSDOC/Introspect/Enum.js @@ -8,7 +8,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + diff --git a/JSDOC/Introspect/Field.js b/JSDOC/Introspect/Field.js index ba22947..4eb915c 100644 --- a/JSDOC/Introspect/Field.js +++ b/JSDOC/Introspect/Field.js @@ -7,7 +7,7 @@ xml = imports.libxml; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Introspect/Interface.js b/JSDOC/Introspect/Interface.js index 98727a9..1de6ca1 100644 --- a/JSDOC/Introspect/Interface.js +++ b/JSDOC/Introspect/Interface.js @@ -5,7 +5,7 @@ imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Introspect/Method.js b/JSDOC/Introspect/Method.js index 5c51d6c..b26a4fb 100644 --- a/JSDOC/Introspect/Method.js +++ b/JSDOC/Introspect/Method.js @@ -6,7 +6,7 @@ GI = imports.gi.GIRepository; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; Basic = imports['JSDOC/Introspect/Basic.js'].Basic; diff --git a/JSDOC/Introspect/Property.js b/JSDOC/Introspect/Property.js index e6e92e3..6630106 100644 --- a/JSDOC/Introspect/Property.js +++ b/JSDOC/Introspect/Property.js @@ -5,7 +5,7 @@ GI = imports.gi.GIRepository; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Introspect/Signal.js b/JSDOC/Introspect/Signal.js index 4d4b6b8..66b0994 100644 --- a/JSDOC/Introspect/Signal.js +++ b/JSDOC/Introspect/Signal.js @@ -7,7 +7,7 @@ GI = imports.gi.GIRepository; imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Introspect/Struct.js b/JSDOC/Introspect/Struct.js index 02a4362..a705d0e 100644 --- a/JSDOC/Introspect/Struct.js +++ b/JSDOC/Introspect/Struct.js @@ -6,7 +6,7 @@ imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + diff --git a/JSDOC/Introspect/Union.js b/JSDOC/Introspect/Union.js index c178f87..b965512 100644 --- a/JSDOC/Introspect/Union.js +++ b/JSDOC/Introspect/Union.js @@ -6,7 +6,7 @@ imports['Object.js'].load(Object); console = imports['console.js'].console; -JSDOC = imports['JSDOC.js'].JSDOC; + Introspect = imports['JSDOC/Introspect.js'].Introspect; diff --git a/JSDOC/Template.js b/JSDOC/Template.js index 944d318..4848199 100644 --- a/JSDOC/Template.js +++ b/JSDOC/Template.js @@ -6,7 +6,7 @@ GLib = imports.gi.GLib; imports['Object.js'].load(Object); -JSDOC = imports['JSDOC.js'].JSDOC; + console = imports['console.js'].console; xnew = imports['xnew.js'].xnew; Link = imports['JSDOC/Template/Link.js'].Link; @@ -27,7 +27,7 @@ Template = function(templateFile) { this.parse(); } -xnew.load(Template , 'JSDOC/Template'); + Object.extend(Template.prototype , { diff --git a/JSDOC/Template/Link.js b/JSDOC/Template/Link.js index 4d45a5e..a550e49 100644 --- a/JSDOC/Template/Link.js +++ b/JSDOC/Template/Link.js @@ -1,5 +1,4 @@ //