memdash 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,3 +3,4 @@ rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
5
  - ruby-head
6
+ env: ADAPTER=active_record
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
1
+ source 'http://rubygems.org'
2
2
 
3
- gemspec
3
+ gemspec :name => 'memdash'
data/README.md CHANGED
@@ -39,11 +39,13 @@ To view the dashboard, you'll need to add `require 'memdash/server'` to `config/
39
39
  mount Memdash::Server.new, :at => "/memdash"
40
40
  end
41
41
 
42
- ## Why Did I Build This?
42
+ ## What's the point?
43
43
 
44
- Memdash is meant to give you insight into your memcached setup without adding overhead to your application. I found it useful when deploying apps to Heroku where the memcached add-on is a bit of a black box. Stuff goes in, stuff comes out. Hopefully, it's being used effectively.
44
+ Memdash is meant to give you insight into your memcached setup without adding overhead to your application or relying on a background process.
45
45
 
46
- ## How Does it Work???
46
+ I find it useful when deploying apps to Heroku, where the memcached add-on is a bit of a black box. Stuff goes in, stuff comes out. Hopefully, it's being used effectively. Memdash could fill the gap between not having any statistics and having to send custom data to Scout, New Relic or statsd.
47
+
48
+ ## How Does it Work?
47
49
 
48
50
  Building on top of [Dalli](https://github.com/mperham/dalli), Memdash hooks into Dalli's chokepoint method to generate statistics.
49
51
 
data/Rakefile CHANGED
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env rake
2
2
 
3
- require 'bundler/gem_tasks'
3
+ require 'bundler/gem_helper'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
- ADAPTERS = %w(active_record)
6
+ Bundler::GemHelper.install_tasks(:name => 'memdash')
7
+ Bundler::GemHelper.install_tasks(:name => 'memdash-activerecord')
8
+ Bundler::GemHelper.install_tasks(:name => 'memdash-mongo_mapper')
9
+
10
+ ADAPTERS = %w(active_record mongo_mapper)
7
11
 
8
12
  task :default => :test
9
13
 
data/config.ru CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'logger'
3
-
4
3
  require 'memdash/server'
5
4
 
6
5
  use Rack::ShowExceptions
@@ -3,6 +3,7 @@ module Memdash
3
3
  DEFAULT_TTL = 60
4
4
 
5
5
  attr_writer :ttl
6
+ attr_accessor :backend
6
7
 
7
8
  def ttl
8
9
  @ttl ||= DEFAULT_TTL
@@ -0,0 +1,11 @@
1
+ module Memdash
2
+ module Report
3
+ def self.last
4
+ Memdash.backend.last
5
+ end
6
+
7
+ def self.past_day
8
+ Memdash.backend.past_day
9
+ end
10
+ end
11
+ end
@@ -1,6 +1,6 @@
1
1
  require 'sinatra/base'
2
2
  require 'erb'
3
- require 'memdash/active_record'
3
+ require 'memdash/report'
4
4
 
5
5
  module Memdash
6
6
  class Server < Sinatra::Base
@@ -32,18 +32,25 @@ module Memdash
32
32
  def miss_ratio_percentage(hits, misses)
33
33
  miss_ratio(hits, misses) * 100
34
34
  end
35
+
36
+ def hit_ratio_percentage(hits, misses)
37
+ hit_ratio(hits, misses) * 100
38
+ end
35
39
  end
36
40
 
37
41
  get "/" do
38
- @last_report = Memdash::ActiveRecord::Report.last
39
- past_day = Memdash::ActiveRecord::Report.past_day
42
+ @last_report = Memdash::Report.last
43
+ past_day = Memdash::Report.past_day
40
44
  @gets = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["cmd_get"].to_i]}}
41
45
  @sets = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["cmd_set"].to_i]}}
42
46
  @hits = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["get_hits"].to_i]}}
43
47
  @misses = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["get_misses"].to_i]}}
44
- @limit_maxbytes = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), (v["limit_maxbytes"].to_i / 1024.0 / 1024.0).round(2)]}}
48
+ @delete_hits = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["delete_hits"].to_i]}}
49
+ @delete_misses = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["delete_misses"].to_i]}}
50
+ @engine_maxbytes = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), (v["engine_maxbytes"].to_i / 1024.0 / 1024.0).round(2)]}}
45
51
  @bytes = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), (v["bytes"].to_i / 1024.0 / 1024.0).round(2)]}}
46
52
  @current_items = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["curr_items"].to_i]}}
53
+ @evictions = past_day.flat_map{|report| report.stats.map{|_, v| [report.created_at.strftime("%m-%d-%Y %I:%M%p"), v["evictions"].to_i]}}
47
54
  erb :overview, :layout => :application
48
55
  end
49
56
  end
@@ -15,6 +15,9 @@ $(document).ready(function(){
15
15
  min: $("#gets-sets").data("gets")[0][0],
16
16
  max: $("#gets-sets").data("gets")[$("#gets-sets").data("gets").length - 1][0],
17
17
  tickInterval: "2 hours",
18
+ },
19
+ yaxis: {
20
+ pad: 1
18
21
  }
19
22
  },
20
23
  seriesDefaults: {
@@ -27,11 +30,12 @@ $(document).ready(function(){
27
30
  {label: 'Sets', showMarker: false},
28
31
  ],
29
32
  legend: {
30
- show: true
33
+ show: true,
34
+ location: "nw"
31
35
  },
32
36
  seriesColors: ["rgb(36, 173, 227)", "rgb(227, 36, 132)"]
33
37
  });
34
- $.jqplot('hits-misses', [$("#hits-misses").data("hits"), $("#hits-misses").data("misses")], {
38
+ $.jqplot('hits-misses', [$("#hits-misses").data("hits"), $("#hits-misses").data("misses"), $("#hits-misses").data("delete-hits"), $("#hits-misses").data("delete-misses")], {
35
39
  title: 'Hits & Misses for the Past Day',
36
40
  grid: {
37
41
  drawBorder: false,
@@ -49,7 +53,8 @@ $(document).ready(function(){
49
53
  tickInterval: "2 hours",
50
54
  },
51
55
  yaxis: {
52
- rendererOptions: { forceTickAt0: true, forceTickAt100: true }
56
+ rendererOptions: { forceTickAt0: true, forceTickAt100: true },
57
+ pad: 1
53
58
  }
54
59
 
55
60
  },
@@ -59,15 +64,18 @@ $(document).ready(function(){
59
64
  }
60
65
  },
61
66
  series: [
62
- {label: 'Hits', showMarker: false},
63
- {label: 'Misses', showMarker: false}
67
+ {label: 'Get Hits', showMarker: false},
68
+ {label: 'Get Misses', showMarker: false},
69
+ {label: 'Delete Hits', showMarker: false},
70
+ {label: 'Delete Misses', showMarker: false}
64
71
  ],
65
72
  legend: {
66
- show: true
73
+ show: true,
74
+ location: "nw"
67
75
  },
68
- seriesColors: ["rgb(227, 36, 132)", "rgb(227, 193, 36)"]
76
+ seriesColors: ["rgb(227, 36, 132)", "rgb(227, 193, 36)","rgb(36, 173, 227)", "rgb(199, 255, 25)"]
69
77
  });
70
- $.jqplot('memory-usage', [$("#memory-usage").data("limit-maxbytes"), $("#memory-usage").data("bytes")], {
78
+ $.jqplot('memory-usage', [$("#memory-usage").data("engine-maxbytes"), $("#memory-usage").data("bytes")], {
71
79
  title: 'Cache Memory for the Past Day',
72
80
  grid: {
73
81
  drawBorder: false,
@@ -80,9 +88,12 @@ $(document).ready(function(){
80
88
  tickOptions: {
81
89
  formatString:'%#I %p'
82
90
  },
83
- min: $("#memory-usage").data("limit-maxbytes")[0][0],
84
- max: $("#memory-usage").data("limit-maxbytes")[$("#memory-usage").data("limit-maxbytes").length - 1][0],
91
+ min: $("#memory-usage").data("engine-maxbytes")[0][0],
92
+ max: $("#memory-usage").data("engine-maxbytes")[$("#memory-usage").data("engine-maxbytes").length - 1][0],
85
93
  tickInterval: "2 hours",
94
+ },
95
+ yaxis: {
96
+ pad: 1
86
97
  }
87
98
  },
88
99
  seriesDefaults: {
@@ -95,7 +106,8 @@ $(document).ready(function(){
95
106
  {label: 'Used (MB)', showMarker: false}
96
107
  ],
97
108
  legend: {
98
- show: true
109
+ show: true,
110
+ location: "nw"
99
111
  },
100
112
  seriesColors: ["rgb(227, 193, 36)", "rgb(36, 173, 227)"]
101
113
  });
@@ -117,7 +129,8 @@ $(document).ready(function(){
117
129
  tickInterval: "2 hours",
118
130
  },
119
131
  yaxis: {
120
- rendererOptions: { forceTickAt0: true, forceTickAt100: true }
132
+ rendererOptions: { forceTickAt0: true, forceTickAt100: true },
133
+ pad: 1
121
134
  }
122
135
  },
123
136
  seriesDefaults: {
@@ -129,8 +142,45 @@ $(document).ready(function(){
129
142
  {label: 'Items', showMarker: false},
130
143
  ],
131
144
  legend: {
132
- show: true
145
+ show: true,
146
+ location: "nw"
133
147
  },
134
148
  seriesColors: ["rgb(227, 193, 36)"]
135
149
  });
150
+ $.jqplot('evictions', [$("#evictions").data("evictions")], {
151
+ title: 'Evictions over the Past Day',
152
+ grid: {
153
+ drawBorder: false,
154
+ shadow: false,
155
+ background: '#fefefe'
156
+ },
157
+ axes:{
158
+ xaxis:{
159
+ renderer: $.jqplot.DateAxisRenderer,
160
+ tickOptions: {
161
+ formatString:'%#I %p'
162
+ },
163
+ min: $("#evictions").data("evictions")[0][0],
164
+ max: $("#evictions").data("evictions")[$("#evictions").data("evictions").length - 1][0],
165
+ tickInterval: "2 hours",
166
+ },
167
+ yaxis: {
168
+ rendererOptions: { forceTickAt0: true, forceTickAt100: true },
169
+ pad: 1
170
+ }
171
+ },
172
+ seriesDefaults: {
173
+ rendererOptions: {
174
+ smooth: true,
175
+ }
176
+ },
177
+ series: [
178
+ {label: 'Items', showMarker: false},
179
+ ],
180
+ legend: {
181
+ show: true,
182
+ location: "nw"
183
+ },
184
+ seriesColors: ["rgb(227, 36, 132)"]
185
+ });
136
186
  });
@@ -1,19 +1,23 @@
1
1
  <div class="hero-stats">
2
2
  <ol class="row">
3
- <li class="span4"><span class="count"><%= miss_ratio_percentage(@last_report.stats.map{|_, v| v["get_hits"].to_f}.sum, @last_report.stats.map{|_, v| v["get_misses"].to_f}.sum).round(2) %>%</span>Cache miss ratio</li>
3
+ <li class="span4"><span class="count"><%= hit_ratio_percentage(@last_report.stats.map{|_, v| v["get_hits"].to_f}.sum, @last_report.stats.map{|_, v| v["get_misses"].to_f}.sum).round(2) %>%</span>Cache hit rate</li>
4
4
  <li class="span4"><span class="count"><%= @last_report.stats.map{|_, v| v["curr_items"]}.sum %></span>Current items in memcache</li>
5
- <li class="span4"><span class="count"><%= (@last_report.stats.map{|_,v| v["bytes"].to_i}.sum / 1024.0 / 1024.0).round(2) %>/<%= @last_report.stats.map{|_,v| v["limit_maxbytes"].to_i}.sum / 1024 / 1024 %> MB</span>Current memory usage</li>
5
+ <li class="span4"><span class="count"><%= (@last_report.stats.map{|_,v| v["bytes"].to_i}.sum / 1024.0 / 1024.0).round(2) %>/<%= @last_report.stats.map{|_,v| v["engine_maxbytes"].to_i}.sum / 1024 / 1024 %> MB</span>Current memory usage</li>
6
6
  </ol>
7
7
  </div>
8
8
 
9
9
  <section class="container">
10
10
  <div class="row">
11
11
  <div id="gets-sets" class="span6" data-gets='<%= @gets %>' data-sets='<%= @sets %>'></div>
12
- <div id="hits-misses" class="span6" data-hits='<%= @hits %>' data-misses='<%= @misses %>'></div>
12
+ <div id="hits-misses" class="span6" data-hits='<%= @hits %>' data-misses='<%= @misses %>' data-delete-hits='<%= @delete_hits %>' data-delete-misses='<%= @delete_misses %>'></div>
13
13
  </div>
14
14
 
15
15
  <div class="row">
16
- <div id="memory-usage" class="span6" data-limit-maxbytes='<%= @limit_maxbytes %>' data-bytes='<%= @bytes %>'></div>
16
+ <div id="memory-usage" class="span6" data-engine-maxbytes='<%= @engine_maxbytes %>' data-bytes='<%= @bytes %>'></div>
17
17
  <div id="current-items" class="span6" data-current-items='<%= @current_items %>'></div>
18
18
  </div>
19
+
20
+ <div class="row">
21
+ <div id="evictions" class="span6" data-evictions='<%= @evictions %>'></div>
22
+ </div>
19
23
  </section>
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'memdash-activerecord'
5
+ gem.version = '0.1.0'
6
+
7
+ gem.authors = ['Brian Ryckbost', 'Steve Richert']
8
+ gem.email = 'bryckbost@gmail.com'
9
+ gem.description = 'A dashboard for your memcached, storing data in ActiveRecord.'
10
+ gem.summary = 'A dashboard for your memcached, storing data in ActiveRecord.'
11
+ gem.homepage = 'https://github.com/bryckbost/memdash'
12
+
13
+ gem.add_dependency 'memdash', gem.version
14
+ gem.add_dependency 'activerecord', '~> 3.0'
15
+
16
+ gem.files = `git ls-files lib`.split($\).grep(/(active_?record|generators)/)
17
+ gem.require_paths = ['lib']
18
+ end
19
+
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'memdash-mongo_mapper'
5
+ gem.version = '0.1.0'
6
+
7
+ gem.authors = ['Brian Ryckbost']
8
+ gem.email = 'bryckbost@gmail.com'
9
+ gem.description = 'A dashboard for your memcached, storing data in MongoMapper.'
10
+ gem.summary = 'A dashboard for your memcached, storing data in MongoMapper.'
11
+ gem.homepage = 'https://github.com/bryckbost/memdash'
12
+
13
+ gem.add_dependency 'memdash', gem.version
14
+ gem.add_dependency 'mongo_mapper', '~> 0.11'
15
+
16
+ gem.files = `git ls-files lib`.split($\).grep(/(mongo_mapper)/)
17
+ gem.require_paths = ['lib']
18
+ end
19
+
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = 'memdash'
5
- gem.version = '0.0.1'
5
+ gem.version = '0.1.0'
6
6
 
7
7
  gem.authors = ['Brian Ryckbost', 'Steve Richert']
8
8
  gem.email = ['bryckbost@gmail.com', 'steve.richert@gmail.com']
@@ -10,16 +10,18 @@ Gem::Specification.new do |gem|
10
10
  gem.summary = 'A dashboard for your memcache'
11
11
  gem.homepage = 'https://github.com/bryckbost/memdash'
12
12
 
13
- gem.add_dependency 'activerecord', '~> 3.0'
14
13
  gem.add_dependency 'dalli', '~> 2.0'
15
14
  gem.add_dependency 'sinatra', '~> 1.3'
16
15
 
16
+ gem.add_development_dependency 'activerecord'
17
+ gem.add_development_dependency 'bson_ext'
18
+ gem.add_development_dependency 'mongo_mapper'
17
19
  gem.add_development_dependency 'database_cleaner'
18
20
  gem.add_development_dependency 'rake'
19
21
  gem.add_development_dependency 'rspec'
20
- gem.add_development_dependency 'sqlite3'
22
+ gem.add_development_dependency 'sqlite3'
21
23
 
22
- gem.files = `git ls-files`.split($\)
23
- gem.test_files = gem.files.grep(/^spec\//)
24
+ gem.files = `git ls-files`.split($\).reject{|f| f =~ /(lib\/memdash\-|adapters|generators)/ }
25
+ gem.test_files = `git ls-files`.split($\).grep(/^spec\//)
24
26
  gem.require_paths = ['lib']
25
27
  end
@@ -1,8 +1,8 @@
1
- require 'memdash/active_record'
1
+ require 'memdash/adapters/active_record'
2
2
 
3
3
  module ActiveRecordHelpers
4
4
  def reports_count
5
- Memdash::ActiveRecord::Report.count
5
+ Memdash::Adapters::ActiveRecord::Report.count
6
6
  end
7
7
  end
8
8
 
@@ -0,0 +1,15 @@
1
+ require 'memdash/adapters/mongo_mapper'
2
+ require 'mongo_mapper'
3
+
4
+ MongoMapper.connection = Mongo::Connection.new
5
+ MongoMapper.database = 'memdash_test'
6
+
7
+ module MongoMapperHelpers
8
+ def reports_count
9
+ Memdash::Adapters::MongoMapper::Report.count
10
+ end
11
+ end
12
+
13
+ RSpec.configure do |config|
14
+ config.include MongoMapperHelpers
15
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memdash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,16 +10,16 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-25 00:00:00.000000000 Z
13
+ date: 2012-05-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: activerecord
16
+ name: dalli
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: '3.0'
22
+ version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,15 +27,15 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- version: '3.0'
30
+ version: '2.0'
31
31
  - !ruby/object:Gem::Dependency
32
- name: dalli
32
+ name: sinatra
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: '2.0'
38
+ version: '1.3'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,23 +43,55 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: '2.0'
46
+ version: '1.3'
47
47
  - !ruby/object:Gem::Dependency
48
- name: sinatra
48
+ name: activerecord
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
55
- type: :runtime
54
+ version: '0'
55
+ type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
60
- - - ~>
60
+ - - ! '>='
61
61
  - !ruby/object:Gem::Version
62
- version: '1.3'
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: bson_ext
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: mongo_mapper
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
63
95
  - !ruby/object:Gem::Dependency
64
96
  name: database_cleaner
65
97
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +172,10 @@ files:
140
172
  - README.md
141
173
  - Rakefile
142
174
  - config.ru
143
- - lib/generators/memdash/active_record_generator.rb
144
- - lib/generators/memdash/templates/migration.rb
145
175
  - lib/memdash.rb
146
- - lib/memdash/active_record.rb
147
- - lib/memdash/active_record/client.rb
148
- - lib/memdash/active_record/report.rb
149
176
  - lib/memdash/client.rb
150
177
  - lib/memdash/configuration.rb
178
+ - lib/memdash/report.rb
151
179
  - lib/memdash/server.rb
152
180
  - lib/memdash/server/public/charts.js
153
181
  - lib/memdash/server/public/cross_scratches.png
@@ -161,15 +189,18 @@ files:
161
189
  - lib/memdash/server/public/style.css
162
190
  - lib/memdash/server/views/application.erb
163
191
  - lib/memdash/server/views/overview.erb
192
+ - memdash-activerecord.gemspec
193
+ - memdash-mongo_mapper.gemspec
164
194
  - memdash.gemspec
165
195
  - screenshot.png
166
196
  - spec/memdash_spec.rb
167
197
  - spec/spec_helper.rb
168
- - spec/support/adapters/active_record.rb
169
198
  - spec/support/dalli.rb
170
199
  - spec/support/database_cleaner.rb
171
200
  - spec/support/memcached.rb
172
201
  - spec/support/schema.rb
202
+ - spec/support/adapters/active_record.rb
203
+ - spec/support/adapters/mongo_mapper.rb
173
204
  homepage: https://github.com/bryckbost/memdash
174
205
  licenses: []
175
206
  post_install_message:
@@ -198,6 +229,7 @@ test_files:
198
229
  - spec/memdash_spec.rb
199
230
  - spec/spec_helper.rb
200
231
  - spec/support/adapters/active_record.rb
232
+ - spec/support/adapters/mongo_mapper.rb
201
233
  - spec/support/dalli.rb
202
234
  - spec/support/database_cleaner.rb
203
235
  - spec/support/memcached.rb
@@ -1,17 +0,0 @@
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
@@ -1,12 +0,0 @@
1
- class CreateMemdashActiveRecordReports < ActiveRecord::Migration
2
- def self.up
3
- create_table :memdash_reports do |table|
4
- table.text :stats
5
- table.datetime :created_at
6
- end
7
- end
8
-
9
- def self.down
10
- drop_table :memdash_reports
11
- end
12
- end
@@ -1,2 +0,0 @@
1
- require 'memdash'
2
- require 'memdash/active_record/client'
@@ -1,13 +0,0 @@
1
- require 'memdash/active_record/report'
2
-
3
- module Memdash
4
- module ActiveRecord
5
- module Client
6
- def generate_stats
7
- Memdash::ActiveRecord::Report.create!(:stats => stats)
8
- end
9
- end
10
- end
11
- end
12
-
13
- Dalli::Client.send(:include, Memdash::ActiveRecord::Client)
@@ -1,13 +0,0 @@
1
- require 'active_record'
2
-
3
- module Memdash
4
- module ActiveRecord
5
- class Report < ::ActiveRecord::Base
6
- self.table_name = :memdash_reports
7
-
8
- serialize :stats
9
-
10
- scope :past_day, where('created_at >= :time', :time => Time.current - 1.day)
11
- end
12
- end
13
- end