acts_as_snapchat 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: 3aec3f8aa76320fc5b6b86c7fd5f522d7813bc76
4
+ data.tar.gz: 1215c725a4a244d582c03eae320389526150a3cd
5
+ SHA512:
6
+ metadata.gz: 08b61ccc67c8ab609066662dbf472b4f9f35974ba42b59e8cc06358edce08dbf55bf7a1779eaab350fa9ef9420d7b0cd37e6776e8c5493b99147f126bbfbd6d9
7
+ data.tar.gz: 864bd4c8e45c56621d0db341a6f6d5f465b1897b9ac0e3ccff6d322e93e93fa7102ddf1aac720a366db6a18d7aedb65077c3a6259ff44b05cffabbd7a5204a98
@@ -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 Gabe Scholz
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,43 @@
1
+ # acts_as_snapchat!!
2
+
3
+ Have you ever wanted Active Record to behave like Snapchat? **It's finally here!**
4
+ When a record is more than ten seconds old, it won't appear in any of your queries.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'acts_as_snapchat'
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ To make any model act as snapchat, just include `acts_as_snapchat` in your class definition:
17
+
18
+ ```ruby
19
+ class User < ActiveRecord::Base
20
+ acts_as_snapchat
21
+
22
+ # ...
23
+ end
24
+ ```
25
+
26
+ And then stuff will happen:
27
+
28
+ ```ruby
29
+ User.create!
30
+ User.count # => 1
31
+ sleep 10
32
+ User.count # => 0
33
+ ```
34
+
35
+ Note: If you're a Node.js developer, you may be more comfortable using the alias `acts_as_mongodb`. :trollface:
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/[my-github-username]/acts_as_snapchat/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake"
3
+ require "rake/testtask"
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.pattern = "test/**/*_test.rb"
7
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'acts_as_snapchat/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "acts_as_snapchat"
8
+ spec.version = ActsAsSnapchat::VERSION
9
+ spec.authors = ["Gabe Scholz", "Luke Cowell", "Godfrey Chan"]
10
+ spec.email = ["gabe@brewhouse.io"]
11
+ spec.summary = %q{Makes your Active Record models behave like content on Snapchat.}
12
+ spec.description = %q{Makes your Active Record models behave like content on Snapchat.}
13
+ spec.homepage = "https://www.github.com/vanruby/acts_as_snapchat"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(test)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "minitest", "~> 5.7"
23
+ spec.add_development_dependency "sqlite3", "~> 1.3"
24
+ spec.add_dependency "rails", "~> 4"
25
+ end
@@ -0,0 +1,2 @@
1
+ require "acts_as_snapchat/version"
2
+ require "acts_as_snapchat/railtie"
@@ -0,0 +1,29 @@
1
+ module ActsAsSnapchat
2
+ class Railtie < ::Rails::Railtie
3
+ initializer "acts_as_snapchat" do
4
+ ActiveSupport.on_load(:active_record) do
5
+
6
+ module ActsAsSnapchat
7
+ extend ::ActiveSupport::Concern
8
+
9
+ included do
10
+ default_scope { where("created_at > ?", 10.seconds.ago) }
11
+ end
12
+ end
13
+
14
+ class ActiveRecord::Base
15
+ class << self
16
+
17
+ def acts_as_snapchat
18
+ include ActsAsSnapchat
19
+ end
20
+
21
+ alias :acts_as_mongodb :acts_as_snapchat
22
+
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module ActsAsSnapchat
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,34 @@
1
+ require "minitest/autorun"
2
+ require "rails"
3
+ require "rails/all"
4
+ require "acts_as_snapchat"
5
+
6
+ class Application < ::Rails::Application; end
7
+ Rails.application.initialize!
8
+
9
+ connection_pool = ActiveRecord::Base.establish_connection(
10
+ adapter: "sqlite3",
11
+ database: ":memory:"
12
+ )
13
+
14
+ connection = connection_pool.connection
15
+
16
+ connection.create_table :users do |t|
17
+ t.timestamps null: false
18
+ end
19
+
20
+ class ActsAsSnapchatTest < MiniTest::Test
21
+
22
+ class User < ActiveRecord::Base
23
+ acts_as_snapchat
24
+ acts_as_mongodb # check that method is defined
25
+ end
26
+
27
+ def test_acting_as_snapchat
28
+ User.create!
29
+ assert(User.count, 1)
30
+ User.first.update!(created_at: 11.seconds.ago)
31
+ assert(User.count, 0)
32
+ end
33
+
34
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_snapchat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gabe Scholz
8
+ - Luke Cowell
9
+ - Godfrey Chan
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2015-06-03 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.6'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '1.6'
29
+ - !ruby/object:Gem::Dependency
30
+ name: rake
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '10.0'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '10.0'
43
+ - !ruby/object:Gem::Dependency
44
+ name: minitest
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '5.7'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '5.7'
57
+ - !ruby/object:Gem::Dependency
58
+ name: sqlite3
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '1.3'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '1.3'
71
+ - !ruby/object:Gem::Dependency
72
+ name: rails
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '4'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '4'
85
+ description: Makes your Active Record models behave like content on Snapchat.
86
+ email:
87
+ - gabe@brewhouse.io
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - ".gitignore"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - acts_as_snapchat.gemspec
98
+ - lib/acts_as_snapchat.rb
99
+ - lib/acts_as_snapchat/railtie.rb
100
+ - lib/acts_as_snapchat/version.rb
101
+ - test/acts_as_snapchat_test.rb
102
+ homepage: https://www.github.com/vanruby/acts_as_snapchat
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.4.1
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: Makes your Active Record models behave like content on Snapchat.
126
+ test_files:
127
+ - test/acts_as_snapchat_test.rb