Skip to content

zw963/marketbet_crawler

Repository files navigation

An attempt to build a project using roda and sequel toolkit, Simplicity, less gems as the first consideration.

For scrap the public stocks data in marketbet.com, and show them.

Technology stack

Roda with plugins.

Sequel with plugins.

hot_reloader

puma

minitest, ruby builtin.

rack-test

Folder structure

This project was adoption some devise from roda adviced conventions partially, but not following it completely.

config/environment.rb

this is the start point if you want start up app entirely as does like rails c in rails. we adoption this filename because it more conveniently follow rails entry convertion.

e.g. you can add require_relative 'config/environment' into PROJECT_ROOT/.pryrc.

then run pry to start it.

we provide a conveniently command for start our app with irb too, live in bin/irb.

config/application.rb

It is the place application config live, config/environment.rb require it, it require config/model.

With whatever you want put here for application specified config.

config/models.rb

This is the place Sequel(ORM) config live, it require config/db.rb which create a new DB connection when start up, you can add whatever Sequel specified config here.

When run sequel rake tasks(e.g. rake db:migrate) defined in lib/tasks/sequel.rake, those task only require this file instead of require app entirely.

there is a command named bin/db_console, it require this file only too, with this, you can play with all models, but not need load app entirely.

config/db.rb

Create Sequel db connection, we require this in test/test_helper, for check if current migration is latest.

config/hot_reloader.rb

Require by others components for support auto reloader(development mode) and eagerload(in production).

Rakefile, lib/tasks/sequel.rake

  1. Add tasks for run tests in test/ folder. just run rake or rake test.
  2. Add tasks for run specs in spec/ folder. run rake spec.
  3. Add tasks for run sequel db tasks, e.g. rake db:migrate

How to start app.

All useful environment variable set in Procfile.options, you can override all of them with

export DEVELOPMENT_DATABASE_URL="sqlite://db/files/marketbet_crawler_development.db"
export TEST_DATABASE_URL="sqlite://db/files/marketbet_crawler_test.db"
export DATABASE_URL="sqlite://db/files/marketbet_crawler_production.db"
export APP_SESSION_SECRET="909f017cc94c96f8a1aff843d95920485376f4c997143cc3c39ca945c883ec88e310a2177a69b8b714d22af1b5fd7864833568b6bf93fc3bc811bcf6e112"


run `rake db:create`

run `rake db:migrate`

run `bundle exec puma` to start app. you can start it with `procodile start -d` if use it.

visit '127.0.0.1:9292'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published