Giter Club home page Giter Club logo

marketbet_crawler's Introduction

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'

marketbet_crawler's People

Contributors

zw963 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.