Browse files

autopublishing via sourcemint

  • Loading branch information...
1 parent eeaeb8c commit 85d3189efdbf19f2623fdf0cfcf71decf86764b1 @cadorn cadorn committed Sep 7, 2011
View
5 .gitignore
@@ -1,3 +1,4 @@
-.build/
-build/
+/build/firephp-*
+/build/phar
.profile-firefox/
+.build/
View
BIN build/lib.phar
Binary file not shown.
View
BIN build/lib.zip
Binary file not shown.
View
23 package.json
@@ -35,5 +35,26 @@
{
"id": "github.com/firephp/firephp-core/"
}
- ]
+ ],
+ "implements": {
+ "github.com/pinf/core-js/-meta/strawman/bundles/0.1": {
+ "lib.zip": {
+ "locator": {
+ "location": "./build/lib.zip"
+ },
+ "scope": "lib",
+ "label": "ZIP Archive",
+ "contentType": "application/zip"
+ },
+ "lib.phar": {
+ "locator": {
+ "location": "./build/lib.phar"
+ },
+ "scope": "lib",
+ "label": "PHAR Archive",
+ "contentType": "application/zip",
+ "suffix": ".phar"
+ }
+ }
+ }
}
View
4 workspace/README.md
@@ -58,10 +58,8 @@ Publishing
git tag v...
- commonjs -v --script build .
+ commonjs --script build .
- commonjs -v --script publish .
-
TODO: Auto-upload to PEAR channel server at http://pear.firephp.org/
NOTE: For PEAR RC releases: Change release stability to "beta" and capitalize "RC" in release version in package.xml
View
4 workspace/package.json
@@ -13,9 +13,9 @@
"location": "./",
"module": "/scripts/build.js"
},
- "publish": {
+ "test": {
"location": "./",
- "module": "/scripts/publish.js"
+ "module": "/scripts/test.js"
}
},
"dependencies": [
View
20 workspace/scripts/build.js
@@ -11,6 +11,11 @@ var pkgPath = FILE.dirname(FILE.dirname(FILE.dirname(module.id))),
tplPath = pkgPath + "/workspace/tpl",
version = false;
+exports.getPackagePath = function()
+{
+ return pkgPath;
+}
+
exports.getBuildPath = function()
{
return buildPath;
@@ -48,7 +53,7 @@ exports.main = function()
function buildZipArchive(callback)
{
- var targetBasePath = buildPath + "/FirePHP-" + version;
+ var targetBasePath = buildPath + "/firephp-" + version;
FILE.mkdirs(targetBasePath, 0775);
@@ -70,16 +75,12 @@ function buildZipArchive(callback)
var content = FILE.read(tplPath + "/license.tpl.md");
FILE.write(targetBasePath + "/LICENSE.md", content);
- FILE.write(buildPath + "/info.json", JSON.encode({
- version: version
- }));
-
next2();
}
function next2()
{
- SYSTEM.exec("cd " + buildPath + " ; zip -vr FirePHP-" + version + ".zip FirePHP-" + version, function(stdout)
+ SYSTEM.exec("cd " + buildPath + " ; zip -vr lib.zip firephp-" + version, function(stdout)
{
console.log(stdout);
@@ -91,7 +92,7 @@ function buildZipArchive(callback)
function buildPharArchive(callback)
{
var targetBasePath = buildPath + "/phar",
- pharName = "FirePHP";
+ pharName = "firephp";
FILE.mkdirs(targetBasePath, 0775);
@@ -129,7 +130,10 @@ function buildPharArchive(callback)
console.log(stderr);
- callback();
+ SYSTEM.exec("mv " + targetBasePath + "/" + pharName + "-" + version + ".phar " + buildPath + "/lib.phar", function(stdout, stderr)
+ {
+ callback();
+ });
});
}
}
View
71 workspace/scripts/publish.js
@@ -1,71 +0,0 @@
-
-var PINF_LOADER = require("pinf/loader"),
- SANDBOX = PINF_LOADER.getSandbox(),
- FILE = require("modules/file"),
- Q = require("modules/q"),
- SYSTEM = require("modules/system"),
- BUILD = require("./build"),
- JSON = require("modules/json"),
- SOURCEMINT_CLIENT = false;
-
-exports.main = function()
-{
- module.load({
- id: "private-registry.appspot.com/cadorn.com/github/com.cadorn.baby/projects/sourcemint/packages/client-js/",
- descriptor: {
- main: "lib/client.js"
- }
- }, function(id)
- {
- SOURCEMINT_CLIENT = require(id);
-
- publish();
- });
-}
-
-function publish()
-{
- var buildPath = BUILD.getBuildPath(),
- info = JSON.decode(FILE.read(buildPath + "/info.json")),
- descriptor = JSON.decode(FILE.read(FILE.dirname(FILE.dirname(FILE.dirname(module.id))) + "/package.json"));
-
- var bundles = {};
- bundles["firephp.zip"] = {
- "type": "zip",
- "options": {
- "archivePath": buildPath + "/FirePHP-" + info.version + ".zip",
- }
- };
- bundles["firephp.phar"] = {
- "type": "phar",
- "options": {
- "archivePath": buildPath + "/phar/FirePHP-" + info.version + ".phar",
- }
- };
-
- var packages = [
- {
- "uid": descriptor.uid,
- "stream": "stable",
- "version": info.version,
- "bundles": bundles
- }
- ];
-
- try
- {
- Q.when(SOURCEMINT_CLIENT.publish(packages), function(info)
- {
- module.print("\0green(Published:\n");
- console.log(info);
- module.print("\0)");
- }, function(e)
- {
- throw e;
- });
- }
- catch(e)
- {
- console.error("Error: " + e);
- }
-}

0 comments on commit 85d3189

Please sign in to comment.