cleanup_sessions 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in clear_sessions.gemspec
4
+ gemspec
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cleanup_sessions/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "cleanup_sessions"
7
+ s.version = CleanupSessions::VERSION
8
+ s.authors = ["Krzysztof Sakwerda"]
9
+ s.email = ["ksakwerda@gmail.com"]
10
+ s.homepage = "https://github.com/simplificator/cleanup_sessions"
11
+ s.summary = "Session cleaner for rails applications"
12
+ s.description = "It adds cleanup:sessions task to your rake tasks which deletes sessions older than a month"
13
+
14
+ s.rubyforge_project = "cleanup_sessions"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "rake"
22
+ s.add_dependency "rails", ">= 3.0"
23
+ end
@@ -0,0 +1,9 @@
1
+ require "cleanup_sessions/version"
2
+
3
+ module CleanupSessions
4
+ class CleanupSessionsLoader < Rails::Railtie
5
+ rake_tasks do
6
+ Dir[ File.join File.dirname(__FILE__), "tasks", "*.rake" ].each{ |ext| load ext }
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module CleanupSessions
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,13 @@
1
+ namespace :cleanup do
2
+ desc "cleanup sessions (sessions from last month are left)"
3
+ task :sessions => :environment do
4
+ puts "\e[1;33mDeleting old sessions\e[0m"
5
+ sql = <<-SQL
6
+ DELETE FROM sessions
7
+ WHERE updated_at < date('#{(Time.now.months_ago 1).strftime("%y-%m-%d %H:%M:%S")}');;
8
+ SQL
9
+ ActiveRecord::Base.establish_connection
10
+ ActiveRecord::Base.connection.execute(sql)
11
+ puts "\e[1;32mOld sessions were deleted\e[0m"
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cleanup_sessions
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Krzysztof Sakwerda
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-10-11 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rails
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 7
43
+ segments:
44
+ - 3
45
+ - 0
46
+ version: "3.0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ description: It adds cleanup:sessions task to your rake tasks which deletes sessions older than a month
50
+ email:
51
+ - ksakwerda@gmail.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files: []
57
+
58
+ files:
59
+ - .gitignore
60
+ - Gemfile
61
+ - Rakefile
62
+ - cleanup_sessions.gemspec
63
+ - lib/cleanup_sessions.rb
64
+ - lib/cleanup_sessions/version.rb
65
+ - lib/tasks/cleanup.rake
66
+ homepage: https://github.com/simplificator/cleanup_sessions
67
+ licenses: []
68
+
69
+ post_install_message:
70
+ rdoc_options: []
71
+
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ hash: 3
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ requirements: []
93
+
94
+ rubyforge_project: cleanup_sessions
95
+ rubygems_version: 1.8.11
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: Session cleaner for rails applications
99
+ test_files: []
100
+