-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapistrano_pushr.rb
79 lines (64 loc) · 1.91 KB
/
capistrano_pushr.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# usual capistrano variables
set :application "my_application"
set :deploy_to, "/home/deployer/app"
# put the folowing code into your deploy.rb
namespace :pushr do
set :pushr_path, "#{deploy_to}/pushr"
desc "Install pushr"
task :install do
run "git clone git://github.com/karmi/pushr.git #{pushr_path}"
end
desc "Update pushr"
task :update do
run "cd #{pushr_path}; git pull origin master"
end
task :check do
run "cd #{pushr_path}; rake app:check"
end
desc "Create config.yml"
task :configure do
set :http_auth_username, Capistrano::CLI.ui.ask("Enter new user name for http access: ")
set :http_auth_password, Capistrano::CLI.password_prompt("Enter new password for http access: ")
set :twitter_username, Capistrano::CLI.ui.ask("Your twitter username: ")
set :twitter_password, Capistrano::CLI.password_prompt("Enter twitter password: ")
pushr_configuration =<<-EOF
application: #{application}
# Username/password for HTTP Auth
username: #{http_auth_username}
password: #{http_auth_password}
# Full path to your Rails application, eg. "/var/www/my_rails_app"
path: #{deploy_to}
twitter:
username: '#{twitter_username}'
password: '#{twitter_password}'
EOF
put pushr_configuration, "#{pushr_path}/config.yml"
end
desc "Start pushr"
task :start do
run "cd #{pushr_path}; rake start"
end
desc "Stop pushr"
task :stop do
run "cd #{pushr_path}; rake stop"
end
desc "Restart pushr"
task :restart do
stop
start
end
namespace :ssh do
desc "Generate ssh key"
task :generate_key do
run "ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''"
end
desc "Authorize local key for accessing the same server"
task :authorize_key do
run "cd #{pushr_path}; rake app:add_public_key_to_localhost"
end
desc "Display public ssh key"
task :get_public_key do
run "cat ~/.ssh/id_rsa.pub"
end
end
end