Permalink
Browse files

Merge branch 'capp-man' of https://github.com/aparajita/cappuccino in…

…to aparajita-capp-man
  • Loading branch information...
2 parents 6115ace + c9fb862 commit ab105e7273207229db3d195f5598c7e38520ca51 Klaas Pieter Annema committed Apr 5, 2011
Showing with 184 additions and 2 deletions.
  1. +8 −2 Tools/capp/Jakefile
  2. +131 −0 Tools/capp/capp.1
  3. +45 −0 common.jake
View
@@ -1,8 +1,12 @@
require ("../../common.jake");
-var app = require("objective-j/jake").app;
-var BundleTask = require("objective-j/jake").BundleTask;
+var app = require("objective-j/jake").app,
+ BundleTask = require("objective-j/jake").BundleTask,
+ fileCreate = require("jake").fileCreate,
+ FILE = require("file"),
+ OS = require("os"),
+ stream = require("narwhal/term").stream;
app ("capp", function(cappTask)
{
@@ -36,6 +40,8 @@ filedir($BUILD_CJS_CAPP, ["capp"], function()
make_objj_executable($BUILD_CJS_CAPP);
});
+copyManPage("capp", 1);
+
task ("build", ["capp", $BUILD_CJS_CAPP]);
CLOBBER.include($BUILD_CJS_CAPPUCCINO_BIN);
View
@@ -0,0 +1,131 @@
+.Dd March 30, 2011
+.Os "Cappuccino"
+.Dt CAPP 1 "PRM"
+.\"-----------------------------------------------------------------------------------------
+.Sh NAME
+.\"-----------------------------------------------------------------------------------------
+.Nm capp
+.Nd generate cappuccino projects
+.\"-----------------------------------------------------------------------------------------
+.Sh SYNOPSIS
+.\"-----------------------------------------------------------------------------------------
+.Nm
+.Sy gen
+.Op options
+.Pa path
+.Nm
+.Cm gen
+.Op --list-templates | --list-frameworks
+.Nm
+.Cm config
+.Op options
+.Nm
+.Op --version | -h | --help
+.\"-----------------------------------------------------------------------------------------
+.Sh "DESCRIPTION"
+.\"-----------------------------------------------------------------------------------------
+.Nm
+generates starter projects for cappuccino, ensuring that all of the necessary files
+are present, and applying the values in your
+.Ar configuration
+to placeholders the template.
+.\"-----------------------------------------------------------------------------------------
+.Sh "GENERATING PROJECTS"
+.\"-----------------------------------------------------------------------------------------
+When invoked using
+.Nm
+.Cm gen ,
+you either create a new project or modify the frameworks of an existing project.
+.Ss Create options
+When creating a new project, if no options are specified,
+.Nm
+will use the
+.Ar Application
+template, which by default does not use a
+.Ar cib
+to create its interface. If you wish to use a different template, the following options are available:
+.Bl -tag -width 4n
+.It Fl t, \-template Ar template
+Specifies the template name to use when generating the project. This determines the type
+of project to generate.
+.It Fl \-list-templates
+Displays the templates names available for use with the
+.Sy -t/--template
+option.
+.El
+.Ss Frameworks options
+There are a number of options available for specifying how to create or update
+the Frameworks directory in your project. The available options are:
+.Bl -tag -width 4n
+.It Fl f, \-frameworks
+This will copy or symlink
+.Sy only
+the Frameworks directory instead of generating an entire project. This is
+especially useful if you want to update the Frameworks for an existing project.
+.It Fl F, \-framework Ar name
+The
+.Sy -f/--frameworks
+option always copies/symlinks the Objective-J, Foundation, and AppKit frameworks. You may
+include additional frameworks with this option. You may use this option multiple times
+to include multiple frameworks.
+.It Fl \-list-frameworks
+Displays a list of frameworks that are available for use with the
+.Sy -F/--framework
+option.
+.It Fl \-symlink
+By default frameworks are copied to the project directory. Use this option to symlink
+to the source frameworks instead of copying.
+.It Fl \-build
+By default frameworks are copied/symlinked from the installed version created with
+.Sy jake install.
+Use this option to copy/symlink the version created in
+.Ar $CAPP_BUILD
+with
+.Sy jake debug
+or
+.Sy jake release.
+.It Fl l
+This is a handy shortcut for
+.Sy --symlink --build.
+.El
+.\"-----------------------------------------------------------------------------------------
+.Sh CONFIGURING
+.\"-----------------------------------------------------------------------------------------
+When invoked using
+.Nm
+.Cm config ,
+you can set or inspect the values used to replace placeholder text in the templates. The syntax
+for
+.Cm capp config
+is as follows:
+.Bl -tag -width 4n
+.It Ar key value
+Creates or updates a configuration item with the given key and value.
+.It Fl \-get Ar key
+Displays the configuration value with the given key. If no item with the given key exists,
+nothing happens.
+.It Fl \-remove Ar key
+Removes the configuration value with the given key. If no item with the given key exists,
+nothing happens.
+.It Fl -l, \-list
+Displays a list of all configuration items in the form
+.Sy key=value.
+.El
+.\"-----------------------------------------------------------------------------------------
+.Sh GENERAL OPTIONS
+.\"-----------------------------------------------------------------------------------------
+.Bl -tag -width 4n
+.It Fl \-version
+Displays the current
+.Nm
+version and exits.
+.It Fl h, \-help
+Displays a concise list of the available commands and options.
+.El
+.\"-----------------------------------------------------------------------------------------
+.Sh FILES
+.\"-----------------------------------------------------------------------------------------
+.Bl -hang -width 4n
+.It Em ~/.cappconfig
+Contains your configuration in 280north plist format.
+.El
View
@@ -412,6 +412,51 @@ global.sudo = function(/*String*/ aTaskName)
OS.exit(1); //rake abort if ($? != 0)
}
+global.copyManPage = function(/*String*/ name, /*int*/ section)
+{
+ var manDir = "/usr/local/share/man/man" + section,
+ pageFile = name + "." + section,
+ manPagePath = FILE.join(manDir, pageFile);
+
+ if (!FILE.exists(manPagePath) || FILE.mtime(pageFile) > FILE.mtime(manPagePath))
+ {
+ var sudo = ["sudo", "-p", "\nEnter your admin password: "],
+ useSudo = false,
+ success = true,
+ cmd;
+
+ if (!FILE.isDirectory(manDir))
+ {
+ cmd = ["mkdir", "-p", "-m", "0755", manDir];
+
+ if (FILE.isWritable(FILE.dirname(manDir)))
+ success = OS.system(cmd) === 0;
+ else
+ {
+ useSudo = true;
+ success = OS.system(sudo.concat(cmd)) === 0;
+ }
+
+ if (!success)
+ {
+ stream.print("\0red(Unable to create the man directory.\0)");
+ OS.exit(1);
+ }
+ }
+
+ cmd = ["cp", "-f", pageFile, manDir];
+
+ if (FILE.isWritable(manDir))
+ success = OS.system(cmd) === 0;
+ else
+ success = OS.system(sudo.concat(cmd)) === 0;
+
+ if (!success)
+ stream.print("\0red(Unable to copy the man file.\0)");
+ }
+}
+
+
// built in tasks
task ("build");

0 comments on commit ab105e7

Please sign in to comment.