Giter VIP home page Giter VIP logo

statusbot-models's Introduction

Statusbot::Models Build Status Gem Version Code Climate Test Coverage Dependency Status

Provides the models used by statusbot.me.

Installation

Add this line to your application's Gemfile:

gem 'statusbot-models'

And then execute:

$ bundle

Or install it yourself as:

$ gem install statusbot-models

Usage

Before getting started, you must install MySQL. Once that is installed, you'll need to setup some base stuff.

For development (assuming connection from localhost):

CREATE USER 'statusbot'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON `statusbot`. * TO 'statusbot'@'localhost';
FLUSH PRIVILEGES;

For test (assuming connection from localhost):

CREATE USER 'statusbot_test'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON `statusbot_test`. * TO 'statusbot_test'@'localhost';
FLUSH PRIVILEGES;

Rails

To get up and running with rails, you can do the following:

  • Run the following commands

      rake railties:install:migrations
      rake db:migrate
    
  • You are now ready to use the models in your code (assuming database.yml is populated)

      ModelName.all
    

Non-Rails

If you are not using rails, you can get up and running by doing:

  • Create db/config.yml file. This uses default activerecord configuration:

      development:
        adapter: mysql2
        encoding: utf8
        database: statusbot
        pool: 5
        username: statusbot
        password: password
        socket: /tmp/mysql.sock
    
      test:
        adapter: mysql2
        encoding: utf8
        database: statusbot_test
        pool: 5
        username: statusbot_test
        password: password
        socket: /tmp/mysql.sock
    
  • Run migrations for the gem if you haven't done so:

      # For the test DB
      RAILS_ENV=test bundle exec statusbot-models db:create
      RAILS_ENV=test bundle exec statusbot-models db:migrate
    
    
      # For the default development DB
      bundle exec statusbot-models db:create
      bundle exec statusbot-models db:migrate
    
  • You are now ready to use this in your code:

      require 'statusbot/models'
      Statusbot::Models.connect
    
      ModelName.all
    

Development

This gem should only contain the models and the associated tests for those models. To run the tests do:

RAILS_ENV=test bundle exec rake spec

Contributing

  1. Fork it ( https://github.com/ejhayes/statusbot-models/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

statusbot-models's People

Contributors

ejhayes avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

jdrago999

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.