@niiwin/core
v3.1.0
Published
This repo contains the source code for the Niiwin Rails engine and npm package. Find out more about Niiwin at https://niiwin.ca
Downloads
115
Readme
Niiwin
This repo contains the source code for the Niiwin Rails engine and npm package. Find out more about Niiwin at https://niiwin.ca
Getting started for Niiwin Core Developers
Follow these steps if you are a Niiwin Core Developer and you work on the Niiwin RubyGem, npm package, or dev toolchain:
Prerequisites
You'll need the following installed to continue setting up your development environment:
- A Ruby version manager/switcher (rbenv, rvm, chruby, asdf, etc.)
- Node.js (14.21.3+)
- Yarn (1.22.0+)
- Postgresql (9.6+)
- Redis (6+)
- Optional: The 1Password CLI1
Install Ruby
This assumes you have rbenv
installed, though another Ruby version manager will also work.
- Check that the required Ruby version 3.2.2 is installed:
rbenv versions
- Install it if it's not installed yet:
rbenv install 3.2.2
- Set global Ruby version to 3.2.2:
rbenv global 3.2.2
Install the Niiwin gem and related repos
Since you are developing the Niiwin gem alongside an application, you will clone the Niiwin code repo and use a locally sourced version of the gem.
The niiwin-test
app is configured to use your local Niiwin Engine gem source, and not the one hosted online. This is so that you can test your work in progress. In order for this to work, you need your code repos set up in the following way:
<niiwin-parent-folder> # A container for the niiwin related repos
├── niiwin # The Niiwin Engine gem (this repo)
├── niiwin-technical-documentation # Niiwin technical documentation
└── niiwin-test # THe Niiwin Engine test suite
The niiwin-technical-documentation
repo is not required to run tests, however, it uses the niiwin-test
repo to generate some automated diagrams, so it needs to fit into this folder structure as well.
cd
into the<niiwin-parent-folder>
- Clone the repo
git clone [email protected]:animikii/niiwin.git
Add the Niiwin binaries to your path by adding the following lines to the end of your shell configuration file (ex: ~/.zshrc
or ~/.bashrc
).
# Set up path to niiwin engine gem source
export NIIWIN_GEM_SOURCE="/Users/youruser/niiwin-parent-folder/niiwin" # <-- replace with your local niiwin gem path
export PATH="$NIIWIN_GEM_SOURCE/bin:$PATH"
Install dependencies
Make sure you are in the Niiwin gem root directory, then:
bundle install
yarn install
yarn build
Generate a new Niiwin App using your local gem source
Use the --path
flag to specify a custom path to the Niiwin gem source.
niiwin-init --name my-awesome-app --path $NIIWIN_GEM_SOURCE
Once the script is done, cd
into the new app's root directory and start the app:
.bin/dev
In a browser, visit http://localhost:3000, and use the "Dev Login" button at the bottom of the page to choose a role and log in.
Now you can start working on the new Niiwin App, or on the Niiwin Engine itself.
NOTE: when providing a custom path to the niiwin gem to the niiwin-init script, that absolute path will be inserted into the app's Gemfile
for the niiwin entry. If you plan on sharing the app's code with other developers, you should change the absolute path to the niiwin gem to a relative one: Change gem "niiwin", path: "/absolute/path/to/niiwin"
to gem "niiwin", path: "../niiwin"
.
NOTE2: If you have more than one niiwin app running on your machine set up a different REDIS_URL for each running app, otherwise apps will place jobs on the same redis queue.
Optional Tooling
pre-commit
If you would like to automatically fix standard-rb warnings before committing, install the pre-commit
tool.
pip install pre-commit