Ruby gems downloads ranking site.
Hosted on http://bestgems.org/.
- UNIX like operating system. (Debian or Ubuntu are recommended)
- Ruby 3.3
- Middleware
- PostgreSQL 14
- Libraries
- libleveldb-dev
- Docker (Recommended)
- rbenv (Recommended)
sudo apt-get install libleveldb-devdocker run \
-d \
--name bestgems-pg \
-p 5432:5432 \
-e POSTGRES_USER=bestgems \
-e POSTGRES_PASSWORD=bestgems \
postgres:14Clone this repository.
git clone [email protected]:xmisao/bestgems.org.git
cd bestgems.orgExecute bundle install.
bundle installExport environment variables.
export RACK_ENV=production
export APP_ENV=production
export BESTGEMS_DB_HOST=127.0.0.1
export BESTGEMS_DB_USER=bestgems
export BESTGEMS_DB_PASSWORD=bestgems
export BESTGEMS_DB_NAME=bestgems
export BESTGEMS_LEVELDB_DIR=db/trends
export BESTGEMS_API_KEY=dummy_tokenExecute migration.
bundle exec rake db:migrationImport sample data.
bundle exec rake dev:import_sampleImport categories data.
bundle exec ruby tools/import_categories.rb tools/data/initial_categories.csvStart servers. The following command starts two processes that the application server and the trend server.
bin/startThe application server is BestGems.org main process which is implemented using Sinatra. Trend server is BestGems.org subprocess which is LevelDB wrapper using dRuby. BestGems.org requires those processes are running correctly.
Import additional data from RubyGems.org. Execute the following on another console.
bundle exec ruby tools/import_gem_detail.rb http://127.0.0.1:9292/api dummy_tokenOpen http://localhost:9292/ in your browser.
Running test will destroy PostgreSQL data and LevelDB data. We recommend to prepare isolated environment by following steps.
export RACK_ENV=production
export APP_ENV=production
export BESTGEMS_DB_HOST=127.0.0.1
export BESTGEMS_DB_USER=bestgems
export BESTGEMS_DB_PASSWORD=bestgems
export BESTGEMS_DB_NAME=bestgems-test # Important!
export BESTGEMS_LEVELDB_DIR=db/trends-test # Important!
export BESTGEMS_API_KEY=dummy_tokenPGPASSWORD=bestgems psql -U bestgems -h 127.0.0.1 -c 'CREATE DATABASE "bestgems-test";'
bundle exec rake db:migrationbundle exec rake testFormat the source by rufo.
bundle exec rake format