feedifier 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34459f7e30ce671c1e2d3fbda19e8b83397c9d76
4
+ data.tar.gz: 4549a35bb6215e2616103cc0e092498ae11640a0
5
+ SHA512:
6
+ metadata.gz: 3a64166a1a8a304a5dbcedc078d73b875221da2b596baa53b9d9fa9a30ac49f6ab5092b9b8037d7efde9463fb878ee993058be4660f4ef2ad2ca2efffbf828e7
7
+ data.tar.gz: 996f63481efc69eb52a53bd1f71a3202ae7c47d16945ed67d370c36875382c842121603cad1f93b262b1c9a71baf02ac19f56edb09ea774d38f7ed1288f31df0
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Pat Allan and Inspire9
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Feedifier
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'feedifier'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install feedifier
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/feedifier/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,12 @@
1
+ class Feedifier::Feed < ActiveRecord::Base
2
+ self.table_name = 'feedifier_feeds'
3
+
4
+ belongs_to :feedable, polymorphic: true
5
+ has_many :feed_items, class_name: 'Feedifier::FeedItem',
6
+ foreign_key: :feedifier_feed_id, dependent: :destroy
7
+
8
+ validates :name, presence: true,
9
+ uniqueness: {scope: [:feedable_type, :feedable_id]}
10
+
11
+ scope :for_names, lambda { |names| where name: names }
12
+ end
@@ -0,0 +1,17 @@
1
+ class Feedifier::FeedItem < ActiveRecord::Base
2
+ self.table_name = 'feedifier_feed_items'
3
+
4
+ belongs_to :feed, class_name: 'Feedifier::Feed',
5
+ foreign_key: :feedifier_feed_id
6
+ belongs_to :event, class_name: 'Eventifier::Event',
7
+ foreign_key: :eventifier_event_id
8
+
9
+ validates :feed, presence: true
10
+ validates :event, presence: true
11
+ validates :happened_at, presence: true
12
+ validates :eventifier_event_id, uniqueness: {scope: :feedifier_feed_id}
13
+
14
+ scope :for_user, lambda { |user|
15
+ where user_type: user.class.name, user_id: user.id
16
+ }
17
+ end
@@ -0,0 +1,29 @@
1
+ class CreateFeedsAndFeedItems < ActiveRecord::Migration
2
+ def change
3
+ create_table :feedifier_feeds do |t|
4
+ t.string :name, null: false
5
+ t.string :feedable_type
6
+ t.integer :feedable_id
7
+ t.timestamps null: false
8
+ end
9
+
10
+ add_index :feedifier_feeds, [:name, :feedable_type, :feedable_id],
11
+ unique: true
12
+
13
+ create_table :feedifier_feed_items do |t|
14
+ t.integer :feedifier_feed_id, null: false
15
+ t.integer :eventifier_event_id, null: false
16
+ t.string :user_type
17
+ t.integer :user_id
18
+ t.datetime :happened_at, null: false
19
+ t.timestamps null: false
20
+ end
21
+
22
+ add_index :feedifier_feed_items, :feedifier_feed_id
23
+ add_index :feedifier_feed_items,
24
+ [:feedifier_feed_id, :eventifier_event_id], unique: true,
25
+ name: :unique_feed_items
26
+ add_index :feedifier_feed_items, [:user_type, :user_id]
27
+ add_index :feedifier_feed_items, :happened_at, order: {happened_at: :desc}
28
+ end
29
+ end
@@ -0,0 +1,15 @@
1
+ # coding: utf-8
2
+ Gem::Specification.new do |spec|
3
+ spec.name = "feedifier"
4
+ spec.version = '0.0.1'
5
+ spec.authors = ["Pat Allan"]
6
+ spec.email = ["pat@freelancing-gods.com"]
7
+ spec.summary = %q{Feed engine for Rails}
8
+ spec.homepage = 'https://github.com/inspire9/feedifier'
9
+ spec.license = 'MIT'
10
+
11
+ spec.files = `git ls-files -z`.split("\x0")
12
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
14
+ spec.require_paths = ["lib"]
15
+ end
@@ -0,0 +1,5 @@
1
+ module Feedifier
2
+ #
3
+ end
4
+
5
+ require 'feedifier/engine'
@@ -0,0 +1,3 @@
1
+ class Feedifier::Engine < Rails::Engine
2
+ engine_name :feedifier
3
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: feedifier
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pat Allan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - pat@freelancing-gods.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - app/models/feedifier/feed.rb
26
+ - app/models/feedifier/feed_item.rb
27
+ - db/migrate/1_create_feeds_and_feed_items.rb
28
+ - feedifier.gemspec
29
+ - lib/feedifier.rb
30
+ - lib/feedifier/engine.rb
31
+ homepage: https://github.com/inspire9/feedifier
32
+ licenses:
33
+ - MIT
34
+ metadata: {}
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project:
51
+ rubygems_version: 2.2.2
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Feed engine for Rails
55
+ test_files: []
56
+ has_rdoc: