<commit_before># Knowledge Base

[![Gem Version](https://img.shields.io/gem/v/knowledge_base.svg)](https://rubygems.org/gems/knowledge_base)
[![Build Status](https://img.shields.io/travis/hyperoslo/knowledge_base.svg)](https://travis-ci.org/hyperoslo/knowledge_base)
[![Dependency Status](https://img.shields.io/gemnasium/hyperoslo/knowledge_base.svg)](https://gemnasium.com/hyperoslo/knowledge_base)
[![Code Climate](https://img.shields.io/codeclimate/github/hyperoslo/knowledge_base.svg)](https://codeclimate.com/github/hyperoslo/knowledge_base)
[![Coverage Status](https://img.shields.io/coveralls/hyperoslo/knowledge_base.svg)](https://coveralls.io/r/hyperoslo/knowledge_base)

Knowledge Base is a bunch of models for Ruby on Rails that you probably need to build your own.

## Installation

Add this line to your application's Gemfile:

    gem 'knowledge_base'

... and then execute:

    $ bundle

Install and run the migrations:

    $ rake knowledge_base:install:migrations
    $ rake db:migrate

Configure your routes:

```ruby
# config/routes.rb

Rails.application.routes.draw do
  [...]

  mount KnowledgeBase::Engine, at: '/knowledge_base'
end
```

That's it, you're done!

## Usage

At its core, Knowledge Base is categories and articles. Its categories can have many articles,
and each article can be in many categories.

Articles consist of sections. Sections can be text, images, links, attachments and just about
anything else you can imagine. Knowledge Base ships with over a dozen kinds of sections already,
and you can check them out in `app/models/knowledge_base/sectionables/`.

### Seeds

Development seeds are a nice way to populate your database with dummy content for styling
and presentation purposes. You seed your database with categories and articles with a rake task:

```bash
$ rake knowledge_base:seed
```

... or include them in your own development seeds:

```ruby
# db/seeds/development.rb

require 'knowledge_base/seeds'
```

## Configuration

### CarrierWave

Some sections have images or files in them, and Knowledge Base uses [CarrierWave](https://github.com/carrierwaveuploader/carrierwave)
to upload them. It defaults to saving images to disk, but if you'd rather save them to the cloud you'll
have to configure it:

```ruby
# config/initializers/carrierwave.rb<commit_msg>Prune evil whitespace<commit_after># Knowledge Base

[![Gem Version](https://img.shields.io/gem/v/knowledge_base.svg)](https://rubygems.org/gems/knowledge_base)
[![Build Status](https://img.shields.io/travis/hyperoslo/knowledge_base.svg)](https://travis-ci.org/hyperoslo/knowledge_base)
[![Dependency Status](https://img.shields.io/gemnasium/hyperoslo/knowledge_base.svg)](https://gemnasium.com/hyperoslo/knowledge_base)
[![Code Climate](https://img.shields.io/codeclimate/github/hyperoslo/knowledge_base.svg)](https://codeclimate.com/github/hyperoslo/knowledge_base)
[![Coverage Status](https://img.shields.io/coveralls/hyperoslo/knowledge_base.svg)](https://coveralls.io/r/hyperoslo/knowledge_base)

Knowledge Base is a bunch of models for Ruby on Rails that you probably need to build your own.

## Installation

Add this line to your application's Gemfile:

    gem 'knowledge_base'

... and then execute:

    $ bundle

Install and run the migrations:

    $ rake knowledge_base:install:migrations
    $ rake db:migrate

Configure your routes:

```ruby
# config/routes.rb
Rails.application.routes.draw do
  [...]

  mount KnowledgeBase::Engine, at: '/knowledge_base'
end
```

That's it, you're done!

## Usage

At its core, Knowledge Base is categories and articles. Its categories can have many articles,
and each article can be in many categories.

Articles consist of sections. Sections can be text, images, links, attachments and just about
anything else you can imagine. Knowledge Base ships with over a dozen kinds of sections already,
and you can check them out in `app/models/knowledge_base/sectionables/`.

### Seeds

Development seeds are a nice way to populate your database with dummy content for styling
and presentation purposes. You seed your database with categories and articles with a rake task:

```bash
$ rake knowledge_base:seed
```

... or include them in your own development seeds:

```ruby
# db/seeds/development.rb
require 'knowledge_base/seeds'
```

## Configuration

### CarrierWave

Some sections have images or files in them, and Knowledge Base uses [CarrierWave](https://github.com/carrierwaveuploader/carrierwave)
to upload them. It defaults to saving images to disk, but if you'd rather save them to the cloud you'll
have to configure it:

```ruby
# config/initializers/carrierwave.rb
{'fraction_non_alphanumeric': 0.10866752910737387, 'fraction_numerical': 0.0, 'mean_word_length': 4.909554140127389, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 22, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '157629', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1356, 'n_words': 441}