快速开始

https://github.com/threerings/getdown/wiki/Quick-Start

————————————————————————————————————————————————————————

Getdown的快速介绍

在这里,我们将带您浏览一遍Getdown项目的基本结构,建立并使用它所需要的步骤。

元文件

Getdown项目使用两个元文件:getdown.txt和digest.txt,getdown.txt需要你自己创建(稍后我们再解释),digest.txt使用工具根据项目内容创建。

getdown.txt

getdown.txt文件包含Getdown部署和更新你的应用所需要的所有信息。下面是一个非常基本的getdown.txt文件,完整的配置项可参考这份文件

# The URL from which the client is downloaded
appbase = http://myapplication.com/myapp/

# UI Configuration
ui.name = My Application

# Application jar files
code = application.jar

# The main entry point for the application
class = myapplication.MyApplication

appbase是你的客户端下载的URL地址。

getdown.txt文件中的所有文件名都要相对于这个URL地址。例如如上配置,下面的文件会被下载

digest.txt

digest.txt通过在你的Getdown项目目录上运行com.threerings.getdown.tools.Digester创建。首先从Maven Center下载getdown-X.Y.jar。

现在,假设你有一个如下的目录结构:

myapp/getdown.txt
myapp/application.jar

执行以下命令产生digest.txt文件

% java -classpath getdown-X.Y.jar com.threerings.getdown.tools.Digester myapp

这里myapp是包含你的客户端文件的myapp目录的路径。执行后将生成如下报告:

Generating digest file 'myapp/digest.txt'...

然后你将在myapp目录(该目录包含你的客户端文件)看到digest.txt文件。

在build integration页面可以找到生成digest.txt的指令。

Hosting

myapp目录现在包含了使用Getdown的所有信息。你需要将你的myapp目录的内容放到web服务器上,以便 它可以被下载(通过getdown.txt中描述的http://myapplication.com/myapp/的URL地址),web服务器不需要支持任何特殊的特性,它只需要普通的HTTP。

Testing

为测试你的应用是否工作,

首先从Maven Central下载getdown-X.Y.jar,创建一个如下的临时安装目录(拷贝getdown-X.Y.jargetdown.jar

myapp/getdown.jar
myapp/getdown.txt

getdown.txt文件只需要包含一行

appbase = http://myapplication.com/myapp/

最后为每个平台创建一个安装包以及适合该平台的启动器(或者以applet启动Getdown),但是现在,我们从命令行手动启动Getdown。

按上述目录结构设置好后,执行以下命令行命令

% java -jar myapp/getdown-X.Y.jar myapp

这将运行Getdown,Getdown将下载并验证应用,然后执行应用。

Installers and Applet

Creating per-platform installers is unfortunately a more complex process than can be described in this quick start. See the |installers page for detailed instructions.

If you wish to run Getdown as a signed applet, in lieu of or along side downloadable installers, see the applet mode page for detailed instructions.

Updating Your App

为了更新你的应用,只需要为你的客户端创建新的临时目录,包含应用更新需要的jar文件(以及一个更新的getdown.txt文件,如果你需要往应用中增加额外的数据),重新运行Digester生成更新的digest.txt文件,然后把myapp目录的内容上传至web服务器,覆盖旧的myapp目录的内容。

Getdown将web服务器上getdown.txt文件最后修改的时间戳,如果它比客户端本地的新,它将下载所有修改过的文件。没有修改的文件(由digest.txt中的MD5散列值决定)不会被下载。

Note that this is how Getdown behaves in versionless mode. It is also possible for applications to provide an explicit version number for each application and control exactly when Getdown attempts to download a new version of the application. For details on this mode of operation see the documentation on explicit-versioned mode.

More Details

See the main documentation page for more details.

原文地址:https://www.cnblogs.com/cuizhf/p/4509246.html