- Timestamp:
- 11/24/08 00:32:12 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TWikiShellContrib/data/TWiki/UsingBuildContribAndTWikiShell.txt
r878 r897 5 5 6 6 7 [[Foswiki:Extensions.BuildContrib][BuildContrib]] and [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] are two very useful [[TWiki:Codev.TWikiExtensions][TWikiExtensions]] that can simplify the life of TWiki developers (both Core and Plugins) by automating the boring stuff (copying file around, running tests, packaging and uploading).8 9 For the sake of simplicity, in this guide the term [[TWiki:Codev.TWikiExtensions][TWikiExtensions]]refers collectively (as defined by the community) to [[Foswiki:Extensions.PluginPackage][Plugins]], [[Foswiki:Extensions.AddOnPackage][Add-Ons]], [[Foswiki:Extensions.ContribPackage][Code Contributions]] and [[Foswiki:Extensions.SkinPackage][Skins]]7 [[Foswiki:Extensions.BuildContrib][BuildContrib]] and [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] are two very useful extensions that can simplify the life of Foswiki developers (both Core and Plugins) by automating the boring stuff (copying file around, running tests, packaging and uploading). 8 9 For the sake of simplicity, in this guide the term extension refers collectively (as defined by the community) to [[Foswiki:Extensions.PluginPackage][Plugins]], [[Foswiki:Extensions.AddOnPackage][Add-Ons]], [[Foswiki:Extensions.ContribPackage][Code Contributions]] and [[Foswiki:Extensions.SkinPackage][Skins]] 10 10 11 11 ---++ Overview … … 31 31 For a complete documentation, check [[Foswiki:Extensions.TWikiShellContrib][Here]]. 32 32 33 ---++ [[Foswiki:Extensions.BuildContrib][BuildContrib]] Quick guide to develop [[ TWiki:Codev.TWikiExtensions][TWikiExtensions]]33 ---++ [[Foswiki:Extensions.BuildContrib][BuildContrib]] Quick guide to develop [[Foswiki:Development.ExtensionDeveloperGuide][ExtensionDeveloperGuide]] 34 34 35 35 On the surface, [[Foswiki:Extensions.BuildContrib][BuildContrib]] can be somehow intimidating, but it's concept is pretty simple: By having three files (=MANIFEST=, =DEPENDENCIES= and build.pl) in a known place under the directory, most of the development lifecycle tasks can be automated. … … 39 39 [[Foswiki:Extensions.BuildContrib][BuildContrib]] makes some basic assumptions about the enviroment: 40 40 41 * The [[TWiki:Codev.TWikiExtensions][TWikiExtensions]] is not being developed your plugin in a live TWiki installation (which is usually a really bad idea), but are instead doing the sensible thing and developing in a separate directory tree, usually - but not always - a CVS checkout area.42 * The [[TWiki:Codev.TWikiExtensions][TWikiExtensions]] has a directory for itself outside the twiki root (ok, this is not an assumption, but if you try to generate a manifest for the [[TWiki:Codev.TWikiExtensions][TWikiExtensions]] from a twiki installation it'll end up with a lot of useless entries. Also, it's a good habit to acquire ;))43 * The enviroment variable TWIKI_LIBS has a colon-separated path list that may point anywhere needed to satisfied any of the [[TWiki:Codev.TWikiExtensions][TWikiExtension]]external dependencies.44 * The enviroment variable TWIKI_HOME point to the root of your test TWiki installation.41 * The extension is not being developed in a live Foswiki installation (which is usually a really bad idea), but are instead doing the sensible thing and developing in a separate directory tree, usually - but not always - a CVS checkout area. 42 * The extension has a directory for itself outside the twiki root (ok, this is not an assumption, but if you try to generate a manifest for the extensions from a Foswiki installation it'll end up with a lot of useless entries. Also, it's a good habit to acquire ;)) 43 * The enviroment variable TWIKI_LIBS has a colon-separated path list that may point anywhere needed to satisfied any of the extension external dependencies. 44 * The enviroment variable TWIKI_HOME point to the root of your test Foswiki installation. 45 45 * The your module follows the standards for plugins and contribs i.e. that it 46 1. Has a topic in the data/ TWikidirectory47 1. Has a perl module in the lib/ TWiki/Plugins or lib/TWiki/Contrib directory46 1. Has a topic in the data/System directory 47 1. Has a perl module in the lib/Foswiki/Plugins or lib/Foswiki/Contrib directory 48 48 1. Has a sub-directory alongside the perl module that contains the extra .pm files specific to the module 49 49 … … 53 53 54 54 ---++++ Create the Directory Structure 55 The first step to create a [[TWiki:Codev.TWikiExtensions][TWikiExtension]]is create the new directory structure in the checkout area, to maintain the repository up-to-date with local changes.56 57 The recommended directory layout & content for [[TWiki:Codev.TWikiExtensions][TWikiExtension]]development is:55 The first step to create a extension is create the new directory structure in the checkout area, to maintain the repository up-to-date with local changes. 56 57 The recommended directory layout & content for extension development is: 58 58 <verbatim> 59 59 |- twikiroot 60 60 | |- twikiplugins 61 | | |- TWikiExtensionName61 | | |- FoswikiExtensionName 62 62 | | | |- bin 63 63 | | | |- lib 64 | | | | |- TWiki64 | | | | |- Foswiki 65 65 | | | | | |- (Contrib|Plugins) 66 | | | | | | |- TWikiExtensionName66 | | | | | | |- FoswikiExtensionName 67 67 | | | | | | | |- build.pl 68 68 | | | | | | | |- MANIFEST 69 69 | | | | | | | |- DEPENDENCIES 70 | | | | | | |- TWikiExtensionName.pm70 | | | | | | |- FoswikiExtensionName.pm 71 71 | | | |- data 72 | | | | |- TWiki73 | | | | | |- TWikiExtensionName.txt72 | | | | |- System 73 | | | | | |- FoswikiExtensionName.txt 74 74 | | | |- pub 75 75 | | | |- tests 76 76 | | | | |- unit 77 | | | | | |- TWikiExtensionNameSuite.pm77 | | | | | |- FoswikiExtensionNameSuite.pm 78 78 | | | |- templates 79 79 </verbatim> … … 90 90 The =MANIFEST= file should read (at least): 91 91 <verbatim> 92 lib/ TWiki/(Contrib|Plugins)/TWikiExtensionName.pm93 data/ TWiki/TWikiExtensionName.txt94 tests/unit/ TWikiExtensionNameSuite.pm92 lib/Foswiki/(Contrib|Plugins)/FoswikiExtensionName.pm 93 data/System/FoswikiExtensionName.txt 94 tests/unit/FoswikiExtensionNameSuite.pm 95 95 </verbatim> 96 96 … … 99 99 For a complete description of the format of the =MANIFEST= and =DEPENDENCIES= files, check [[BuildContrib][Here]]. 100 100 101 ---++++ "Installing" the TWikiExtension102 103 To test the [[TWiki:Codev.TWikiExtensions][TWikiExtension]], it must be "installed" into the twikiroot. There are two options to do it:104 105 1. Make the change in the plugins checkout area, and deploy them to the test TWiki installation OR106 1. Deploy the plugin to the test TWiki installation, make the changes "live", and then copy back the modifications to the checkout area101 ---++++ "Installing" the Foswiki Extension 102 103 To test the extension, it must be "installed" into the foswikiroot. There are two options to do it: 104 105 1. Make the change in the plugins checkout area, and deploy them to the test Foswiki installation OR 106 1. Deploy the plugin to the test Foswiki installation, make the changes "live", and then copy back the modifications to the checkout area 107 107 108 108 [[Foswiki:Extensions.BuildContrib][BuildContrib]] can help in the first case. Invoking … … 132 132 =perl build.pl release= 133 133 134 and it will create a =.zip= and a =.tar.gz= files based in the content of the =MANIFEST= file and an installer called = TWikiExtensionName_installer= (ie. =SamplePlugin_installer=). All these files will be created in the "root" of the plugin directory. (ie: under =twikiplugins/SamplePlugin=).135 As part of the release process, the [[TWiki:Codev.TWikiExtensions][TWikiExtension]]topic is processed an the following tags will be replaced:136 * =%$MANIFEST%= - TWiki table of files in =MANIFEST=134 and it will create a =.zip= and a =.tar.gz= files based in the content of the =MANIFEST= file and an installer called =FoswikiExtensionName_installer= (ie. =SamplePlugin_installer=). All these files will be created in the "root" of the plugin directory. (ie: under =twikiplugins/SamplePlugin=). 135 As part of the release process, the extension topic is processed an the following tags will be replaced: 136 * =%$MANIFEST%= - Foswiki table of files in =MANIFEST= 137 137 * =%$DEPENDENCIES%= - list of dependencies from =DEPENDENCIES= 138 138 * =%$VERSION%= version from $VERSION in main .pm … … 141 141 142 142 143 ---++++ Uploading the changes to TWiki.org144 As the last step of the development lifecycle, the released version must be uploaded to the proper topic in TWiki.org.143 ---++++ Uploading the changes to foswiki.org 144 As the last step of the development lifecycle, the released version must be uploaded to the proper topic in foswiki.org. 145 145 To do this, invoke: 146 146 147 147 =perl build.pl upload= 148 148 149 and [[Foswiki:Extensions.BuildContrib][BuildContrib]] will create the release package, and upload it automatically to the proper place in TWiki.org.150 151 ---++ [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] Quick guide to develop [[TWiki:Codev.TWikiExtensions][TWikiExtensions]]149 and [[Foswiki:Extensions.BuildContrib][BuildContrib]] will create the release package, and upload it automatically to the proper place in foswiki.org. 150 151 ---++ [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] Quick guide to develop extensions. 152 152 153 153 The default [[Foswiki:Extensions.CommandSet][CommandSets]] bundled with [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] can be used to simplify even more the development process, by complementing the operatios already performed by [[Foswiki:Extensions.BuildContrib][BuildContrib]]. … … 167 167 168 168 ---++++ Create the Directory Structure 169 The first step to create a [[TWiki:Codev.TWikiExtensions][TWikiExtension]] iscreate the new directory structure in the checkout area, to maintain the repository up-to-date with local changes.169 The first step to create an extension is to create the new directory structure in the checkout area, to maintain the repository up-to-date with local changes. 170 170 171 171 The directory structure is as follows: 172 172 173 A typical directory layout & content for [[TWiki:Codev.TWikiExtensions][TWikiExtension]]development is:173 A typical directory layout & content for extension development is: 174 174 <verbatim> 175 175 |- twikiroot 176 176 | |- twikiplugins 177 | | |- TWikiExtensionName177 | | |- FoswikiExtensionName 178 178 | | | |- MANIFEST 179 179 | | | |- DEPENDENCIES 180 180 | | | |- bin 181 181 | | | |- lib 182 | | | | |- TWiki182 | | | | |- Foswiki 183 183 | | | | | |- (Contrib|Plugins) 184 | | | | | | |- TWikiExtensionName184 | | | | | | |- FoswikiExtensionName 185 185 | | | | | | | |- build.pl 186 | | | | | | |- TWikiExtensionName.pm186 | | | | | | |- FoswikiExtensionName.pm 187 187 | | | |- data 188 | | | | |- TWiki189 | | | | | |- TWikiExtensionName.txt188 | | | | |- System 189 | | | | | |- FoswikiExtensionName.txt 190 190 | | | |- pub 191 191 | | | |- tests 192 192 | | | | |- unit 193 | | | | | |- TWikiExtensionNameSuite.pm193 | | | | | |- FoswikiExtensionNameSuite.pm 194 194 | | | |- templates 195 195 </verbatim> … … 199 199 To create this structure, invoke: 200 200 201 =perl twikishell plugin create ! TWikiExtensionName=201 =perl twikishell plugin create !FoswikiExtensionName= 202 202 203 203 and [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] will create the directory structure with empty skeletons for all the files. The =MANIFEST= file is created automatically. … … 205 205 The =MANIFEST= file should read: 206 206 <verbatim> 207 lib/ TWiki/Plugins/TWikiExtensionName.pm208 data/ TWiki/TWikiExtensionName.txt209 tests/unit/ TWikiExtensionNameSuite.pm207 lib/Foswiki/Plugins/FoswikiExtensionName.pm 208 data/System/FoswikiExtensionName.txt 209 tests/unit/FoswikiExtensionNameSuite.pm 210 210 </verbatim> 211 211 212 212 Note that none of the special files used by [[Foswiki:Extensions.BuildContrib][BuildContrib]] is in the =MANIFEST=, because they are usually not distributed to end-users. 213 213 214 ---++++ "Installing" the [[TWiki:Codev.TWikiExtensions][TWikiExtension]]215 216 [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] follows the second option: Deploy the plugin to the test TWiki installation, make the changes "live", and then copy back the modifications to the checkout area.214 ---++++ "Installing" the extension 215 216 [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] follows the second option: Deploy the plugin to the test Foswiki installation, make the changes "live", and then copy back the modifications to the checkout area. 217 217 218 218 For that, invoke: 219 219 220 =perl twikishell plugin develop ! TWikiExtension=221 222 and it will copy all the content of the plugin directory intro the twiki installation. Also, two files called = TWikiExtensionName.MF= and =TWikiExtensionName.DEP= are created in the twiki root. =TWikiExtension.MF= will have a list of all the copied files, and should be identical to the =MANIFEST= file. Similary, the =TWikiExtension.DEP= should be identical to the =DEPENDENCIES= file.220 =perl twikishell plugin develop !FoswikiExtension= 221 222 and it will copy all the content of the plugin directory intro the twiki installation. Also, two files called =FoswikiExtensionName.MF= and =FoswikiExtensionName.DEP= are created in the twiki root. =FoswikiExtension.MF= will have a list of all the copied files, and should be identical to the =MANIFEST= file. Similary, the =FoswikiExtension.DEP= should be identical to the =DEPENDENCIES= file. 223 223 224 224 Now, all the changes can be made "live". … … 226 226 After all the changes, invoke: 227 227 228 =perl twikishell plugin putback ! TWikiExtension=229 230 and it will copy all the files listed in = TWikiExtension.MF= back to the checkout area, updating the =MANIFEST= and =DEPENDENCIES= with the content of =TWikiExtension.MF= and =TWikiExtension.DEP= respectively.228 =perl twikishell plugin putback !FoswikiExtension= 229 230 and it will copy all the files listed in =FoswikiExtension.MF= back to the checkout area, updating the =MANIFEST= and =DEPENDENCIES= with the content of =FoswikiExtension.MF= and =FoswikiExtension.DEP= respectively. 231 231 232 232 ---++++ Adding or Removing files 233 233 234 When adding or removing files from the package, the = TWikiExtension.MF= must be updated so the proper =MANIFEST= file can be generated later.234 When adding or removing files from the package, the =FoswikiExtension.MF= must be updated so the proper =MANIFEST= file can be generated later. 235 235 236 236 ---++++ Running tests … … 238 238 If =Test::Unit= is installed in the system, invoking 239 239 240 =perl twikishell runtest ! TWikiExtensionSuite=241 242 will try to run automatically the =tests/unit/ TWikiExtensionSuite.pm= module.240 =perl twikishell runtest !FoswikiExtensionSuite= 241 242 will try to run automatically the =tests/unit/FoswikiExtensionSuite.pm= module. 243 243 244 244 ---++++ Preparing the release package … … 248 248 So, to create the release file, invoke 249 249 250 =perl twikishell build ! TWikiExtension release=250 =perl twikishell build !FoswikiExtension release= 251 251 252 252 and it will call automatically the proper =build.pl= script with the =release= target 253 253 254 ---++++ Uploading the changes to TWiki.org254 ---++++ Uploading the changes to foswiki.org 255 255 256 256 In the same way as releasing the package, invoking 257 257 258 =perl twikishell build ! TWikiExtension upload=258 =perl twikishell build !FoswikiExtension upload= 259 259 260 260 will call automatically the proper =build.pl= script with the =upload= target. … … 262 262 ---++++ Additional Operation: Packaging the development version 263 263 264 If for some reason there is the need to package the whole development version of a !TWikiExtension (including the =MANIFEST=, =DEPENDENCIES=,etc), invoke:265 266 =perl twikishell package ! TWikiExtension=264 If for some reason there is the need to package the whole development version of an Extension (including the =MANIFEST=, =DEPENDENCIES=,etc), invoke: 265 266 =perl twikishell package !FoswikiExtension= 267 267 268 268 and it'll create a =tar.gz= file with all the files in the plugin directory … … 270 270 ---++ Summary 271 271 272 Combining [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] and [[Foswiki:Extensions.BuildContrib][BuildContrib]] ease the development of [[TWiki:Codev.TWikiExtensions][TWikiExtensions]]. The lifecycle becomes:273 274 * =perl twikishell plugin create ! TWikiExtension=275 * =perl twikishell plugin develop ! TWikiExtension=276 * =perl twikishell runtest ! TWikiExtension= or =perl twikishell build !TWikiExtension test=277 * =perl twikishell plugin putback ! TWikiExtension=278 * (optionally) =perl twikishell build release ! TWikiExtension=279 * (optionally) =perl twikishell package ! TWikiExtension=280 * =perl twikishell build upload ! TWikiExtension=272 Combining [[Foswiki:Extensions.TWikiShellContrib][TWikiShellContrib]] and [[Foswiki:Extensions.BuildContrib][BuildContrib]] ease the development of extensions. The lifecycle becomes: 273 274 * =perl twikishell plugin create !FoswikiExtension= 275 * =perl twikishell plugin develop !FoswikiExtension= 276 * =perl twikishell runtest !FoswikiExtension= or =perl twikishell build !FoswikiExtension test= 277 * =perl twikishell plugin putback !FoswikiExtension= 278 * (optionally) =perl twikishell build release !FoswikiExtension= 279 * (optionally) =perl twikishell package !FoswikiExtension= 280 * =perl twikishell build upload !FoswikiExtension= 281 281 282 282 This could be quite verbose, but creating the proper shellscripts (invoking =perl twikishell shorcuts=), they are abbreviated to: 283 283 284 * =plugin create ! TWikiExtension=285 * =plugin develop ! TWikiExtension=286 * =runtest ! TWikiExtension= or =build !TWikiExtension test=287 * =plugin putback ! TWikiExtension=288 * (optionally) =build release ! TWikiExtension=289 * (optionally) =package ! TWikiExtension=290 * =build upload ! TWikiExtension=284 * =plugin create !FoswikiExtension= 285 * =plugin develop !FoswikiExtension= 286 * =runtest !FoswikiExtension= or =build !FoswikiExtension test= 287 * =plugin putback !FoswikiExtension= 288 * (optionally) =build release !FoswikiExtension= 289 * (optionally) =package !FoswikiExtension= 290 * =build upload !FoswikiExtension=
Note: See TracChangeset
for help on using the changeset viewer.
