forked from karmi/pushr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
57 lines (48 loc) · 1.51 KB
/
Rakefile
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
require 'rake'
require 'yaml'
CONFIG = YAML.load_file( File.join(File.dirname(__FILE__), 'config.yml') ) unless defined? CONFIG
# -- Shortcuts
desc "Start application in development mode"
task :default => 'start:development'
desc "Start application in production mode with Thin"
task :start => 'start:production'
# -- Start/Stop
namespace :start do
task :development do
system "ruby pushr.rb -p 4000"
end
task :production do
system "thin -R config.ru -d -P thin.pid -l production.log -e production -p 4000 start"
puts "> Pushr started on port 4000" if $?.success?
end
end
desc "Stop application in production mode"
task :stop do
system "thin -R config.ru -d -P thin.pid -l production.log -e production -p 4000 stop"
puts "> Pushr stopped" if $?.success?
end
# -- Maintenance
namespace :app do
desc "Check dependencies of the application"
task :check do
begin
require 'rubygems'
require 'sinatra'
require 'haml'
require 'sass'
require 'capistrano'
require 'thin'
puts "\n[*] Good! You seem to have all the neccessary gems for Pushr"
rescue LoadError => e
puts "[!] Bad! Some gems for Pushr are missing!"
puts e.message
ensure
Sinatra::Application.default_options.merge!(:run => false)
end
end
desc "Add public key for the user@server to 'itself' (so Cap can SSH to localhost)"
task :add_public_key_to_localhost do
# TODO : Ask for key name with Highline
`cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys`
end
end