memdash-activerecord 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/memdash/active_record_generator.rb +17 -0
- data/lib/generators/memdash/templates/migration.rb +12 -0
- data/lib/memdash-active_record.rb +1 -0
- data/lib/memdash/adapters/active_record.rb +4 -0
- data/lib/memdash/adapters/active_record/client.rb +15 -0
- data/lib/memdash/adapters/active_record/report.rb +17 -0
- metadata +85 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails/generators/migration'
|
2
|
+
require 'rails/generators/active_record/migration'
|
3
|
+
|
4
|
+
module Memdash
|
5
|
+
module Generators
|
6
|
+
class ActiveRecordGenerator < Rails::Generators::Base
|
7
|
+
include Rails::Generators::Migration
|
8
|
+
extend ActiveRecord::Generators::Migration
|
9
|
+
|
10
|
+
self.source_paths << File.join(File.dirname(__FILE__), 'templates')
|
11
|
+
|
12
|
+
def create_migration_file
|
13
|
+
migration_template 'migration.rb', 'db/migrate/create_memdash_active_record_reports.rb'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'memdash/adapters/active_record'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'memdash/adapters/active_record/report'
|
2
|
+
|
3
|
+
module Memdash
|
4
|
+
module Adapters
|
5
|
+
module ActiveRecord
|
6
|
+
module Client
|
7
|
+
def generate_stats
|
8
|
+
Memdash::Adapters::ActiveRecord::Report.create!(:stats => stats)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Dalli::Client.send(:include, Memdash::Adapters::ActiveRecord::Client)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
module Memdash
|
4
|
+
module Adapters
|
5
|
+
module ActiveRecord
|
6
|
+
class Report < ::ActiveRecord::Base
|
7
|
+
self.table_name = :memdash_reports
|
8
|
+
|
9
|
+
serialize :stats
|
10
|
+
|
11
|
+
def self.past_day
|
12
|
+
where('created_at >= :time', :time => Time.current - 1.day)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: memdash-activerecord
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brian Ryckbost
|
9
|
+
- Steve Richert
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-05-04 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: memdash
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - '='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.1.0
|
23
|
+
prerelease:
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - '='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.1.0
|
32
|
+
prerelease:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activerecord
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
none: false
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.0'
|
49
|
+
description: A dashboard for your memcached, storing data in ActiveRecord.
|
50
|
+
email: bryckbost@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- lib/generators/memdash/active_record_generator.rb
|
56
|
+
- lib/generators/memdash/templates/migration.rb
|
57
|
+
- lib/memdash-active_record.rb
|
58
|
+
- lib/memdash/adapters/active_record.rb
|
59
|
+
- lib/memdash/adapters/active_record/client.rb
|
60
|
+
- lib/memdash/adapters/active_record/report.rb
|
61
|
+
homepage: https://github.com/bryckbost/memdash
|
62
|
+
licenses: []
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 1.8.21
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: A dashboard for your memcached, storing data in ActiveRecord.
|
85
|
+
test_files: []
|