vanity 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ $TESTING=true
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+ require 'redis'
@@ -0,0 +1,136 @@
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
+ sh "cd #{RedisRunner.redisdir} && git pull" if File.exists?("#{RedisRunner.redisdir}/.git")
97
+ end
98
+
99
+ desc "Open an IRb session"
100
+ task :console do
101
+ RedisRunner.start_detached
102
+ system "irb -I lib -I extra -r redis.rb"
103
+ RedisRunner.stop
104
+ end
105
+ end
106
+
107
+ namespace :dtach do
108
+
109
+ desc 'About dtach'
110
+ task :about do
111
+ puts "\nSee http://dtach.sourceforge.net/ for information about dtach.\n\n"
112
+ end
113
+
114
+ desc 'Install dtach 0.8 from source'
115
+ task :install => [:about] do
116
+
117
+ Dir.chdir('/tmp/')
118
+ unless File.exists?('/tmp/dtach-0.8.tar.gz')
119
+ require 'net/http'
120
+
121
+ url = 'http://downloads.sourceforge.net/project/dtach/dtach/0.8/dtach-0.8.tar.gz'
122
+ open('/tmp/dtach-0.8.tar.gz', 'wb') do |file| file.write(open(url).read) end
123
+ end
124
+
125
+ unless File.directory?('/tmp/dtach-0.8')
126
+ system('tar xzf dtach-0.8.tar.gz')
127
+ end
128
+
129
+ Dir.chdir('/tmp/dtach-0.8/')
130
+ sh 'cd /tmp/dtach-0.8/ && ./configure && make'
131
+ sh 'sudo cp /tmp/dtach-0.8/dtach /usr/bin/'
132
+
133
+ puts 'Dtach successfully installed to /usr/bin.'
134
+ end
135
+ end
136
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Assaf Arkin
@@ -11,17 +11,8 @@ cert_chain: []
11
11
 
12
12
  date: 2009-11-13 00:00:00 -08:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: redis
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: "0.1"
24
- version:
14
+ dependencies: []
15
+
25
16
  description: Mirror, mirror on the wall ...
26
17
  email: assaf@labnotes.org
27
18
  executables:
@@ -47,6 +38,17 @@ files:
47
38
  - lib/vanity/templates/_report.erb
48
39
  - lib/vanity/templates/_vanity.css
49
40
  - lib/vanity.rb
41
+ - vendor/redis-0.1/lib/dist_redis.rb
42
+ - vendor/redis-0.1/lib/hash_ring.rb
43
+ - vendor/redis-0.1/lib/pipeline.rb
44
+ - vendor/redis-0.1/lib/redis/raketasks.rb
45
+ - vendor/redis-0.1/lib/redis.rb
46
+ - vendor/redis-0.1/LICENSE
47
+ - vendor/redis-0.1/Rakefile
48
+ - vendor/redis-0.1/README.markdown
49
+ - vendor/redis-0.1/spec/redis_spec.rb
50
+ - vendor/redis-0.1/spec/spec_helper.rb
51
+ - vendor/redis-0.1/tasks/redis.tasks.rb
50
52
  - test/ab_test_test.rb
51
53
  - test/experiment_test.rb
52
54
  - test/experiments/age_and_zipcode.rb
@@ -65,7 +67,7 @@ licenses: []
65
67
  post_install_message: To get started run vanity --help
66
68
  rdoc_options:
67
69
  - --title
68
- - Vanity 0.3.0
70
+ - Vanity 0.3.1
69
71
  - --main
70
72
  - README.rdoc
71
73
  - --webcvs