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
|
# File 'lib/generators/goldencobra/server_generator.rb', line 11
def install_capistrano
if yes?("Would you like to configure git?")
@git_url = ask("What is your git url? (bsp: ssh://[email protected]:7999/KLIMA/website.git)")
git :init
git remote: "add origin #{@git_url}"
git add: "."
git commit: "-m 'First commit'"
git push: "origin master"
end
if yes?("Would you like to configure capistrano? (a git repository is required)")
@ip_address = ask("To which IP do you want to deploy? (bsp: Taurus 178.23.121.27)")
if @git_url.blank?
@git_url = ask("What is your git url? (bsp: ssh://[email protected]:7999/KLIMA/website.git)")
end
@app_name = Rails.application.class.parent_name.parameterize.underscore
capify!
remove_file "config/deploy.rb"
template "../templates/deploy.rb.erb", "config/deploy.rb"
git add: "."
git commit: "-m 'Deploy files added'"
git push: "origin master"
end
if yes?("Would you like to configure your server and deploy to it?")
@app_name = Rails.application.class.parent_name.parameterize.underscore
copy_file "../templates/create_database.mysql.erb", "config/templates/create_database.mysql.erb"
copy_file "../templates/database.yml.erb", "config/templates/database.yml.erb"
template "../templates/apache.tmpl.erb", "config/templates/#{@app_name}"
system("bundle install")
git add: "."
git commit: "-m 'Server configuration files added'"
git push: "origin master"
system("cap deploy:create_gemset")
system("cap deploy:setup")
if yes?("Would you like to create remote database?")
system("cap deploy:db:setup")
end
system("cap deploy")
if yes?("Would you like to seed your remote db?")
system("cap deploy:seed")
end
if yes?("Would you like to configure apache on your server?")
system("cap deploy:apache_setup")
end
end
end
|