devise_lastseenable-0.0.6/0000755000004100000410000000000012560074540015551 5ustar www-datawww-datadevise_lastseenable-0.0.6/Rakefile0000644000004100000410000000202412560074540017214 0ustar www-datawww-datarequire 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'jeweler' Jeweler::Tasks.new do |gem| # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options gem.name = "devise_lastseenable" gem.homepage = "http://github.com/ctide/devise_lastseenable" gem.license = "MIT" gem.summary = "This ensures that devise will update a last_seen flag on the model whenever you check if a user is authed." gem.description = "This ensures that devise will update a last_seen flag on the model whenever you check if a user is authed." gem.email = "christide@christide.com" gem.authors = ["ctide"] end Jeweler::RubygemsDotOrgTasks.new require 'rake/testtask' Rake::TestTask.new(:test) do |test| test.libs << 'lib' << 'test' test.pattern = 'test/**/test_*.rb' test.verbose = true end task :default => :test devise_lastseenable-0.0.6/Gemfile0000644000004100000410000000022612560074540017044 0ustar www-datawww-datasource "http://rubygems.org" gem 'rails', ">= 3.0.4" gem 'devise' group :development do gem "shoulda", ">= 0" gem "bundler" gem "jeweler" end devise_lastseenable-0.0.6/LICENSE.txt0000644000004100000410000000203112560074540017370 0ustar www-datawww-dataCopyright (c) 2011 ctide Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. devise_lastseenable-0.0.6/README.rdoc0000644000004100000410000000103112560074540017352 0ustar www-datawww-data= devise_lastseenable This ensures that devise[http://github.com/plataformatec/devise] will update a last_seen flag on the model whenever you check if a user is authed. == Usage rails g devise_lastseenable In your model, add :lastseenable as such: class User < ActiveRecord::Base devise ..., :lastseenable end == Thanks to Thanks to devise_traceable[https://github.com/shenoudab/devise_traceable] for essentially operating as the base for this gem! == Copyright Copyright (c) 2011 ctide. See LICENSE.txt for further details. devise_lastseenable-0.0.6/lib/0000755000004100000410000000000012560074540016317 5ustar www-datawww-datadevise_lastseenable-0.0.6/lib/generators/0000755000004100000410000000000012560074540020470 5ustar www-datawww-datadevise_lastseenable-0.0.6/lib/generators/devise_lastseenable/0000755000004100000410000000000012560074540024471 5ustar www-datawww-datadevise_lastseenable-0.0.6/lib/generators/devise_lastseenable/templates/0000755000004100000410000000000012560074540026467 5ustar www-datawww-datadevise_lastseenable-0.0.6/lib/generators/devise_lastseenable/templates/migration.rb0000644000004100000410000000036612560074540031012 0ustar www-datawww-dataclass DeviseAddLastseenable<%= table_name.camelize.singularize %> < ActiveRecord::Migration def self.up add_column :<%= table_name %>, :last_seen, :datetime end def self.down remove_column :<%= table_name %>, :last_seen end enddevise_lastseenable-0.0.6/lib/generators/devise_lastseenable/devise_lastseenable_generator.rb0000644000004100000410000000144312560074540033067 0ustar www-datawww-datarequire 'rails/generators/migration' class DeviseLastseenableGenerator < Rails::Generators::NamedBase include Rails::Generators::Migration def self.source_root @_devise_source_root ||= File.expand_path("../templates", __FILE__) end def self.orm_has_migration? Rails::Generators.options[:rails][:orm] == :active_record end def self.next_migration_number(dirname) if ActiveRecord::Base.timestamped_migrations Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end class_option :orm class_option :migration, :type => :boolean, :default => orm_has_migration? def create_migration_file migration_template 'migration.rb', "db/migrate/devise_add_lastseenable_#{name.downcase}.rb" end protected enddevise_lastseenable-0.0.6/lib/devise_lastseenable/0000755000004100000410000000000012560074540022320 5ustar www-datawww-datadevise_lastseenable-0.0.6/lib/devise_lastseenable/model.rb0000644000004100000410000000043212560074540023744 0ustar www-datawww-datarequire 'devise_lastseenable/hooks/lastseenable' module Devise module Models module Lastseenable def stamp! if self.last_seen.to_i < (Time.now - 5.minutes).to_i self.last_seen = DateTime.now self.save! end end end end enddevise_lastseenable-0.0.6/lib/devise_lastseenable/hooks/0000755000004100000410000000000012560074540023443 5ustar www-datawww-datadevise_lastseenable-0.0.6/lib/devise_lastseenable/hooks/lastseenable.rb0000644000004100000410000000016512560074540026434 0ustar www-datawww-dataWarden::Manager.after_set_user do |record, warden, opts| if record.respond_to?(:stamp!) record.stamp! end enddevise_lastseenable-0.0.6/lib/devise_lastseenable/version.rb0000644000004100000410000000007012560074540024327 0ustar www-datawww-datamodule DeviseLastseenable VERSION = "0.0.3".freeze enddevise_lastseenable-0.0.6/lib/devise_lastseenable/rails.rb0000644000004100000410000000014312560074540023755 0ustar www-datawww-datarequire 'devise_lastseenable' module DeviseLastseenable class Engine < ::Rails::Engine end enddevise_lastseenable-0.0.6/lib/devise_lastseenable.rb0000644000004100000410000000033012560074540022641 0ustar www-datawww-dataunless defined?(Devise) require 'devise' end require 'devise_lastseenable' Devise.add_module :lastseenable, :model => 'devise_lastseenable/model' module DeviseLastseenable end require 'devise_lastseenable/rails'devise_lastseenable-0.0.6/metadata.yml0000644000004100000410000000646012560074540020062 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: devise_lastseenable version: !ruby/object:Gem::Version version: 0.0.6 platform: ruby authors: - ctide autorequire: bindir: bin cert_chain: [] date: 2015-07-27 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rails requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 3.0.4 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 3.0.4 - !ruby/object:Gem::Dependency name: devise requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: shoulda requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' - !ruby/object:Gem::Dependency name: jeweler requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' description: This ensures that devise will update a last_seen flag on the model whenever you check if a user is authed. email: christide@christide.com executables: [] extensions: [] extra_rdoc_files: - LICENSE.txt - README.rdoc files: - ".document" - Gemfile - LICENSE.txt - README.rdoc - Rakefile - VERSION - devise_lastseenable.gemspec - lib/devise_lastseenable.rb - lib/devise_lastseenable/hooks/lastseenable.rb - lib/devise_lastseenable/model.rb - lib/devise_lastseenable/rails.rb - lib/devise_lastseenable/version.rb - lib/generators/devise_lastseenable/devise_lastseenable_generator.rb - lib/generators/devise_lastseenable/templates/migration.rb - test/helper.rb - test/test_devise_lastseenable.rb homepage: http://github.com/ctide/devise_lastseenable licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.5 signing_key: specification_version: 4 summary: This ensures that devise will update a last_seen flag on the model whenever you check if a user is authed. test_files: [] devise_lastseenable-0.0.6/test/0000755000004100000410000000000012560074540016530 5ustar www-datawww-datadevise_lastseenable-0.0.6/test/helper.rb0000644000004100000410000000067012560074540020337 0ustar www-datawww-datarequire 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'test/unit' require 'shoulda' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'devise_lastseenable' class Test::Unit::TestCase end devise_lastseenable-0.0.6/test/test_devise_lastseenable.rb0000644000004100000410000000035212560074540024115 0ustar www-datawww-datarequire 'helper' class TestDeviseLastseenable < Test::Unit::TestCase should "probably rename this file and start testing for real" do flunk "hey buddy, you should probably rename this file and start testing for real" end end devise_lastseenable-0.0.6/VERSION0000644000004100000410000000000512560074540016614 0ustar www-datawww-data0.0.6devise_lastseenable-0.0.6/devise_lastseenable.gemspec0000644000004100000410000000456112560074540023125 0ustar www-datawww-data# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: devise_lastseenable 0.0.6 ruby lib Gem::Specification.new do |s| s.name = "devise_lastseenable" s.version = "0.0.6" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.require_paths = ["lib"] s.authors = ["ctide"] s.date = "2015-07-27" s.description = "This ensures that devise will update a last_seen flag on the model whenever you check if a user is authed." s.email = "christide@christide.com" s.extra_rdoc_files = [ "LICENSE.txt", "README.rdoc" ] s.files = [ ".document", "Gemfile", "LICENSE.txt", "README.rdoc", "Rakefile", "VERSION", "devise_lastseenable.gemspec", "lib/devise_lastseenable.rb", "lib/devise_lastseenable/hooks/lastseenable.rb", "lib/devise_lastseenable/model.rb", "lib/devise_lastseenable/rails.rb", "lib/devise_lastseenable/version.rb", "lib/generators/devise_lastseenable/devise_lastseenable_generator.rb", "lib/generators/devise_lastseenable/templates/migration.rb", "test/helper.rb", "test/test_devise_lastseenable.rb" ] s.homepage = "http://github.com/ctide/devise_lastseenable" s.licenses = ["MIT"] s.rubygems_version = "2.4.5" s.summary = "This ensures that devise will update a last_seen flag on the model whenever you check if a user is authed." if s.respond_to? :specification_version then s.specification_version = 4 if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, [">= 3.0.4"]) s.add_runtime_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) s.add_development_dependency(%q, [">= 0"]) else s.add_dependency(%q, [">= 3.0.4"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end else s.add_dependency(%q, [">= 3.0.4"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) s.add_dependency(%q, [">= 0"]) end end devise_lastseenable-0.0.6/.document0000644000004100000410000000006712560074540017373 0ustar www-datawww-datalib/**/*.rb bin/* - features/**/*.feature LICENSE.txt