A Ruby on Rails application for the Open Hub platform.
- Prerequisites
- Getting Started
- Database Setup
- Running the Application
- Testing
- Pull Request Checks
- Contributing
Before you begin, ensure you have the following installed:
- Ruby: 3.1.7 (use
rbenvorrvm) - Rails: 6.1.7.10
- PostgreSQL: Latest stable version
brew install postgresql
brew services start postgresqlsudo apt-get update
sudo apt-get install postgresql postgresql-contrib libpq-devbrew install rbenv
rbenv install 3.1.7
rbenv global 3.1.7git clone git@github.com:blackducksoftware/ohloh-ui.git
cd ohloh-uigem install bundler
bundle installCreate a file named .env.development in the project root with the following content:
DB_ENCODING=UTF-8
DB_HOST=localhost
DB_NAME=oh_db
DB_USERNAME=fis_user
DB_PASSWORD=fis_password
TEST_DB_HOST=localhost
TEST_DB_NAME=oh_test
TEST_DB_USERNAME=fis_user
TEST_DB_PASSWORD=fis_passwordpsql postgresIn PostgreSQL prompt:
CREATE USER fis_user WITH PASSWORD 'fis_password';
ALTER USER fis_user WITH SUPERUSER;Note: The default DB encoding was set to SQL_ASCII for legacy data compatibility. UTF-8 encoding is recommended for new data.
rails db:create
rake db:structure:load
rake db:migrateNote: You may see errors about existing relations and constraints. These can be safely ignored.
Create a default admin user (arguments are optional):
ruby script/setup_default_admin.rb <login> <password> <email>Default credentials if no arguments provided:
- Login:
admin_user - Password:
admin_password - Email:
admin@example.com
Start the Rails server:
rails sVisit http://localhost:3000 to view the application.
Run the full test suite:
$ rake testRun a single test file:
$ rake test test/models/account_test.rbRun a directory of tests:
$ rake test test/modelsThe CI pipeline runs the following checks on all pull requests:
rake ci:all_tasksThis includes:
- rubocop - Ruby style linting
- bundle audit - Dependency vulnerability checking
- rake test - Ruby unit tests
After all the successful checks, CI pipeline will have success message like
All checks has been passed.
- Create a feature branch from
main - Make your changes
- Run
rake ci:all_tasksto ensure all checks pass - Submit a pull request
See LICENSE file for details.
For security concerns, please refer to security.md.