Browse Source

packageHome is honoured in commit paths from IDE.

Herbert Vojčík 12 years ago
parent
commit
aab99b2bc4
4 changed files with 118 additions and 3 deletions
  1. 40 0
      js/Kernel-Objects.deploy.js
  2. 50 0
      js/Kernel-Objects.js
  3. 13 3
      js/amber.js
  4. 15 0
      st/Kernel-Objects.st

+ 40 - 0
js/Kernel-Objects.deploy.js

@@ -2475,6 +2475,34 @@ smalltalk.Package);
 
 
 smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
+smalltalk.addMethod(
+"_commitPathsFromLoader",
+smalltalk.method({
+selector: "commitPathsFromLoader",
+fn: function (){
+var self=this;
+var $1,$2;
+var js;
+var st;
+var cp = smalltalk['@@commitPath'];
+        if (cp) { js = cp.js; st = cp.st; };
+;
+$1=js;
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+smalltalk.send(self,"_defaultCommitPathJs_",[js]);
+};
+$2=st;
+if(($receiver = $2) == nil || $receiver == undefined){
+$2;
+} else {
+smalltalk.send(self,"_defaultCommitPathSt_",[st]);
+};
+return self}
+}),
+smalltalk.Package.klass);
+
 smalltalk.addMethod(
 "_commitToLocalStorage_",
 smalltalk.method({
@@ -2592,6 +2620,18 @@ fn: function (aPackageName) {
 }),
 smalltalk.Package.klass);
 
+smalltalk.addMethod(
+"_initialize",
+smalltalk.method({
+selector: "initialize",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_initialize",[],smalltalk.Object.klass);
+smalltalk.send(self,"_commitPathsFromLoader",[]);
+return self}
+}),
+smalltalk.Package.klass);
+
 smalltalk.addMethod(
 "_named_",
 smalltalk.method({

+ 50 - 0
js/Kernel-Objects.js

@@ -3421,6 +3421,39 @@ smalltalk.Package);
 
 
 smalltalk.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
+smalltalk.addMethod(
+"_commitPathsFromLoader",
+smalltalk.method({
+selector: "commitPathsFromLoader",
+category: 'commit paths',
+fn: function (){
+var self=this;
+var $1,$2;
+var js;
+var st;
+var cp = smalltalk['@@commitPath'];
+        if (cp) { js = cp.js; st = cp.st; };
+;
+$1=js;
+if(($receiver = $1) == nil || $receiver == undefined){
+$1;
+} else {
+smalltalk.send(self,"_defaultCommitPathJs_",[js]);
+};
+$2=st;
+if(($receiver = $2) == nil || $receiver == undefined){
+$2;
+} else {
+smalltalk.send(self,"_defaultCommitPathSt_",[st]);
+};
+return self},
+args: [],
+source: "commitPathsFromLoader\x0a\x09| js st |\x0a    <var cp = smalltalk['@@commitPath'];\x0a        if (cp) { js = cp.js; st = cp.st; }>.\x0a    js ifNotNil: [ self defaultCommitPathJs: js ].\x0a    st ifNotNil: [ self defaultCommitPathSt: st ].",
+messageSends: ["ifNotNil:", "defaultCommitPathJs:", "defaultCommitPathSt:"],
+referencedClasses: []
+}),
+smalltalk.Package.klass);
+
 smalltalk.addMethod(
 "_commitToLocalStorage_",
 smalltalk.method({
@@ -3578,6 +3611,23 @@ referencedClasses: []
 }),
 smalltalk.Package.klass);
 
+smalltalk.addMethod(
+"_initialize",
+smalltalk.method({
+selector: "initialize",
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send(self,"_initialize",[],smalltalk.Object.klass);
+smalltalk.send(self,"_commitPathsFromLoader",[]);
+return self},
+args: [],
+source: "initialize\x0a\x09super initialize.\x0a    self commitPathsFromLoader",
+messageSends: ["initialize", "commitPathsFromLoader"],
+referencedClasses: []
+}),
+smalltalk.Package.klass);
+
 smalltalk.addMethod(
 "_named_",
 smalltalk.method({

+ 13 - 3
js/amber.js

@@ -102,13 +102,14 @@ amber = (function() {
 		}
 
 		var additionalFiles = spec.packages || spec.files;
+        var commitPathForInit = null;
 		if (additionalFiles) {
-			loadPackages(additionalFiles, spec.prefix, spec.packageHome);
+			commitPathForInit = loadPackages(additionalFiles, spec.prefix, spec.packageHome);
 		}
 
 		// Be sure to setup & initialize smalltalk classes
 		addJSToLoad('init.js');
-		initializeSmalltalk();
+		initializeSmalltalk(commitPathForInit);
 	};
 
 	function loadPackages(names, prefix, urlHome){
@@ -120,6 +121,11 @@ amber = (function() {
 			name = names[i].split(/\.js$/)[0];
 			addJSToLoad(name + '.js', prefix, urlHome);
 		}
+
+        return  {
+            js: urlHome+prefix,
+            st: urlHome+'st'
+        };
 	};
 
 	function addJSToLoad(name, prefix, urlHome) {
@@ -174,8 +180,12 @@ amber = (function() {
 	};
 
 	// This will be called after JS files have been loaded
-	function initializeSmalltalk() {
+	function initializeSmalltalk(commitPath) {
 		window.smalltalkReady = function() {
+            if (commitPath) {
+                smalltalk['@@commitPath'] = commitPath;
+                smalltalk.Package._commitPathsFromLoader();
+            }
 			if (spec.ready) {
 				spec.ready();
 			};

+ 15 - 0
st/Kernel-Objects.st

@@ -1136,6 +1136,14 @@ Package class instanceVariableNames: 'defaultCommitPathJs defaultCommitPathSt'!
 
 !Package class methodsFor: 'commit paths'!
 
+commitPathsFromLoader
+	| js st |
+    <var cp = smalltalk['@@commitPath'];
+        if (cp) { js = cp.js; st = cp.st; }>.
+    js ifNotNil: [ self defaultCommitPathJs: js ].
+    st ifNotNil: [ self defaultCommitPathSt: st ].
+!
+
 defaultCommitPathJs
 	^ defaultCommitPathJs ifNil: [ defaultCommitPathJs := 'js']
 !
@@ -1157,6 +1165,13 @@ resetCommitPaths
         defaultCommitPathSt := nil.
 ! !
 
+!Package class methodsFor: 'initialization'!
+
+initialize
+	super initialize.
+    self commitPathsFromLoader
+! !
+
 !Package class methodsFor: 'loading-storing'!
 
 commitToLocalStorage: aPackageName