studentbeans v6.21.0
StudentBeans
Building
Production Mode
To build the frontend in production mode run make build
.
Development Mode
To build the frontend in development mode run make build_dev
.
NB: Currently the frontend does not auto-rebuild when a module is changed or when a container is re-started. The build has to be ran every time the JS changes.
Running
To run, simply execute janus run
after a janus build
.
Seeding data
Running Seeds
Seed are run easily with one single command: make setup
.
Generating Barcodes for testing
To generate a barcode for an offer:
1. docker-compose exec offers bash
2. cd src
3. rails c
4. RedemptionType.find(<insert your type number here>).redemption_details.redeemable_code.update(code: <insert code string here>, barcode_standard: :itf_barcode)
To then obtain the offer simply:
RedemptionType.find(373).offer
Then you can obtain the slug, etc for easy navigation to that offer.
Generating data for local venues
To generate the venues data:
- Ensure V1 offer data is seeded with
make setup
- Get yourself an instore offer slug
- Get into a rails console with:
docker-compose exec offers-v2 bundle exec rails c
- Create the V2 offer:
offer = FactoryGirl.create(:offer, slug: '<your slug here>')
- Create some venues: `venues = FactoryGirl.create_list(:venue, )
- Assign the venues to the offer:
offer.venues = venues
This should allow you see venues on the offer. You can check the venues returned
by visiting the offer page in studentbeans/web with /venues.json
appended to the url.
Dependencies
Useful dependencies:
Plinth - @thebeansgroup/plinth
- contains:
1. Verge
2. Helpers for styles, such as sizes, fonts, colours, etc
3. Responsive grid components
4. Components repeatedly used throughout studentbeans: loaders, modals, alerts, etc
5. SBiD
Offers - @thebeansgroup/stb_offers
- contains:
1. Connect-Specific Components
2. Components commonly used for offers on studentbeans, such as offer cards, redemptions, etc
3. Category and company pages
Mounting volumes for dependencies
Mount the required volumes in docker-compose.yml
. These are typically:
- .:/app/src
- /app/src/node_modules
- ../../library/plinth:/app/src/node_modules/@thebeansgroup/plinth:ro
- ../../studentbeans/offers:/app/src/node_modules/@thebeansgroup/stb_offers:ro
We mount app/src/node_modules
like this to unmount them locally but mount them on the docker machine.
Dependencies for dependencies
Make sure that all the necessary node_modules
are in place for the @thebeansgroup
dependencies you wish to mount by running a npm install
for them first.
Aliases for dependencies
Ensure that the aliases are setup correctly in webpack.alias.js
. Some may
need to be added as more dependencies are used.
e.g.
"@thebeansgroup/plinth": __dirname + '/node_modules/@thebeansgroup/plinth',
"plinth": __dirname + '/node_modules/@thebeansgroup/plinth'
Ensures that only the version of plinth used is the one within node_modules
.
Running Integration tests
Make sure all containers are up and running in sb/web.
Ensure that the test database is setup and that all the necessary tools are installed with:
make integration_setup
To setup a listener ready to run the tests against run:
make integration_listen
Open up another session, and run
make integration_run
And this will run the cucumber tests.
NB: Some tests may (i.e. WILL) fail on first run. Identify which tests these are and run them individually with:
make integration_run_single FEATURE=<FEATURE_NAME>.feature
e.g.
make integration_run_single FEATURE=promo_boxes.feature
Staging
- Ensure you have all the correct node modules and gems installed with
make prep
- Commit any changes to the
lockfile
orpackage.json
git push
- Stage with
make stage
6 years ago