We're so glad you're thinking about contributing to an 18F open source project! If you're unsure about anything, just ask -- or submit the issue or pull request anyway. The worst that can happen is you'll be politely asked to change something. We love all friendly contributions.
We want to ensure a welcoming environment for all of our projects. Our staff follow the 18F Code of Conduct and all contributors should do the same.
We encourage you to read this project's CONTRIBUTING policy (you are here), its LICENSE, and its README.
If you have any questions or want to read more, check out the 18F Open Source Policy GitHub repository, or just shoot us an email.
This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.
All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.
Use these steps if you just want to get started quickly and you have your Go environment configured as per Step 1 below.
-
Follow the installation instructions.
-
Go to the repository directory.
cd $GOPATH/src/github.com/opencontrol/fedramp-templater
-
code code code
-
Run the tests.
go test -v $(go list ./... | grep -v /vendor/)
-
Run the CLI.
go run main.go fixtures/FedRAMP_ac-2-1_v2.1.docx tmp/output.docx open tmp/output.docx
Glide is used to manage dependencies.
glide get --strip-vcs --strip-vendor <package>
The Makefile
is adapted from a standard Go Makefile. Want to use it? Then follow these steps:
-
Directory Structure. The
Makefile
assumes you have a "standard" structure when you pull down the software. For example:[top-level-dir] -> git -> src -> github.com -> opencontrol -> fedramp-templater
The advantage to this structure is that it works very well with any Git project, from any workspace.
-
Install Go. Strongly recommend not to install Go directly but instead to use Go Version Manager (gvm). As an example, selecting a specific Go version is as easy as:
gvm use [installed go-version from 'gvm list']
-
Install
make
. See GNU Make for details on whatmake
is and can do.yum
-based systems (RHEL / CentOS / etc.):sudo yum install make
apt
-based systems (Ubuntu / etc.). The below actually installs lots more than justmake
:sudo apt-get install build-essential
How about Mac? First, install Homebrew. Then:
brew install make
-
OPTIONAL: Install Debugger. Unfortunately, software does at times behave oddly. The debugger used by this
Makefile
is Delve (dlv). It can take a little effort to get the debugger installed and working, but the results are far worth it! -
One-Time Setup. Just like in the Manual Instructions above, the code dependencies must be installed. There is a simple target for this:
make depend
The above will pull down all the required dependencies and will not need to be run again.
-
Common Targets. Invoke a target by using:
make [target-name]
The common targets include:
all
- Performs abuild
build
- Builds the source code and placesfedramp-templater
binary into the./bin
folder (excluded via.gitignore
)debug
- Invokedlv
(did you install it above?) and invoke it with anyDEBUG_OPTIONS
defined on the command line (example below).clean
- Simply removes thecompliance-masonry
binary from the./bin
folderrebuild
- Invokesclean
andbuild
.test
- Runs the tests.lint
- Checks to see if the Go code is properly formatted. (If you want to contribute to the project, use this target; you will need to make sure your code follows accepted standards.)
-
Examples.
-
Build the CLI:
make build
-
Debug the CLI using
dlv
, running thefill
command. For this to work, let's assume a simple layout as shown below:~/myproj/myapp -> opencontrols (output from 'compliance-masonry get') -> input -> Input.docx -> output -> (empty folder; will be filled by 'fedramp-templater fill')
(Of course, the
Input.docx
document must be a FedRAMP SSP Template.)Given the above, invoke the debugger by using something like the following (the numerous variables are used simply to keep the text formatted nicely in the browser):
MY_DIR="$HOME/myproj/myapp" MY_INPUT="$MY_DIR/input/Input.docx" MY_OUTPUT="$MY_DIR/output/Output.docx" make debug DEBUG_OPTIONS="fill '$MY_DIR/opencontrols' '$MY_INPUT' '$MY_OUTPUT'"
If all goes well, you should get a debugger prompt and be able to execute debugger commands:
Type 'help' for list of commands. (dlv) b main.go:119 Breakpoint 1 set at 0x4353793 for main.main() ./main.go:119 (dlv) c > main.main() ./main.go:119 (hits goroutine(1):1 total:1) (PC: 0x4353793) 114: } 115: 116: func main() { 117: opts := parseArgs() 118: => 119: openControlData := loadOpenControls(opts.openControlsDir) 120: doc, err := ssp.Load(opts.inputPath) 121: if err != nil { 122: log.Fatalln(err) 123: } 124: defer doc.Close() (dlv) p opts main.options { openControlsDir: "/Users/l.abruce/myproj/myapp/opencontrols", inputPath: "/Users/l.abruce/myproj/myapp/input/Input.docx", outputPath: "/Users/l.abruce/myproj/myapp/output/Output.docx", cmd: 2,} (dlv) q
-
Only tested on Mac.
./scripts/preview-doc <path/to/word.docx>
-
Install [goxc](go get github.com/laher/goxc)
go get github.com/laher/goxc
-
Get a GitHub API token. The token should have write access to repos.
-
Add a .goxc.local.json file with a github api key
goxc -wlc default publish-github -apikey=123456789012
-
Set version number in:
-
Run the release script
./release.sh