Skip to content

BasalticStudio/new-era

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NewEra

The Sci-Fi Robot Game which is written in Rails.

Status
Test
Lint
Package
Maintainability
Test Coverage
Uptime

System Requirement

  • Ruby ~> 3.0.4
  • PostgreSQL ~> 14.0
  • Node.js ~> 16.0

Development

The development environment is based on macOS.

Homebrew

We use Homebrew to manage the packages on macOS.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

We can use brew doctor to ensure the Homebrew is available after installing it.

Ruby

To smooth upgrade the Ruby version, we choose rbenv to manage the Ruby versions.

brew install rbenv

After installation, please follow the message to configure .bashrc or your shell config.

rbenv install 3.0.4

You may need to install bundler by yourself if the bundle command is not found.

# Ensure already switch to correct Ruby version
ruby -v
# => ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-darwin21]

gem install bundler

PostgreSQL

Before install PostgreSQL, please check the version is pin with correct version.

# Install
brew install postgresql@13

# Start server
brew services start postgresql@13

Node.js

We will need Node.js to compile JavaScript and CSS.

brew install node

The Rails use yarn as package manager for Node.js.

brew install yarn

The Node.js version doesn't constraint to specify the version, the latest stable version is suggested.

Rails

Use git clone [email protected]:BasalticStudio/new-era.git to your machine.

# Switch to project folder.
cd new-era

# Install ncessary packages
bundle install
yarn install

# Setup the git hook
bundle exec overcommit --install

Overcommit will check for:

  1. pre-commit: rubocop for syntax, sorbet for type check
  2. pre-push: brakeman for security auditing
# Initialize batabase
bundle exec rake db:create

# Update schema to latest version
bundle exec rake db:migrate

Operate in local

Dev Server

./bin/dev

You can see the website at http://localhost:3000

PendingMigration Error

Run db:migrate again to update the schema

bundle exec rake db:migrate

Foreman not found

Our project use Foreman to run Rails server with JavaScript / CSS compiler.

gem install foreman

Running Unit Test

bundle exec rspec

Running E2E Test

bundle exec cucumber

Ruby Syntax Check

bundle exec rubocop

Ruby Security Check

bundle exec brakeman

Setup .env

Create a .env will allow you change settings in local dev environment.

cp .env.example .env

License

There are two license for source code and assets.

The source code is released under Apache 2.0 and the assets is under CC BY-NC-SA 4.0.