bigbrotha 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 46045c995bfeb93b271760f4046d1ed3da768d3d
4
+ data.tar.gz: bccb71bd3ff1644992694b73dd030740eadf6904
5
+ SHA512:
6
+ metadata.gz: 9b6351006443b831e6a41a867e3d79c464fd66b733a4ab759f4e764cf54b3d84f0c555163b297d472021c7df9cd3b3080bdbd274ea3803727de6961a640c5911
7
+ data.tar.gz: d52afa10ed55d5d1e868d4ccf028d17cf75ec73328ab9cfe7b3cad0b1c0c3a82527e10350b83f3ecdf80897b35dec5e5c4154ad25cd71fd125fe201aaa86739d
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+ .idea/*
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in big_brotha.gemspec
4
+ gemspec
5
+
6
+ # Active Admin is a Ruby on Rails framework for creating elegant backends for website administration
7
+ gem 'activeadmin', github: 'activeadmin'
8
+ gem 'active_admin_importable'
9
+ gem 'activerecord-import'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 WF | Snezhana Dichevska
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # Bigbrotha
2
+
3
+ Allows you to find taboo words, censor them and keep track of who created them.
4
+ Optionally you can generate ActiveAdmin pages to import taboo words and keep track of the generated TabooPosts.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'bigbrotha'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install bigbrotha
21
+
22
+ ## Usage
23
+
24
+ ### Initialization
25
+ In order to create migrations for the models and the setup file in initializers, use:
26
+ `bin/rails generate big_brotha:initializer`
27
+
28
+ #### Migrations
29
+ Running the migrations will generate tables for two models: Taboo and TabooPost.
30
+ - **Taboo**: is where all the taboo words are saved.
31
+ You can *Add* taboo word by calling the method `BigBrotha.add_taboo!(taboo_word)`.
32
+ *Remove* taboo by calling `BigBrotha.remove_taboo(taboo_word)`.
33
+ *Find* taboo object by calling `BigBrotha.find_taboo(taboo_word)`.
34
+ - **TabooPost**: where the content from the columns with taboos is saved, with reference to the user who created it and reference to all the taboos found in that content.
35
+
36
+ **!** Before you run `rake db:migrate` make sure you have a **User** model that TabooPost can reference.
37
+
38
+ #### Configuration
39
+ In *"config/initializers/bigbrother.rb"* you configure all the necessary places where checks for taboos need to be done.
40
+
41
+ Example configurations:
42
+ ```sh
43
+ BigBrotha.configure do |config|
44
+ config.add(User, :self, [:username, :comment], :after, :save)
45
+ config.add(Room, :creator, :message, :before, :update)
46
+ end
47
+ ```
48
+
49
+ In the **add** method you have to set the following parameters: **Model**, **:relation_name**, **:column_names**, **:timing**, **:event**
50
+
51
+ - **Model**: is the ActiveRecord model on which you want to append the callback function for taboo checks
52
+ - **relation_name**: is the name of the relation to the *User* model that will be saved as the creator of the taboo post.
53
+ The **:self** symbol can be passed **only** for the **User** model, where the **:create** event has to be called with timing **:after**, OTHERWISE *user_id* won't be added to the TabooPost object.
54
+ - **column_names**: are the names of the columns in the Model, that need to be checked for any taboos
55
+ - **timing**: indicates whether the callback is to be run :before, :after, or :around the event.
56
+ - **event**: indicates around which event (:save, :update, :create ... ) the callback is to be run.
57
+
58
+
59
+
60
+ ### ActiveAdmin
61
+ To create active admin pages for Taboos and TabooPosts run: `bin/rails generate big_brotha:active_admin`.
62
+
63
+ Optionally you can add a button for importing taboos in csv format. To do this, you have to add
64
+ `gem 'active_admin_importable'` to your Gemfile, run `bundle install` and uncomment in *"app/admin/taboo.rb"* the block that allows you this option.
65
+ The *csv files* in the first line, have to contain the word: **keyword**
66
+
67
+ You can edit the active admin pages as you want, for more info go to: [ActiveAdmin](https://github.com/activeadmin/activeadmin) and [ActiveAdmin importable](https://github.com/krhorst/active_admin_importable).
68
+
69
+ ### Full Example
70
+ 1.Configure
71
+ ```sh
72
+ BigBrotha.configure do |config|
73
+ config.add(User, :self, :username, :after, :save)
74
+ end
75
+ ```
76
+ 2.Add Taboos
77
+ ```sh
78
+ >> BigBrotha.add_taboo!("princess")
79
+ ```
80
+ 3.Create User
81
+ ```sh
82
+ >> user = User.create(username: "I'm princessita")
83
+ ```
84
+ 4.Result
85
+ ```sh
86
+ >> user.username
87
+ "I'm *******ita"
88
+ ```
89
+ 5.Check TabooPost
90
+ ```sh
91
+ >> BigBrotha::TabooPost.where(user: user)
92
+
93
+ #<BigBrotha::TabooPost id: 1, content: "I'm princessita", content_column: "User.username", user_id: 1>
94
+ ```
95
+ ## Additional methods
96
+ Censor class contains additional method which you can use to censor text.
97
+ ```sh
98
+ >> BigBrotha::Censor.censor_taboos_in_text("This is an example text with few taboos", ["example","taboo"])
99
+ "This is an ******* text with few *****s"
100
+ ```
101
+ ## Development
102
+
103
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
104
+
105
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
106
+
107
+ ## Contributing
108
+
109
+ Bug reports and pull requests are welcome on GitHub at https://github.com/SnezanaDichevska/bigbrotha. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
110
+
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
115
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bigbrotha.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bigbrotha/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bigbrotha"
8
+ spec.version = BigBrotha::VERSION
9
+ spec.authors = ["Snezhana Dichevska"]
10
+ spec.email = ["snezhana.dichevska@webfactory.mk"]
11
+
12
+ spec.summary = %q{Allows you to keep track of posts with taboo words and manage them through admin panel.}
13
+ spec.description = %q{You can censor all comments and descriptions and any string that should be censored and keep track of the posts that contain taboos and users that used them via admin panel.}
14
+ spec.homepage = "https://github.com/SnezanaDichevska/bigbrotha"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bigbrotha"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,64 @@
1
+
2
+ module BigBrotha
3
+ class Censor
4
+
5
+ # Class methods #
6
+
7
+ def self.censor_text!(user, post, content_column)
8
+
9
+ raise MissingParam.new("Missing parameter: :user") if user.blank?
10
+ raise MissingParam.new("Missing parameter: :content_column") if content_column.blank?
11
+ return post if post.nil?
12
+
13
+ censored_post = post
14
+ taboos = Taboo.all.to_a
15
+ words = post.split(/[\s]/).delete_if(&:blank?) #split by spaces
16
+ new_taboo_post = nil
17
+ all_appeared_taboos = []
18
+
19
+ words.each do |word|
20
+ appeared_taboos = find_taboos_in_text(word, taboos)
21
+
22
+ unless appeared_taboos.blank?
23
+ new_taboo_post = TabooPost.create(content: post, content_column: content_column, user_id: user.id) if new_taboo_post.blank?
24
+ all_appeared_taboos += appeared_taboos
25
+
26
+ #censor all taboos appearing in one word
27
+ censored_word = censor_taboos_in_text(word, appeared_taboos.map{|t| t.keyword})
28
+
29
+ #replace the word with taboos in the original post
30
+ censored_post = censored_post.gsub(word, censored_word)
31
+ end
32
+
33
+ end
34
+ new_taboo_post.set_taboos(all_appeared_taboos) unless new_taboo_post.blank?
35
+ censored_post
36
+ end
37
+
38
+
39
+ def self.find_taboos_in_text(text, taboos)
40
+ return nil if text.blank? or taboos.blank?
41
+ appeared_taboos = []
42
+ taboos.each do |taboo|
43
+ taboo_chars = taboo.keyword.scan(/./) #split the taboos word on chars
44
+ regex = ""
45
+ taboo_chars.each { |c| regex+="[#{c.downcase}|#{c.upcase}]" }
46
+ appeared_taboos << taboo unless (text =~ Regexp.new(regex)).blank?
47
+ end
48
+ return appeared_taboos
49
+ end
50
+
51
+
52
+ def self.censor_taboos_in_text(text, taboo_words)
53
+ taboo_words.each do |taboo|
54
+ taboo_chars = taboo.scan(/./)
55
+ regex = ""
56
+ taboo_chars.each { |c| regex+= "[#{c.downcase}|#{c.upcase}]" } #build the regex to match upcase and downcase letters
57
+ r = Regexp.new(regex)
58
+ text = text.gsub(r, "*" * taboo.size)
59
+ end
60
+ text
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,40 @@
1
+ module BigBrotha
2
+
3
+ class Config
4
+
5
+ #The argument :timing indicates whether the callback is to be run :before, :after the event(:save, :create, :update).
6
+ def add(model, creator_column, columns = [], timing, event)
7
+ raise NotActiveRecordModel.new unless model < ActiveRecord::Base
8
+ columns = Array(columns)
9
+ event = event.to_sym
10
+ timing = timing.to_sym
11
+
12
+ model.set_callback event, timing, ->(obj) {
13
+ changed_columns = event == :create ? columns : columns.map { |c| c.to_s } & obj.changed
14
+ censored_texts = {}
15
+
16
+ changed_columns.each do |column|
17
+ content_column = model.to_s + "." + column.to_s
18
+ creator = Config.get_value(obj, creator_column)
19
+ column_value = Config.get_value(obj, column)
20
+ censored_text = Censor.censor_text!(creator, column_value, content_column)
21
+ censored_texts[column] = censored_text
22
+ end
23
+
24
+ if timing == :after
25
+ obj.update_columns(censored_texts)
26
+ elsif timing == :before
27
+ censored_texts.each {|k,v| obj.send(k.to_s+"=", v)}
28
+ end
29
+ }
30
+
31
+ end
32
+
33
+ def self.get_value(obj, column)
34
+ column = column.to_sym
35
+ return obj if column == :self
36
+ obj.respond_to?(column) ? obj.send(column) : nil
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,39 @@
1
+ module BigBrotha
2
+
3
+ class Error < StandardError
4
+ def error
5
+ nil
6
+ end
7
+
8
+ def status
9
+ :bad_request
10
+ end
11
+
12
+ def message
13
+ nil
14
+ end
15
+ end
16
+
17
+ class NotActiveRecordModel < Error
18
+ def error
19
+ 'model_is_not_active_record'
20
+ end
21
+
22
+ def status
23
+ :bad_request
24
+ end
25
+ end
26
+
27
+ class MissingParam < Error
28
+ def error
29
+ 'missing_param'
30
+ end
31
+
32
+ def status
33
+ :bad_request
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
@@ -0,0 +1,18 @@
1
+ # create_table :taboos do |t|
2
+ # t.string :keyword
3
+ # t.timestamps
4
+ # end
5
+ module BigBrotha
6
+
7
+ class Taboo < ActiveRecord::Base
8
+
9
+ # Associations #
10
+ has_many :taboo_posts_taboos, dependent: :destroy
11
+ has_many :taboo_posts, through: :taboo_posts_taboos
12
+
13
+ # Validations #
14
+ validates :keyword, uniqueness: true, presence: true
15
+
16
+ end
17
+
18
+ end
@@ -0,0 +1,28 @@
1
+ # create_table :taboo_posts do |t|
2
+ # t.text :content
3
+ # t.string :content_column
4
+ # t.belongs_to :user
5
+ # t.timestamps
6
+ # end
7
+ module BigBrotha
8
+
9
+ class TabooPost < ActiveRecord::Base
10
+
11
+ # Associations #
12
+
13
+ belongs_to :user
14
+ has_many :taboo_posts_taboos, dependent: :destroy
15
+ has_many :taboos, through: :taboo_posts_taboos
16
+
17
+ def set_taboos(new_taboos)
18
+ taboos = []
19
+ new_taboos.try(:each) do |taboo|
20
+ up = TabooPostsTaboo.new(taboo_post: self, taboo: taboo)
21
+ taboos << up
22
+ end
23
+ TabooPostsTaboo.import taboos
24
+ self.reload
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,6 @@
1
+ module BigBrotha
2
+ class TabooPostsTaboo < ActiveRecord::Base
3
+ belongs_to :taboo_post
4
+ belongs_to :taboo
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module BigBrotha
2
+ VERSION = "0.1.13"
3
+ end
data/lib/bigbrotha.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'bigbrotha/version'
2
+ require 'bigbrotha/models/taboo'
3
+ require 'bigbrotha/models/taboo_post'
4
+ require 'bigbrotha/models/taboo_posts_taboo'
5
+ require 'bigbrotha/censor'
6
+ require 'bigbrotha/config'
7
+ require 'bigbrotha/errors'
8
+
9
+ module BigBrotha
10
+
11
+ def self.configure
12
+ yield(Config.new)
13
+ end
14
+
15
+ def self.add_taboo!(keyword)
16
+ Taboo.create!(keyword: keyword)
17
+ end
18
+
19
+ def self.remove_taboo(keyword)
20
+ Taboo.destroy_all(keyword: keyword)
21
+ end
22
+
23
+ def self.find_taboo(keyword)
24
+ Taboo.find_by(keyword: keyword)
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module BigBrotha
5
+ class ActiveAdminGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def create_activeadmin_models
10
+ template 'admin/taboo.rb', 'app/admin/taboo.rb'
11
+ template 'admin/taboo_post.rb', 'app/admin/taboo_post.rb'
12
+ end
13
+ end
14
+
15
+ end
@@ -0,0 +1,23 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
4
+ module BigBrotha
5
+ class InitializerGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ def self.next_migration_number(path)
10
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
11
+ end
12
+
13
+ def create_migrations
14
+ migration_template 'migrations/create_taboos_and_taboo_posts.rb', 'db/migrate/create_taboos_and_taboo_posts.rb'
15
+ end
16
+
17
+
18
+ def create_setup_file
19
+ template 'initializers/bigbrother.rb', 'config/initializers/bigbrother.rb'
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+
2
+ ActiveAdmin.register BigBrotha::Taboo, as: 'Taboo' do
3
+
4
+ menu :parent => "Taboos", :priority => 0
5
+ permit_params :keyword
6
+
7
+ filter :keyword
8
+ filter :created_at
9
+
10
+ #If you want the import option uncomment this code
11
+
12
+ # active_admin_importable do |model, hash|
13
+ # # The first row of the file has to be keyword
14
+ # model.create(keyword: hash[:keyword])
15
+ # end
16
+
17
+ end
@@ -0,0 +1,44 @@
1
+ ActiveAdmin.register BigBrotha::TabooPost, as: 'TabooPost' do
2
+
3
+ menu :parent => "Taboos", :priority => 1
4
+ config.filters = false
5
+ actions :all, :except => [:destroy, :edit]
6
+
7
+ index do
8
+ selectable_column
9
+ column :id
10
+ column :content
11
+ column :user do |taboo_post|
12
+ link_to(taboo_post.user.username, admin_user_path(taboo_post.user), :method => :get)
13
+ end
14
+ column :taboos do |taboo_post|
15
+ taboo_post.taboos.pluck(:keyword)
16
+ end
17
+ column :where do |taboo_post|
18
+ taboo_post.content_column
19
+ end
20
+ column :created_at
21
+ actions defaults: true do |taboo_post|
22
+ #change path(ban_admin_reported_user_path) to your path and method type when banning a user
23
+ # link_to('Ban User', ban_admin_reported_user_path(taboo_post.user), :method => :delete, :data => {:confirm => 'Are you sure?'})
24
+ end
25
+ end
26
+
27
+ show do |taboo_post|
28
+ attributes_table do
29
+ row :id
30
+ row :content
31
+ row :user do
32
+ link_to(taboo_post.user.username, admin_user_path(taboo_post.user), :method => :get)
33
+ end
34
+ row :taboos do
35
+ taboo_post.taboos.pluck(:keyword)
36
+ end
37
+ row :where do
38
+ taboo_post.content_column
39
+ end
40
+ row :created_at
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,11 @@
1
+
2
+ BigBrotha.configure do |config|
3
+
4
+ #The first argument (model) should be the ActiveRecord model that the callback should be appended to.
5
+ #The second argument (creator) should be the name of the field in the model that will be saved as the creator of the content with taboo.
6
+ #The third argument (columns) should be the name/ names of the columns in the model that need to be checked for taboos.
7
+ #The fourth argument (timing) indicates whether the callback is to be run :before, :after the event.
8
+ #The fifth argument (event) indicates around which event (:save, :update, :create) the callback is to be run.
9
+
10
+ # Example configuration: config.add(User, :self, [:username, :comment], :before, :save)
11
+ end
@@ -0,0 +1,21 @@
1
+ class CreateTaboosAndTabooPosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :taboos do |t|
4
+ t.string :keyword, null: false, unique: true
5
+ t.timestamps
6
+ end
7
+
8
+ create_table :taboo_posts do |t|
9
+ t.text :content, null: false
10
+ t.string :content_column
11
+ t.belongs_to :user
12
+ t.timestamps
13
+ end
14
+
15
+ create_join_table :taboo_posts, :taboos do |t|
16
+ t.index [:taboo_post_id, :taboo_id]
17
+ t.index [:taboo_id, :taboo_post_id]
18
+ end
19
+
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bigbrotha
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.13
5
+ platform: ruby
6
+ authors:
7
+ - Snezhana Dichevska
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: You can censor all comments and descriptions and any string that should
42
+ be censored and keep track of the posts that contain taboos and users that used
43
+ them via admin panel.
44
+ email:
45
+ - snezhana.dichevska@webfactory.mk
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - .gitignore
51
+ - CODE_OF_CONDUCT.md
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - bigbrotha.gemspec
57
+ - bin/console
58
+ - bin/setup
59
+ - lib/bigbrotha.rb
60
+ - lib/bigbrotha/censor.rb
61
+ - lib/bigbrotha/config.rb
62
+ - lib/bigbrotha/errors.rb
63
+ - lib/bigbrotha/models/taboo.rb
64
+ - lib/bigbrotha/models/taboo_post.rb
65
+ - lib/bigbrotha/models/taboo_posts_taboo.rb
66
+ - lib/bigbrotha/version.rb
67
+ - lib/generators/big_brotha/active_admin_generator.rb
68
+ - lib/generators/big_brotha/initializer_generator.rb
69
+ - lib/generators/big_brotha/templates/admin/taboo.rb
70
+ - lib/generators/big_brotha/templates/admin/taboo_post.rb
71
+ - lib/generators/big_brotha/templates/initializers/bigbrother.rb
72
+ - lib/generators/big_brotha/templates/migrations/create_taboos_and_taboo_posts.rb
73
+ homepage: https://github.com/SnezanaDichevska/bigbrotha
74
+ licenses:
75
+ - MIT
76
+ metadata:
77
+ allowed_push_host: https://rubygems.org
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.8
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Allows you to keep track of posts with taboo words and manage them through
98
+ admin panel.
99
+ test_files: []