mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-03 15:46:16 +00:00
Remove bake.
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'rake'
|
||||
require '../../common'
|
||||
require 'objective-j'
|
||||
require 'objective-j/bundletask'
|
||||
|
||||
|
||||
$PRODUCT = :bake
|
||||
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'bake')
|
||||
$ENVIRONMENT_BIN_PRODUCT = File.join($ENVIRONMENT_BIN_DIR, 'bake')
|
||||
$ENVIRONMENT_LIB_PRODUCT = File.join($ENVIRONMENT_LIB_DIR, 'bake')
|
||||
|
||||
# Debug Framework
|
||||
ObjectiveJ::BundleTask.new(:bake) do |t|
|
||||
t.name = 'bake'
|
||||
t.identifier = 'com.280n.bake'
|
||||
t.version = '0.7.1'
|
||||
t.author = '280 North, Inc.'
|
||||
t.email = 'feedback @nospam@ 280north.com'
|
||||
t.summary = 'Deployment tool for Cappuccino applications'
|
||||
t.sources = FileList['*.j']
|
||||
t.resources = FileList['Resources/*']
|
||||
t.license = ObjectiveJ::License::LGPL_v2_1
|
||||
t.build_path = $BUILD_PATH
|
||||
t.flag = '-DDEBUG' if $CONFIGURATION == 'Debug'
|
||||
t.flag = '-O' if $CONFIGURATION == 'Release'
|
||||
end
|
||||
|
||||
#executable in environment directory
|
||||
file_d $ENVIRONMENT_BIN_PRODUCT do
|
||||
make_objj_executable($ENVIRONMENT_BIN_PRODUCT)
|
||||
end
|
||||
|
||||
file_d $ENVIRONMENT_LIB_PRODUCT => [:bake] do
|
||||
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_LIB_PRODUCT)
|
||||
end
|
||||
|
||||
task :build => [:bake, $ENVIRONMENT_BIN_PRODUCT, $ENVIRONMENT_LIB_PRODUCT]
|
||||
|
||||
CLOBBER.include($ENVIRONMENT_BIN_PRODUCT, $ENVIRONMENT_LIB_PRODUCT)
|
||||
@@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
|
||||
<!--
|
||||
//
|
||||
// index.html
|
||||
//
|
||||
// $APPLICATION_NAME
|
||||
//
|
||||
// Copyright 2005 - 2008, 280 North, Inc. All rights reserved.
|
||||
//
|
||||
-->
|
||||
<head>
|
||||
|
||||
<title>$APPLICATION_NAME</title>
|
||||
|
||||
<script type = "text/javascript" charset = "utf-8" >
|
||||
|
||||
//create a new timestamp to monitor launch time
|
||||
_LAUNCH_TIME = new Date();
|
||||
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
|
||||
window.files_total = $FILES_TOTAL;
|
||||
|
||||
window.update_progress = function(percent)
|
||||
{
|
||||
var value = Math.max(Math.min(Math.round(percent*100), 100), 0);
|
||||
var progress = document.getElementById("progress");
|
||||
if (progress)
|
||||
progress.style.width = value + "%";
|
||||
window.title = "Loading $APPLICATION_NAME... " + value + "%";
|
||||
}
|
||||
|
||||
var path = document.location.href;
|
||||
|
||||
path = path.substr(0, path.lastIndexOf('/') + 1);
|
||||
|
||||
document.write("<base href=\"" + path + "$VERSION/" + "\"><!--[if IE]><"+"/base><![endif]-->");
|
||||
|
||||
</script>
|
||||
|
||||
<script src = "Frameworks/Objective-J/Objective-J.js" type = "text/javascript" charset = "utf-8"></script>
|
||||
|
||||
</head>
|
||||
<body style="background-color: $BACKGROUND_COLOR;">
|
||||
<div style="position: absolute; top: 50%; left: 50%; min-height: 100px; width: 250px; margin-top: -50px; margin-left: -125px; padding: 10px; background-color: white; text-align: center; -moz-border-radius: 5px; -webkit-border-radius: 5px;">
|
||||
<img src="Resources/spinner.gif" />
|
||||
<div style="height: 3px; width: 100%; left: 0px; top: 0px; background-color: lightgrey; overflow: hidden;">
|
||||
<div id="progress" style="height: 100%; width: 0%; left: 0px; top: 0px; background-color: black; margin-right: auto;"></div>
|
||||
</div>
|
||||
<h3 style="font-size: 18px; font-family: 'Lucida Grande', Lucida, Verdana, Helvetica, Arial, sans-serif; color: $TEXT_COLOR;">Loading $APPLICATION_NAME...</h3>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"path" : "git://github.com/280north/cappuccino.git",
|
||||
"parts" : [
|
||||
{
|
||||
"src" : "Objective-J",
|
||||
"dst" : "Frameworks/Objective-J",
|
||||
"build" : "ant -DBuild=BUILD_PATH",
|
||||
"copyFrom" : "Release/Objective-J"
|
||||
},
|
||||
{
|
||||
"src" : "Foundation",
|
||||
"dst" : "Frameworks/Foundation",
|
||||
"build" : "steam build -c Release -b BUILD_PATH",
|
||||
"copyFrom" : "Release/Foundation"
|
||||
},
|
||||
{
|
||||
"src" : "AppKit",
|
||||
"dst" : "Frameworks/AppKit",
|
||||
"build" : "steam build -c Release -b BUILD_PATH",
|
||||
"copyFrom" : "Release/AppKit"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type" : "rsync",
|
||||
"path" : "/Users/username/projects/NewApplication",
|
||||
"parts" : [
|
||||
{
|
||||
"src" : "",
|
||||
"dst" : "Blah"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type" : "svn",
|
||||
"path" : "https://svn.youserver.com/Project/trunk",
|
||||
"parts" : [
|
||||
{
|
||||
"src" : "subdirectory",
|
||||
"dst" : "Something"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"deployments" : [
|
||||
{ "host" : "deploy@myserver.com", "path" : "/var/www/mysite/public" }
|
||||
],
|
||||
"templateVars" : {
|
||||
"APPLICATION_NAME" : "My Application",
|
||||
"BACKGROUND_COLOR" : "black",
|
||||
"TEXT_COLOR" : "black"
|
||||
}
|
||||
}
|
||||
@@ -1,299 +0,0 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
importPackage(Packages.java.io);
|
||||
|
||||
var options = {
|
||||
base : "trunk",
|
||||
clean : false,
|
||||
deploy : false,
|
||||
deployHost : null,
|
||||
deployPath : null,
|
||||
skipUpdate : false,
|
||||
tag : false,
|
||||
archive : false,
|
||||
message : null,
|
||||
templatePath : OBJJ_HOME + "/lib/bake/Resources/bake_template.html"
|
||||
}
|
||||
|
||||
var targetPath,
|
||||
checkoutsPath,
|
||||
buildsPath,
|
||||
productsPath,
|
||||
version = ROUND(new Date().getTime() / 1000);
|
||||
|
||||
CPLogRegister(CPLogPrint);
|
||||
|
||||
function readConfig(configFile)
|
||||
{
|
||||
var fileData = String(readFile(configFile));
|
||||
if (!fileData)
|
||||
throw new Error("Couldn't read file: " + configFile);
|
||||
|
||||
var configs = JSON.parse(fileData);
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
function update()
|
||||
{
|
||||
for (var i = 0; i < options.sources.length; i++)
|
||||
{
|
||||
var source = options.sources[i];
|
||||
|
||||
source.localSourcePath = checkoutsPath + "/" + source.path.replace(/\W+/g, "_");
|
||||
|
||||
switch (source.type)
|
||||
{
|
||||
case "git":
|
||||
if (new File(source.localSourcePath).isDirectory())
|
||||
{
|
||||
CPLog.debug("git pull (" + source.localSourcePath + ")");
|
||||
exec("git pull", null, new File(source.localSourcePath));
|
||||
}
|
||||
else
|
||||
{
|
||||
CPLog.debug("git clone (" + source.path + ")");
|
||||
exec(["git", "clone", source.path, source.localSourcePath]);
|
||||
}
|
||||
break;
|
||||
case "svn":
|
||||
if (new File(source.localSourcePath).isDirectory())
|
||||
{
|
||||
CPLog.debug("svn up (" + source.localSourcePath + ")");
|
||||
exec("svn up", null, new File(source.localSourcePath));
|
||||
}
|
||||
else
|
||||
{
|
||||
CPLog.debug("svn co (" + source.path + ")");
|
||||
exec(["svn", "co", source.path, source.localSourcePath]);
|
||||
}
|
||||
break;
|
||||
case "rsync":
|
||||
CPLog.debug("rsync (" + source.localSourcePath + ")");
|
||||
exec(["rsync", "-avz", source.path + "/", source.localSourcePath]);
|
||||
break;
|
||||
default :
|
||||
CPLog.error("Unimplemented: " + source.type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function build()
|
||||
{
|
||||
var versionedPath = productsPath + "/" + version + "/" + version;
|
||||
|
||||
for (var i = 0; i < options.sources.length; i++)
|
||||
{
|
||||
var source = options.sources[i];
|
||||
|
||||
for (var j = 0; j < source.parts.length; j++)
|
||||
{
|
||||
var part = source.parts[j];
|
||||
var fromPath = source.localSourcePath + "/" + part.src;
|
||||
var toPath = versionedPath + "/" + part.dst;
|
||||
|
||||
if (part.build)
|
||||
{
|
||||
var buildCommand = part.build.replace("$BUILD_PATH", buildsPath);
|
||||
CPLog.debug("Building: " + buildCommand);
|
||||
|
||||
exec(buildCommand, null, new File(fromPath));
|
||||
|
||||
fromPath = buildsPath + "/" + part.copyFrom;
|
||||
}
|
||||
|
||||
mkdirs(toPath);
|
||||
|
||||
var rsyncCommand = "rsync -aC " + fromPath + "/. " + toPath;
|
||||
CPLog.debug("Rsyncing: " + rsyncCommand);
|
||||
exec(rsyncCommand);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.press)
|
||||
{
|
||||
var tempPath = versionedPath+"-Stripped";
|
||||
|
||||
var pressCommand = ["press", versionedPath, tempPath];
|
||||
if (options.png)
|
||||
pressCommand.push("--png");
|
||||
|
||||
var result = exec(pressCommand);
|
||||
if (result.code)
|
||||
throw new Error("press failed");
|
||||
|
||||
exec(["rm", "-rf", versionedPath]);
|
||||
exec(["mv", tempPath, versionedPath]);
|
||||
}
|
||||
|
||||
var results = exec(["bash", "-c", "find "+versionedPath+" \\( -name \"*.sj\" -or -name \"*.j\" \\) -exec cat {} \\; | wc -c | tr -d \" \""]);
|
||||
|
||||
var filesTotal = parseInt(results.stdout);
|
||||
if (isNaN(filesTotal))
|
||||
filesTotal = 0;
|
||||
|
||||
CPLog.debug("FILES_TOTAL=["+filesTotal+"]");
|
||||
|
||||
var substitutions = options.templateVars;
|
||||
substitutions.VERSION = version;
|
||||
substitutions.FILES_TOTAL = filesTotal;
|
||||
|
||||
var template = readFile(options.templatePath);
|
||||
if (!template)
|
||||
throw new Error("Couldn't get template");
|
||||
|
||||
for (var variable in substitutions)
|
||||
template = template.replace(new RegExp("\\$" + variable, "g"), substitutions[variable]);
|
||||
|
||||
templateBytes = new java.lang.String(template).getBytes();
|
||||
templateOutput = new FileOutputStream(productsPath + "/" + version + "/index.html");
|
||||
templateOutput.write(templateBytes, 0, templateBytes.length);
|
||||
templateOutput.close();
|
||||
|
||||
exec(["tar", "czf", version+".tar.gz", version], null, new File(productsPath));
|
||||
}
|
||||
|
||||
function deploy()
|
||||
{
|
||||
for (var i = 0; i < options.deployments.length; i++)
|
||||
{
|
||||
var dep = options.deployments[i];
|
||||
|
||||
exec(["scp", productsPath + "/" + version + ".tar.gz", dep.host + ":~/" + version + ".tar.gz"]);
|
||||
exec(["ssh", dep.host,
|
||||
"tar xzf " + version + ".tar.gz; " +
|
||||
"mkdir -p " + dep.path + "; " +
|
||||
"mv " + version + "/" + version + "/ " + dep.path + "/" + version + "; " +
|
||||
"mv " + version + "/index.html " + dep.path + "/index.html; " +
|
||||
"rm " + version + ".tar.gz; " +
|
||||
"rmdir " + version + "; " +
|
||||
"cd " + dep.path + "; " +
|
||||
"ln -nsf " + version + " Current"]);
|
||||
}
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
var bakefile = "bakefile",
|
||||
commandOpts = {};
|
||||
|
||||
while (args.length)
|
||||
{
|
||||
var arg = args.shift();
|
||||
switch (arg)
|
||||
{
|
||||
case "--base":
|
||||
commandOpts.base = args.shift();
|
||||
break;
|
||||
case "--tag":
|
||||
commandOpts.tag = true;
|
||||
break;
|
||||
case "--archive":
|
||||
commandOpts.archive = true;
|
||||
break;
|
||||
case "--clean":
|
||||
commandOpts.clean = true;
|
||||
break;
|
||||
case "--deploy":
|
||||
commandOpts.deploy = true;
|
||||
break;
|
||||
case "--press":
|
||||
commandOpts.press = true;
|
||||
break;
|
||||
case "--png":
|
||||
commandOpts.png = true;
|
||||
break;
|
||||
case "--host":
|
||||
commandOpts.deployHost = args.shift();
|
||||
break;
|
||||
case "--path":
|
||||
commandOpts.deployPath = args.shift();
|
||||
break;
|
||||
case "--skip-update":
|
||||
commandOpts.skipUpdate = true
|
||||
break;
|
||||
case "--message":
|
||||
commandOpts.message = args.shift();
|
||||
break;
|
||||
default:
|
||||
bakefile = arg;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var configOpts = readConfig(bakefile);
|
||||
|
||||
for (var i in configOpts) options[i] = configOpts[i];
|
||||
for (var i in commandOpts) options[i] = commandOpts[i];
|
||||
|
||||
targetPath = pwd() + "/" + bakefile.match(/^[^\.]+/)[0] + ".oven";
|
||||
mkdirs(targetPath);
|
||||
|
||||
checkoutsPath = targetPath + "/Checkouts"
|
||||
mkdirs(checkoutsPath);
|
||||
|
||||
buildsPath = targetPath + "/Build"
|
||||
mkdirs(buildsPath);
|
||||
|
||||
productsPath = targetPath + "/Products"
|
||||
mkdirs(productsPath);
|
||||
|
||||
if (!options.skipUpdate)
|
||||
{
|
||||
CPLog.info("Updating");
|
||||
update();
|
||||
}
|
||||
|
||||
CPLog.info("Building");
|
||||
build();
|
||||
|
||||
if (options.deploy)
|
||||
{
|
||||
CPLog.info("Deploying");
|
||||
deploy();
|
||||
}
|
||||
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
CPLog.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
function exec()
|
||||
{
|
||||
var runtime = Packages.java.lang.Runtime.getRuntime()
|
||||
var p = runtime.exec.apply(runtime, arguments);
|
||||
|
||||
var stdout = "";
|
||||
var reader = new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(p.getInputStream()));
|
||||
while (s = reader.readLine())
|
||||
{
|
||||
stdout += s;
|
||||
CPLog.info("exec: " + s);
|
||||
}
|
||||
|
||||
var stderr = "";
|
||||
var reader = new Packages.java.io.BufferedReader(new Packages.java.io.InputStreamReader(p.getErrorStream()));
|
||||
while (s = reader.readLine())
|
||||
{
|
||||
stdout += s;
|
||||
CPLog.warn("exec: " + s);
|
||||
}
|
||||
|
||||
var code = p.waitFor();
|
||||
|
||||
return { code : code, stdout : stdout, stderr : stderr };
|
||||
}
|
||||
|
||||
function pwd()
|
||||
{
|
||||
return String(new File("").getAbsolutePath());
|
||||
}
|
||||
|
||||
function mkdirs(path)
|
||||
{
|
||||
return new File(path).mkdirs();
|
||||
}
|
||||
Reference in New Issue
Block a user