This document describes how to modify and customize squIRCy2, and optionally contribute your changes back to the original squIRCy2 codebase.
The master branch contains active development. It should be considered unstable. Versions are tagged in the repository.
squIRCy2 is made up of a few different parts:
See
cli.go
for the CLI related code.
See
web/controller.go
for code related to all controller actions.
Running
go generate
prior to building squIRCy2 will regenerate the binary forms of the assets intobindata.go
. See “Building the project.” for more details.
A persistence layer is available using tiedot. A basic repository is implemented in data
with more specific implementations in config/model.go
and script/model.go
.
The Javascript VM is a lightly wrapped otto runtime. Code related to customizing the VM and executing predefined scripts is in script/
.
event/
, a wrapper for go-ircevent in irc/
, and an overall “manager” that embeds an inject.Injector in manager.go
.Fork the squIRCy2 repository on GitHub.
git clone [email protected]/you/squircy2.git squircy2
cd squircy2
There are two options for building squIRCy2: default (release) and debug. Debug mode is recommended for development.
Building squIRCy2 in debug mode makes it so that changes to views and static assets do not require a rebuilding of the squIRCy2 code.
go build -tags debug -o squircy2 ./cmd/squircy2/...
./squircy2
Alternatively, you can run squIRCy2 with go run
:
go run -tags debug ./cmd/squircy2/main.go
Note: When running in debug mode, squIRCy2 will look in the current working directory for views and assets. Specifically, views must be in
$PWD/views
and static assets in$PWD/public
.
Building squIRCy2 for release takes two steps. First, we have to convert our assets and views into binary form. This relies on the go-bindata utility which is installed along-side squIRCy2 and must be in your PATH.
go generate
go build -o squircy2 ./cmd/squircy2/*.go
./squircy2
go build -o squircy2 -ldflags "-X main.Version=$(git rev-parse --short HEAD)" ./cmd/squircy2/*.go
With squIRCy forked and set up for development, you’re ready to get started. Depending on how you’re building squIRCy, you may need to do different things to see your changes take effect.
Modifying Go source code will always require that you stop the currently running squIRCy2 process, then running go build && ./squircy2
or go run main.go
to rebuild the binary and run it.
When running in debug mode, modifying assets requires a refresh in your browser. However, if you’re running in default (release) mode, then you will have to run go generate ./...
before rebuilding and running the squIRCy2 binary.
If you’d like to create a new feature or fix a bug and contribute your modification to the original repository, follow these steps.
cd /path/to/your/forks/code
git checkout -b new-and-awesome master
This will checkout a new branch named new-and-awesome
based on the current master branch.
git add .
git commit -m "Made some changes"
git push origin new-and-awesome
From your repository on the GitHub interface, click the pull request button. Select your feature branch and ensure the master branch of squIRCy2 is selected.