github.com/attic-labs/noms@v0.0.0-20210827224422-e5fa29d95e8b/tools/noms/README.md (about)

     1  # Noms build script helpers
     2  
     3  These are helper functions for writing your Noms app build and staging scripts.
     4  
     5  ## Writing your scripts
     6  
     7  ### Build scripts
     8  Your build script must be named *build.py*. It will be discovered by the system and executed in the directory in which it's found. It must require no arguments, though environment variables will propagate in.
     9  
    10  ### Staging scripts
    11  After your build script gets run, we'll run your staging script -- the purpose of which is to take your build products and put them in a directory that's ready to be packaged and deployed somewhere. This script must be called *stage.py* and take as its sole argument the path to a directory where all project code is being staged.
    12  
    13  ### Libraries
    14  We have provided a library to make writing your staging scripts easier. Example usage:
    15  ```python
    16  	#!/usr/bin/python
    17  
    18  	import noms.staging as staging
    19  
    20  	if __name__ == '__main__':
    21  		staging.Main('nerdosphere', staging.GlobCopier('index.html', 'styles.css', '*.js'))
    22  ```
    23  Importing and using `noms.staging` handles determining where you should stage your code and creating the necessary directories for you. You just pass it the name of your project and a function that knows how to stage your build artifacts, given a path under which to put everything.
    24  
    25  
    26  ## Develop
    27  
    28  * To run unittests: `python -m unittest discover -p "*_test.py" -s $GOPATH/src/github.com/attic-labs/noms/tools`