[[PageOutline(2-5,Contents,pullout)]] = Bitten Recipe Extractor = == Description == Two small scripts who's purpose is to retrieve a Trac's Bitten rule sets. Thus allowing you to make off-line changes quickly with your favorite text editor.[[BR]] Once satisfied with your changes, a second script uploads said changes. == Bugs/Feature Requests == Existing bugs and feature requests for BittenRecipesExtractorScript are [report:9?COMPONENT=BittenRecipesExtractorScript here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=BittenRecipesExtractorScript&owner=mjasonmiller new ticket]. === Known Issues === Pattern matching may include swap and backup specific files from editing your recipes. The only issue this would cause, may be a file with no changes from the original, or other non-desirable changes. Keep this in mind if your finding recipes not updating with correct data. Search for hidden files in your recipe directory, and delete them. I have attempted to solve this, but unfortunately I have found that Trac allows periods and dashes in the naming convention of bitten rules. So this rules out a lot of simple pattern matching I can perform. eg: {{{if str.isalnum(file_name)}}} Super User access is needed when reading and writing to the Trac database directly.[[BR]] Also, on some of my clusters that I work with, multiple version of python can exist. Meaning, if you receive errors like: {{{ #!sh ImportError: No module named trac.env }}} You need to adjust your PATH environment to include the path to which ever python version was used to install and run Trac: {{{ #!sh export PATH=/usr/local/python2.7/bin:$PATH }}} ^Note: This, being the one reason I do not include the common #!/usr/bin/python interrupter header in my scripts.^[[BR]][[BR]] == Download == Download the zipped source from [download:bittenrecipesextractorscript here]. == Source == You can check out BittenRecipesExtractorScript from [http://trac-hacks.org/svn/bittenrecipesextractorscript here] using Subversion, or [source:bittenrecipesextractorscript browse the source] with Trac. == Example == I may combined these two scripts into one someday, but for now the usage follows:[[BR]] === Reading and Writing Recipes === Each Bitten Rule will be a separate .recipe file.[[BR]] Each python script uses the same single argument. The only argument that is needed, is the path to your Trac environment. Which is exactly what is necessary when ever you run: {{{ #!sh trac-admin /some/trac/environment }}} To be absolutely clear on this, and to add additional text spam to this site: {{{ #!sh sudo python recipe_get.py /some/trac/environment }}} and: {{{ #!sh sudo python recipe_put.py /some/trac/environment }}} Accordingly.[[BR]][[BR]] When you perform a recipe_get.py, a directory will be created with a name equal to your Trac directory with '_recipes' appended to it (trac-directory-name_recipes). The recipes will be saved (or updated for recipes currently residing) in this directory. You can leave these files there and continue to run both scripts for eternity. No need to clean them up. And quite frankly, leaving them alone for backup reasons, is a darn good idea. === Editing the Recipe Files === The file syntax is fairly straight forward. The values are delimited by two carrot characters. Please, if there is a quicker better way, do submit a ticket.[[BR]] From the first value to last: * The unique recipe name (NEVER CHANGE THIS) * The path in your repository * Is this recipe active or not? 1 being active, 0 being inactive * The bitten recipe itself * The minimum revision (if blank set to None) * The maximum revision (if blank set to None) * The recipe name as seen on the Trac Bitten Builds page * The recipe description I have seen no harm in changing all but the first value. In fact, I have altered the other values with incorrect data, and was easily able to recover from it, by making my corrections, and running the recipe_put.py script again. == Recent Changes == [[ChangeLog(bittenrecipesextractorscript, 3)]] == Author/Contributors == '''Author:''' [wiki:mjasonmiller] [[BR]] '''Maintainer:''' [wiki:mjasonmiller] [[BR]] '''Contributors:'''