vanity 1.3.0 → 1.4.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +61 -3
- data/Gemfile +22 -14
- data/README.rdoc +9 -4
- data/Rakefile +72 -12
- data/bin/vanity +16 -4
- data/lib/vanity.rb +7 -5
- data/lib/vanity/adapters/abstract_adapter.rb +135 -0
- data/lib/vanity/adapters/mock_adapter.rb +157 -0
- data/lib/vanity/adapters/mongo_adapter.rb +162 -0
- data/lib/vanity/adapters/redis_adapter.rb +154 -0
- data/lib/vanity/backport.rb +0 -17
- data/lib/vanity/commands/upgrade.rb +34 -0
- data/lib/vanity/experiment/ab_test.rb +46 -41
- data/lib/vanity/experiment/base.rb +13 -15
- data/lib/vanity/frameworks/rails.rb +5 -9
- data/lib/vanity/metric/active_record.rb +10 -4
- data/lib/vanity/metric/base.rb +46 -23
- data/lib/vanity/metric/google_analytics.rb +7 -0
- data/lib/vanity/metric/remote.rb +53 -0
- data/lib/vanity/playground.rb +133 -49
- data/test/{ab_test_test.rb → experiment/ab_test.rb} +47 -3
- data/test/{experiment_test.rb → experiment/base_test.rb} +8 -8
- data/test/metric/active_record_test.rb +253 -0
- data/test/metric/base_test.rb +293 -0
- data/test/metric/google_analytics_test.rb +104 -0
- data/test/metric/remote_test.rb +108 -0
- data/test/myapp/app/controllers/application_controller.rbc +66 -0
- data/test/myapp/app/controllers/main_controller.rb +3 -3
- data/test/myapp/app/controllers/main_controller.rbc +347 -0
- data/test/myapp/config/boot.rbc +2534 -0
- data/test/myapp/config/environment.rbc +403 -0
- data/test/myapp/config/routes.rbc +174 -0
- data/test/myapp/log/production.log +2601 -0
- data/test/passenger_test.rb +14 -5
- data/test/passenger_test.rbc +0 -0
- data/test/playground_test.rbc +256 -0
- data/test/rails_test.rb +75 -22
- data/test/rails_test.rbc +4086 -0
- data/test/test_helper.rb +30 -7
- data/test/test_helper.rbc +4297 -0
- data/vanity.gemspec +6 -2
- metadata +74 -73
- data/lib/vanity/commands.rb +0 -2
- data/lib/vanity/mock_redis.rb +0 -76
- data/test/metric_test.rb +0 -622
- data/vendor/cache/RedCloth-4.2.2.gem +0 -0
- data/vendor/cache/actionmailer-2.3.5.gem +0 -0
- data/vendor/cache/actionpack-2.3.5.gem +0 -0
- data/vendor/cache/activerecord-2.3.5.gem +0 -0
- data/vendor/cache/activeresource-2.3.5.gem +0 -0
- data/vendor/cache/activesupport-2.3.5.gem +0 -0
- data/vendor/cache/autotest-4.2.7.gem +0 -0
- data/vendor/cache/autotest-fsevent-0.2.1.gem +0 -0
- data/vendor/cache/autotest-growl-0.2.0.gem +0 -0
- data/vendor/cache/bundler-0.9.7.gem +0 -0
- data/vendor/cache/classifier-1.3.1.gem +0 -0
- data/vendor/cache/directory_watcher-1.3.1.gem +0 -0
- data/vendor/cache/fastthread-1.0.7.gem +0 -0
- data/vendor/cache/garb-0.7.0.gem +0 -0
- data/vendor/cache/happymapper-0.3.0.gem +0 -0
- data/vendor/cache/jekyll-0.5.7.gem +0 -0
- data/vendor/cache/libxml-ruby-1.1.3.gem +0 -0
- data/vendor/cache/liquid-2.0.0.gem +0 -0
- data/vendor/cache/maruku-0.6.0.gem +0 -0
- data/vendor/cache/mocha-0.9.8.gem +0 -0
- data/vendor/cache/open4-1.0.1.gem +0 -0
- data/vendor/cache/passenger-2.2.9.gem +0 -0
- data/vendor/cache/rack-1.0.1.gem +0 -0
- data/vendor/cache/rails-2.3.5.gem +0 -0
- data/vendor/cache/rake-0.8.7.gem +0 -0
- data/vendor/cache/rubygems-update-1.3.5.gem +0 -0
- data/vendor/cache/shoulda-2.10.3.gem +0 -0
- data/vendor/cache/sqlite3-ruby-1.2.5.gem +0 -0
- data/vendor/cache/stemmer-1.0.1.gem +0 -0
- data/vendor/cache/syntax-1.0.0.gem +0 -0
- data/vendor/cache/sys-uname-0.8.4.gem +0 -0
- data/vendor/cache/timecop-0.3.4.gem +0 -0
- data/vendor/redis-rb/LICENSE +0 -20
- data/vendor/redis-rb/README.markdown +0 -36
- data/vendor/redis-rb/Rakefile +0 -62
- data/vendor/redis-rb/bench.rb +0 -44
- data/vendor/redis-rb/benchmarking/suite.rb +0 -24
- data/vendor/redis-rb/benchmarking/worker.rb +0 -71
- data/vendor/redis-rb/bin/distredis +0 -33
- data/vendor/redis-rb/examples/basic.rb +0 -16
- data/vendor/redis-rb/examples/incr-decr.rb +0 -18
- data/vendor/redis-rb/examples/list.rb +0 -26
- data/vendor/redis-rb/examples/sets.rb +0 -36
- data/vendor/redis-rb/lib/dist_redis.rb +0 -124
- data/vendor/redis-rb/lib/hash_ring.rb +0 -128
- data/vendor/redis-rb/lib/pipeline.rb +0 -21
- data/vendor/redis-rb/lib/redis.rb +0 -370
- data/vendor/redis-rb/lib/redis/raketasks.rb +0 -1
- data/vendor/redis-rb/profile.rb +0 -22
- data/vendor/redis-rb/redis-rb.gemspec +0 -30
- data/vendor/redis-rb/spec/redis_spec.rb +0 -637
- data/vendor/redis-rb/spec/spec_helper.rb +0 -4
- data/vendor/redis-rb/speed.rb +0 -16
- data/vendor/redis-rb/tasks/redis.tasks.rb +0 -140
data/vendor/redis-rb/speed.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'benchmark'
|
2
|
-
require "#{File.dirname(__FILE__)}/lib/redis"
|
3
|
-
|
4
|
-
r = Redis.new
|
5
|
-
n = (ARGV.shift || 20000).to_i
|
6
|
-
|
7
|
-
elapsed = Benchmark.realtime do
|
8
|
-
# n sets, n gets
|
9
|
-
n.times do |i|
|
10
|
-
key = "foo#{i}"
|
11
|
-
r[key] = key * 10
|
12
|
-
r[key]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
puts '%.2f Kops' % (2 * n / 1000 / elapsed)
|
@@ -1,140 +0,0 @@
|
|
1
|
-
# Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
|
2
|
-
require 'rake'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'open-uri'
|
5
|
-
|
6
|
-
class RedisRunner
|
7
|
-
|
8
|
-
def self.redisdir
|
9
|
-
"/tmp/redis/"
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.redisconfdir
|
13
|
-
'/etc/redis.conf'
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.dtach_socket
|
17
|
-
'/tmp/redis.dtach'
|
18
|
-
end
|
19
|
-
|
20
|
-
# Just check for existance of dtach socket
|
21
|
-
def self.running?
|
22
|
-
File.exists? dtach_socket
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.start
|
26
|
-
puts 'Detach with Ctrl+\ Re-attach with rake redis:attach'
|
27
|
-
sleep 3
|
28
|
-
exec "dtach -A #{dtach_socket} redis-server #{redisconfdir}"
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.start_detached
|
32
|
-
system "dtach -n #{dtach_socket} redis-server #{redisconfdir}"
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.attach
|
36
|
-
exec "dtach -a #{dtach_socket}"
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.stop
|
40
|
-
system 'echo "SHUTDOWN" | nc localhost 6379'
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
namespace :redis do
|
46
|
-
|
47
|
-
desc 'About redis'
|
48
|
-
task :about do
|
49
|
-
puts "\nSee http://code.google.com/p/redis/ for information about redis.\n\n"
|
50
|
-
end
|
51
|
-
|
52
|
-
desc 'Start redis'
|
53
|
-
task :start do
|
54
|
-
RedisRunner.start
|
55
|
-
end
|
56
|
-
|
57
|
-
desc 'Stop redis'
|
58
|
-
task :stop do
|
59
|
-
RedisRunner.stop
|
60
|
-
end
|
61
|
-
|
62
|
-
desc 'Restart redis'
|
63
|
-
task :restart do
|
64
|
-
RedisRunner.stop
|
65
|
-
RedisRunner.start
|
66
|
-
end
|
67
|
-
|
68
|
-
desc 'Attach to redis dtach socket'
|
69
|
-
task :attach do
|
70
|
-
RedisRunner.attach
|
71
|
-
end
|
72
|
-
|
73
|
-
desc 'Install the lastest verison of Redis from Github (requires git, duh)'
|
74
|
-
task :install => [:about, :download, :make] do
|
75
|
-
%w(redis-benchmark redis-cli redis-server).each do |bin|
|
76
|
-
sh "sudo cp /tmp/redis/#{bin} /usr/bin/"
|
77
|
-
end
|
78
|
-
|
79
|
-
puts "Installed redis-benchmark, redis-cli and redis-server to /usr/bin/"
|
80
|
-
|
81
|
-
unless File.exists?('/etc/redis.conf')
|
82
|
-
sh 'sudo cp /tmp/redis/redis.conf /etc/'
|
83
|
-
puts "Installed redis.conf to /etc/ \n You should look at this file!"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
task :make do
|
88
|
-
sh "cd #{RedisRunner.redisdir} && make clean"
|
89
|
-
sh "cd #{RedisRunner.redisdir} && make"
|
90
|
-
end
|
91
|
-
|
92
|
-
desc "Download package"
|
93
|
-
task :download do
|
94
|
-
sh 'rm -rf /tmp/redis/' if File.exists?("#{RedisRunner.redisdir}/.svn")
|
95
|
-
sh 'git clone git://github.com/antirez/redis.git /tmp/redis' unless File.exists?(RedisRunner.redisdir)
|
96
|
-
|
97
|
-
if File.exists?("#{RedisRunner.redisdir}/.git")
|
98
|
-
arguments = ENV['COMMIT'].nil? ? "pull" : "reset --hard #{ENV['COMMIT']}"
|
99
|
-
sh "cd #{RedisRunner.redisdir} && git #{arguments}"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
desc "Open an IRb session"
|
104
|
-
task :console do
|
105
|
-
RedisRunner.start_detached
|
106
|
-
system "irb -I lib -I extra -r redis.rb"
|
107
|
-
RedisRunner.stop
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
namespace :dtach do
|
112
|
-
|
113
|
-
desc 'About dtach'
|
114
|
-
task :about do
|
115
|
-
puts "\nSee http://dtach.sourceforge.net/ for information about dtach.\n\n"
|
116
|
-
end
|
117
|
-
|
118
|
-
desc 'Install dtach 0.8 from source'
|
119
|
-
task :install => [:about] do
|
120
|
-
|
121
|
-
Dir.chdir('/tmp/')
|
122
|
-
unless File.exists?('/tmp/dtach-0.8.tar.gz')
|
123
|
-
require 'net/http'
|
124
|
-
|
125
|
-
url = 'http://downloads.sourceforge.net/project/dtach/dtach/0.8/dtach-0.8.tar.gz'
|
126
|
-
open('/tmp/dtach-0.8.tar.gz', 'wb') do |file| file.write(open(url).read) end
|
127
|
-
end
|
128
|
-
|
129
|
-
unless File.directory?('/tmp/dtach-0.8')
|
130
|
-
system('tar xzf dtach-0.8.tar.gz')
|
131
|
-
end
|
132
|
-
|
133
|
-
Dir.chdir('/tmp/dtach-0.8/')
|
134
|
-
sh 'cd /tmp/dtach-0.8/ && ./configure && make'
|
135
|
-
sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
|
136
|
-
|
137
|
-
puts 'Dtach successfully installed to /usr/bin.'
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|