railshoster 0.6.12 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +3 -1
- data/CHANGELOG.textile +4 -0
- data/Gemfile +4 -1
- data/Gemfile.lock +33 -26
- data/gemfiles/Gemfile.ci.lock +58 -0
- data/lib/railshoster/capistrano/config.rb +9 -3
- data/lib/railshoster/command.rb +4 -0
- data/lib/railshoster/deploy_command.rb +18 -6
- data/lib/railshoster/general_capistrano_helpers.rb +18 -0
- data/lib/railshoster/init_capistrano_helpers.rb +23 -9
- data/lib/railshoster/init_command.rb +3 -1
- data/lib/railshoster/version.rb +1 -1
- data/railshoster.gemspec +4 -3
- data/templates/h/deploy_version_2.rb.erb +122 -0
- data/templates/h/deploy_version_3.rb.erb +149 -0
- metadata +91 -42
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 4f7fcc19682a8f2aa3a648118878378e2c037dac
|
|
4
|
+
data.tar.gz: aba871ed47ec20c8de9b89a79588a04088ded363
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: cf5acaedbe9e671310ce0a2462486b8277efc01b1723694d4da6f390b73f2f0944c29d0bd99fdc06990b6ceff5de8ec7c7b9d7bb548f6550418428f86a8c58a7
|
|
7
|
+
data.tar.gz: 09bc2e5920c13d84fe36da5fb2c6b8b3ce59117fc428009abd4b38388318c35e17bd77e140c1e820d31a3b295fd82ab26ec163870854c8675851743408ea0d2b
|
data/.travis.yml
CHANGED
data/CHANGELOG.textile
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
railshoster (0.
|
|
4
|
+
railshoster (1.0.0)
|
|
5
5
|
activesupport
|
|
6
6
|
bundler (>= 1.0.15)
|
|
7
7
|
capistrano
|
|
8
|
-
capistrano-ext
|
|
9
8
|
erubis
|
|
10
9
|
git
|
|
11
10
|
gli (>= 1.2.5)
|
|
11
|
+
highline
|
|
12
12
|
json
|
|
13
|
+
net-sftp
|
|
13
14
|
|
|
14
15
|
GEM
|
|
15
16
|
remote: http://rubygems.org/
|
|
16
17
|
specs:
|
|
17
|
-
activesupport (
|
|
18
|
-
i18n (~> 0.6)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
activesupport (4.1.1)
|
|
19
|
+
i18n (~> 0.6, >= 0.6.9)
|
|
20
|
+
json (~> 1.7, >= 1.7.7)
|
|
21
|
+
minitest (~> 5.1)
|
|
22
|
+
thread_safe (~> 0.1)
|
|
23
|
+
tzinfo (~> 1.1)
|
|
24
|
+
capistrano (3.2.1)
|
|
25
|
+
i18n
|
|
26
|
+
rake (>= 10.0.0)
|
|
27
|
+
sshkit (~> 1.3)
|
|
28
|
+
colorize (0.7.3)
|
|
28
29
|
diff-lcs (1.1.3)
|
|
29
30
|
erubis (2.7.0)
|
|
30
31
|
fakefs (0.4.0)
|
|
31
|
-
git (1.2.
|
|
32
|
-
gli (2.
|
|
33
|
-
highline (1.6.
|
|
34
|
-
i18n (0.6.
|
|
35
|
-
json (1.
|
|
32
|
+
git (1.2.7)
|
|
33
|
+
gli (2.11.0)
|
|
34
|
+
highline (1.6.21)
|
|
35
|
+
i18n (0.6.9)
|
|
36
|
+
json (1.8.1)
|
|
36
37
|
metaclass (0.0.1)
|
|
38
|
+
minitest (5.3.5)
|
|
37
39
|
mocha (0.10.3)
|
|
38
40
|
metaclass (~> 0.0.1)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
net-ssh-gateway (1.1.0)
|
|
46
|
-
net-ssh (>= 1.99.1)
|
|
41
|
+
net-scp (1.2.1)
|
|
42
|
+
net-ssh (>= 2.6.5)
|
|
43
|
+
net-sftp (2.1.2)
|
|
44
|
+
net-ssh (>= 2.6.5)
|
|
45
|
+
net-ssh (2.9.1)
|
|
46
|
+
rake (10.3.2)
|
|
47
47
|
rspec (2.8.0)
|
|
48
48
|
rspec-core (~> 2.8.0)
|
|
49
49
|
rspec-expectations (~> 2.8.0)
|
|
@@ -52,6 +52,13 @@ GEM
|
|
|
52
52
|
rspec-expectations (2.8.0)
|
|
53
53
|
diff-lcs (~> 1.1.2)
|
|
54
54
|
rspec-mocks (2.8.0)
|
|
55
|
+
sshkit (1.5.1)
|
|
56
|
+
colorize
|
|
57
|
+
net-scp (>= 1.1.2)
|
|
58
|
+
net-ssh (>= 2.8.0)
|
|
59
|
+
thread_safe (0.3.4)
|
|
60
|
+
tzinfo (1.2.1)
|
|
61
|
+
thread_safe (~> 0.1)
|
|
55
62
|
|
|
56
63
|
PLATFORMS
|
|
57
64
|
ruby
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
activesupport (3.2.8)
|
|
5
|
+
i18n (~> 0.6)
|
|
6
|
+
multi_json (~> 1.0)
|
|
7
|
+
capistrano (2.13.3)
|
|
8
|
+
highline
|
|
9
|
+
net-scp (>= 1.0.0)
|
|
10
|
+
net-sftp (>= 2.0.0)
|
|
11
|
+
net-ssh (>= 2.0.14)
|
|
12
|
+
net-ssh-gateway (>= 1.1.0)
|
|
13
|
+
capistrano-ext (1.2.1)
|
|
14
|
+
capistrano (>= 1.0.0)
|
|
15
|
+
diff-lcs (1.1.3)
|
|
16
|
+
erubis (2.7.0)
|
|
17
|
+
fakefs (0.4.0)
|
|
18
|
+
git (1.2.5)
|
|
19
|
+
gli (2.1.0)
|
|
20
|
+
highline (1.6.15)
|
|
21
|
+
i18n (0.6.1)
|
|
22
|
+
json (1.7.5)
|
|
23
|
+
metaclass (0.0.1)
|
|
24
|
+
mocha (0.12.4)
|
|
25
|
+
metaclass (~> 0.0.1)
|
|
26
|
+
multi_json (1.3.6)
|
|
27
|
+
net-scp (1.0.4)
|
|
28
|
+
net-ssh (>= 1.99.1)
|
|
29
|
+
net-sftp (2.0.5)
|
|
30
|
+
net-ssh (>= 2.0.9)
|
|
31
|
+
net-ssh (2.5.2)
|
|
32
|
+
net-ssh-gateway (1.1.0)
|
|
33
|
+
net-ssh (>= 1.99.1)
|
|
34
|
+
rake (0.9.2.2)
|
|
35
|
+
rspec (2.11.0)
|
|
36
|
+
rspec-core (~> 2.11.0)
|
|
37
|
+
rspec-expectations (~> 2.11.0)
|
|
38
|
+
rspec-mocks (~> 2.11.0)
|
|
39
|
+
rspec-core (2.11.1)
|
|
40
|
+
rspec-expectations (2.11.3)
|
|
41
|
+
diff-lcs (~> 1.1.3)
|
|
42
|
+
rspec-mocks (2.11.2)
|
|
43
|
+
|
|
44
|
+
PLATFORMS
|
|
45
|
+
ruby
|
|
46
|
+
|
|
47
|
+
DEPENDENCIES
|
|
48
|
+
activesupport
|
|
49
|
+
capistrano
|
|
50
|
+
capistrano-ext
|
|
51
|
+
erubis
|
|
52
|
+
fakefs
|
|
53
|
+
git
|
|
54
|
+
gli (>= 1.2.5)
|
|
55
|
+
json
|
|
56
|
+
mocha
|
|
57
|
+
rake
|
|
58
|
+
rspec
|
|
@@ -8,11 +8,17 @@ module Railshoster
|
|
|
8
8
|
|
|
9
9
|
#### Static
|
|
10
10
|
|
|
11
|
-
def self.
|
|
12
|
-
deployrb_template = File.read(File.join(File.dirname(__FILE__), "../../../templates/h/
|
|
11
|
+
def self.render_deploy_rb_for_capistrano_3_to_s(application_hash)
|
|
12
|
+
deployrb_template = File.read(File.join(File.dirname(__FILE__), "../../../templates/h/deploy_version_3.rb.erb"))
|
|
13
|
+
eruby = Erubis::Eruby.new(deployrb_template)
|
|
14
|
+
eruby.result(:app => application_hash)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.render_deploy_rb_for_capistrano_2_to_s(application_hash)
|
|
18
|
+
deployrb_template = File.read(File.join(File.dirname(__FILE__), "../../../templates/h/deploy_version_2.rb.erb"))
|
|
13
19
|
eruby = Erubis::Eruby.new(deployrb_template)
|
|
14
20
|
eruby.result(:app => application_hash)
|
|
15
21
|
end
|
|
16
22
|
end
|
|
17
23
|
end
|
|
18
|
-
end
|
|
24
|
+
end
|
data/lib/railshoster/command.rb
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
module Railshoster
|
|
2
2
|
|
|
3
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '/general_capistrano_helpers'))
|
|
4
|
+
|
|
3
5
|
# This action class helps to setup a new rails applicaton
|
|
4
6
|
class Command
|
|
5
7
|
|
|
8
|
+
include ::Railshoster::GeneralCapistranoHelpers
|
|
9
|
+
|
|
6
10
|
def initialize(project_dir)
|
|
7
11
|
@project_dir = project_dir
|
|
8
12
|
|
|
@@ -9,20 +9,32 @@ module Railshoster
|
|
|
9
9
|
|
|
10
10
|
def deploy
|
|
11
11
|
if_project_already_initialized do
|
|
12
|
-
|
|
12
|
+
if capistrano_greater_than_2?
|
|
13
|
+
system("cap production deploy")
|
|
14
|
+
else
|
|
15
|
+
system("cap deploy")
|
|
16
|
+
end
|
|
13
17
|
end
|
|
14
18
|
end
|
|
15
|
-
|
|
19
|
+
|
|
16
20
|
def deploy_setup
|
|
17
21
|
if_project_already_initialized do
|
|
18
|
-
|
|
22
|
+
if capistrano_greater_than_2?
|
|
23
|
+
system("cap production deploy:setup")
|
|
24
|
+
else
|
|
25
|
+
system("cap deploy:setup")
|
|
26
|
+
end
|
|
19
27
|
end
|
|
20
28
|
end
|
|
21
|
-
|
|
29
|
+
|
|
22
30
|
def deploy_cold
|
|
23
31
|
if_project_already_initialized do
|
|
24
|
-
|
|
32
|
+
if capistrano_greater_than_2?
|
|
33
|
+
system("cap production deploy:cold")
|
|
34
|
+
else
|
|
35
|
+
system("cap deploy:cold")
|
|
36
|
+
end
|
|
25
37
|
end
|
|
26
38
|
end
|
|
27
39
|
end
|
|
28
|
-
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Railshoster
|
|
2
|
+
module GeneralCapistranoHelpers
|
|
3
|
+
|
|
4
|
+
def installed_capistrano_version
|
|
5
|
+
require 'capistrano/version'
|
|
6
|
+
if ::Capistrano.const_defined?('VERSION')
|
|
7
|
+
return ::Capistrano::VERSION
|
|
8
|
+
elsif ::Capistrano.const_defined?('Version')
|
|
9
|
+
return ::Capistrano::Version.to_s
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def capistrano_greater_than_2?
|
|
14
|
+
return installed_capistrano_version >= '3.0.0'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
module Railshoster
|
|
2
2
|
module InitCapistranoHelpers
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
4
5
|
protected
|
|
5
6
|
|
|
6
7
|
def create_deployrb(app_hash)
|
|
7
8
|
deployrb_str = ""
|
|
8
|
-
deployrb_str =
|
|
9
|
+
deployrb_str = if capistrano_greater_than_2?
|
|
10
|
+
Railshoster::Capistrano::Config.render_deploy_rb_for_capistrano_3_to_s(app_hash)
|
|
11
|
+
else
|
|
12
|
+
Railshoster::Capistrano::Config.render_deploy_rb_for_capistrano_2_to_s(app_hash)
|
|
13
|
+
end
|
|
9
14
|
end
|
|
10
|
-
|
|
15
|
+
|
|
11
16
|
def write_deploy_rb(deployrb_str)
|
|
12
17
|
deployrb_basepath = File.join(@project_dir, "config")
|
|
13
18
|
FileUtils.mkdir_p(deployrb_basepath)
|
|
14
|
-
|
|
15
|
-
deployrb_path =
|
|
19
|
+
|
|
20
|
+
deployrb_path = if capistrano_greater_than_2?
|
|
21
|
+
File.join(deployrb_basepath, "deploy/production.rb")
|
|
22
|
+
else
|
|
23
|
+
File.join(deployrb_basepath, "deploy.rb")
|
|
24
|
+
end
|
|
16
25
|
Railshoster::Utilities.backup_file(deployrb_path) if File.exists?(deployrb_path)
|
|
17
|
-
|
|
26
|
+
|
|
18
27
|
File.open(deployrb_path, "w+") { |f| f << deployrb_str }
|
|
19
28
|
end
|
|
20
|
-
|
|
29
|
+
|
|
21
30
|
def capify_project
|
|
22
31
|
puts "\n\tWarning: You are initializing a project with an existing Capfile.\n" if capfile_exists?
|
|
23
|
-
successful =
|
|
32
|
+
successful = if capistrano_greater_than_2?
|
|
33
|
+
puts "\tCapistrano greater than 2 detected"
|
|
34
|
+
system("cd #{@project_dir} && cap install")
|
|
35
|
+
else
|
|
36
|
+
system("capify #{@project_dir}")
|
|
37
|
+
end
|
|
24
38
|
raise CapifyProjectFailedError.new("Couldn't capify project at #{@project_dir}") unless successful
|
|
25
39
|
end
|
|
26
40
|
end
|
|
27
|
-
end
|
|
41
|
+
end
|
|
@@ -5,6 +5,7 @@ require 'fileutils'
|
|
|
5
5
|
require 'bundler'
|
|
6
6
|
|
|
7
7
|
require File.expand_path(File.join(File.dirname(__FILE__), '/capistrano/config'))
|
|
8
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '/general_capistrano_helpers'))
|
|
8
9
|
require File.expand_path(File.join(File.dirname(__FILE__), '/init_ssh_helpers'))
|
|
9
10
|
require File.expand_path(File.join(File.dirname(__FILE__), '/init_capistrano_helpers'))
|
|
10
11
|
require File.expand_path(File.join(File.dirname(__FILE__), '/init_validation_helpers'))
|
|
@@ -20,6 +21,7 @@ module Railshoster
|
|
|
20
21
|
# * All modifications of the @app_hash must be done within this file not in a helper module. This helps to easily grasp the app_hash structure with all changed made to it.
|
|
21
22
|
class InitCommand < Command
|
|
22
23
|
|
|
24
|
+
include Railshoster::GeneralCapistranoHelpers
|
|
23
25
|
include Railshoster::InitSshHelpers
|
|
24
26
|
include Railshoster::InitCapistranoHelpers
|
|
25
27
|
include Railshoster::InitGemHelpers
|
|
@@ -86,8 +88,8 @@ module Railshoster
|
|
|
86
88
|
|
|
87
89
|
|
|
88
90
|
deployrb_str = create_deployrb(@app_hash)
|
|
89
|
-
write_deploy_rb(deployrb_str)
|
|
90
91
|
capify_project
|
|
92
|
+
write_deploy_rb(deployrb_str)
|
|
91
93
|
success_message
|
|
92
94
|
end
|
|
93
95
|
|
data/lib/railshoster/version.rb
CHANGED
data/railshoster.gemspec
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.authors = ["Julian Fischer"]
|
|
9
9
|
s.email = ["fischer@enterprise-rails.de"]
|
|
10
10
|
s.homepage = "http://www.railshoster.com"
|
|
11
|
-
s.summary = %q{RailsHoster
|
|
11
|
+
s.summary = %q{RailsHoster Application Deployment Suite}
|
|
12
12
|
s.description = %q{Easily deploy your Rails app to RailsHoster.com by using this gem.}
|
|
13
13
|
|
|
14
14
|
s.rubyforge_project = "railshoster"
|
|
@@ -19,8 +19,9 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.require_paths = ["lib"]
|
|
20
20
|
|
|
21
21
|
s.add_dependency "bundler", ">= 1.0.15"
|
|
22
|
-
s.add_dependency "capistrano"
|
|
23
|
-
s.add_dependency "
|
|
22
|
+
s.add_dependency "capistrano"#, "~> 3.0"
|
|
23
|
+
s.add_dependency "net-sftp"
|
|
24
|
+
s.add_dependency "highline"
|
|
24
25
|
s.add_dependency "gli", ">= 1.2.5"
|
|
25
26
|
s.add_dependency "json"
|
|
26
27
|
s.add_dependency "git"
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
###############################
|
|
2
|
+
#
|
|
3
|
+
# Capistrano Deployment on shared Webhosting by RailsHoster
|
|
4
|
+
#
|
|
5
|
+
# maintained by support@railshoster.de
|
|
6
|
+
#
|
|
7
|
+
###############################
|
|
8
|
+
|
|
9
|
+
def gemfile_exists?
|
|
10
|
+
File.exists? "Gemfile"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def gemfile_lock_exists?
|
|
14
|
+
File.exists? "Gemfile.lock"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def rails_version
|
|
18
|
+
stdout = `bundle list rails`
|
|
19
|
+
matches = stdout.scan(/\/rails-(\d+\.\d+\.\d+)$/).first
|
|
20
|
+
matches ? matches.first : nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def rails_version_supports_assets?
|
|
24
|
+
rv = rails_version
|
|
25
|
+
rv ? rv >= "3.1.0" : false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if gemfile_exists? && gemfile_lock_exists?
|
|
29
|
+
require 'bundler/capistrano'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#### Use the asset-pipeline
|
|
33
|
+
|
|
34
|
+
if rails_version_supports_assets?
|
|
35
|
+
load 'deploy/assets'
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#### Personal Settings
|
|
39
|
+
## User and Password
|
|
40
|
+
|
|
41
|
+
# user to login to the target server
|
|
42
|
+
set :user, "<%= app["u"] %>"
|
|
43
|
+
|
|
44
|
+
<% if app["public_ssh_key"] then %>
|
|
45
|
+
|
|
46
|
+
# allow SSH-Key-Forwarding
|
|
47
|
+
set :ssh_options, { :forward_agent => true }
|
|
48
|
+
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "<%= app["public_ssh_key"] %>")]
|
|
49
|
+
<% else %>
|
|
50
|
+
|
|
51
|
+
# password to login to the target server
|
|
52
|
+
set :password, "<%= app["p"] %>"
|
|
53
|
+
|
|
54
|
+
<% end %>
|
|
55
|
+
|
|
56
|
+
## Application name and repository
|
|
57
|
+
|
|
58
|
+
# application name ( should be rails1 rails2 rails3 ... )
|
|
59
|
+
set :application, "<%= app["a"] %>"
|
|
60
|
+
|
|
61
|
+
# repository location
|
|
62
|
+
set :repository, "<%= app["git"]%>"
|
|
63
|
+
|
|
64
|
+
# :subversionn or :git
|
|
65
|
+
set :scm, :git
|
|
66
|
+
set :scm_verbose, true
|
|
67
|
+
|
|
68
|
+
#### System Settings
|
|
69
|
+
## General Settings ( don't change them please )
|
|
70
|
+
|
|
71
|
+
# run in pty to allow remote commands via ssh
|
|
72
|
+
default_run_options[:pty] = true
|
|
73
|
+
|
|
74
|
+
# don't use sudo it's not necessary
|
|
75
|
+
set :use_sudo, false
|
|
76
|
+
|
|
77
|
+
# set the location where to deploy the new project
|
|
78
|
+
|
|
79
|
+
set :deploy_to, "<%= app["deploy_to"] %>"
|
|
80
|
+
|
|
81
|
+
# live
|
|
82
|
+
<% app["h"].each do |ahost| %>
|
|
83
|
+
role :app, "<%= ahost %>"
|
|
84
|
+
role :web, "<%= ahost %>"
|
|
85
|
+
<% end %>
|
|
86
|
+
|
|
87
|
+
role :db, "<%= app["h"].first %>", :primary => true
|
|
88
|
+
|
|
89
|
+
# railshoster bundler settings
|
|
90
|
+
set :bundle_flags, "--deployment --binstubs"
|
|
91
|
+
|
|
92
|
+
############################################
|
|
93
|
+
# Default Tasks by RailsHoster.de
|
|
94
|
+
############################################
|
|
95
|
+
namespace :deploy do
|
|
96
|
+
desc "Restarting mod_rails with restart.txt"
|
|
97
|
+
task :restart, :roles => :app, :except => { :no_release => true } do
|
|
98
|
+
run "touch #{current_path}/tmp/restart.txt"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
desc "Additional Symlinks ( database.yml, etc. )"
|
|
102
|
+
task :additional_symlink, :roles => :app do
|
|
103
|
+
run "ln -sf #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
namespace :railshoster do
|
|
108
|
+
desc "Show the url of your app."
|
|
109
|
+
task :appurl do
|
|
110
|
+
puts "\nThe default RailsHoster.com URL of your app is:"
|
|
111
|
+
puts "\n<%= app["app_url"] %>"
|
|
112
|
+
puts "\n"
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if rails_version_supports_assets?
|
|
117
|
+
before "deploy:assets:precompile", "deploy:additional_symlink"
|
|
118
|
+
after "deploy:create_symlink", "deploy:migrate"
|
|
119
|
+
else
|
|
120
|
+
after "deploy:create_symlink", "deploy:additional_symlink", "deploy:migrate"
|
|
121
|
+
end
|
|
122
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
###############################
|
|
2
|
+
#
|
|
3
|
+
# Capistrano Deployment on shared Webhosting by RailsHoster
|
|
4
|
+
#
|
|
5
|
+
# maintained by support@railshoster.de
|
|
6
|
+
#
|
|
7
|
+
###############################
|
|
8
|
+
|
|
9
|
+
def gemfile_exists?
|
|
10
|
+
File.exists? "Gemfile"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def gemfile_lock_exists?
|
|
14
|
+
File.exists? "Gemfile.lock"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def rails_version
|
|
18
|
+
stdout = `bundle list rails`
|
|
19
|
+
matches = stdout.scan(/\/rails-(\d+\.\d+\.\d+)$/).first
|
|
20
|
+
matches ? matches.first : nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def rails_version_supports_assets?
|
|
24
|
+
rv = rails_version
|
|
25
|
+
rv ? rv >= "3.1.0" : false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if gemfile_exists? && gemfile_lock_exists?
|
|
29
|
+
begin
|
|
30
|
+
require 'capistrano/bundler'
|
|
31
|
+
rescue LoadError
|
|
32
|
+
puts 'You should add capistrano-bundler to your Gemfile to use bundler integration'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
#### Use the asset-pipeline and setup bulder
|
|
37
|
+
|
|
38
|
+
set :bundle_roles, :all
|
|
39
|
+
set :bundle_servers, -> { release_roles(fetch(:bundle_roles)) }
|
|
40
|
+
set :bundle_binstubs, -> { shared_path.join('bin') }
|
|
41
|
+
set :bundle_without, %w{development test}.join(' ')
|
|
42
|
+
set :bundle_path, -> { shared_path.join('bundle') }
|
|
43
|
+
set :bundle_flags, '--deployment --quiet'
|
|
44
|
+
set :bundle_bins, %w{gem rake rails}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if rails_version_supports_assets?
|
|
48
|
+
begin
|
|
49
|
+
require 'capistrano/rails/assets'
|
|
50
|
+
rescue LoadError
|
|
51
|
+
puts 'You should add capistrano-rails to your Gemfile to use assets integration'
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#### Personal Settings
|
|
57
|
+
|
|
58
|
+
# application name ( should be rails1 rails2 rails3 ... )
|
|
59
|
+
set :application, "<%= app['a'] %>"
|
|
60
|
+
|
|
61
|
+
# repository location
|
|
62
|
+
set :repo_url, "<%= app['git'] %>"
|
|
63
|
+
|
|
64
|
+
# :subversionn or :git
|
|
65
|
+
set :scm, :git
|
|
66
|
+
set :scm_verbose, true
|
|
67
|
+
|
|
68
|
+
<% if app["public_ssh_key"] then %>
|
|
69
|
+
|
|
70
|
+
# allow SSH-Key-Forwarding
|
|
71
|
+
set(:ssh_options, {
|
|
72
|
+
:forward_agent => true,
|
|
73
|
+
:auth_methods => %w{publickey password},
|
|
74
|
+
:keys => [File.join(ENV["HOME"], ".ssh", "<%= app["public_ssh_key"] %>")]
|
|
75
|
+
})
|
|
76
|
+
<% else %>
|
|
77
|
+
|
|
78
|
+
# password to login to the target server
|
|
79
|
+
set(:ssh_options, {
|
|
80
|
+
:forward_agent => true,
|
|
81
|
+
:auth_methods => %w{publickey password},
|
|
82
|
+
:password => "<%= app["p"] %>"
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
<% end %>
|
|
86
|
+
|
|
87
|
+
# live
|
|
88
|
+
<% app["h"].each do |ahost| %>
|
|
89
|
+
server("<%= ahost %>", {
|
|
90
|
+
:user => "<%= app['u'] %>",
|
|
91
|
+
:roles => [:web, :app]
|
|
92
|
+
})
|
|
93
|
+
<% end %>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
server("<%= app['h'].first %>", {
|
|
97
|
+
:user => "<%= app['u'] %>",
|
|
98
|
+
:roles => :db,
|
|
99
|
+
:primary => true
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
# set the location where to deploy the new project
|
|
103
|
+
set :deploy_to, "<%= app["deploy_to"] %>"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
set :assets_roles, :app
|
|
107
|
+
set :assets_prefix, 'assets'
|
|
108
|
+
|
|
109
|
+
set :linked_dirs, fetch(:linked_dirs, []).push("public/#{fetch(:assets_prefix)}")
|
|
110
|
+
set :migration_role, :db
|
|
111
|
+
|
|
112
|
+
# change the environment if needed
|
|
113
|
+
set :rails_env, :production
|
|
114
|
+
|
|
115
|
+
# enable migration tasks if the deploy.rb was used into a rails app
|
|
116
|
+
if rails_version
|
|
117
|
+
begin
|
|
118
|
+
require 'capistrano/rails/migrations'
|
|
119
|
+
rescue LoadError
|
|
120
|
+
puts 'You should add capistrano-rails to your Gemfile to use standart features like migrations'
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# don't use sudo it's not necessary
|
|
126
|
+
set :use_sudo, false
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
############################################
|
|
131
|
+
# Default Tasks by RailsHoster.de
|
|
132
|
+
############################################
|
|
133
|
+
|
|
134
|
+
namespace :deploy do
|
|
135
|
+
desc "Restarting mod_rails with restart.txt"
|
|
136
|
+
task :restart do
|
|
137
|
+
on roles(:app), :in => :sequence, :wait => 5 do
|
|
138
|
+
execute "touch #{fetch(:current_path)}/tmp/restart.txt"
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
desc "Additional Symlinks ( database.yml, etc. )"
|
|
143
|
+
after :updating, :additional_symlink do
|
|
144
|
+
on roles(:app) do
|
|
145
|
+
execute "ln -fs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
metadata
CHANGED
|
@@ -1,137 +1,183 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railshoster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.0.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Julian Fischer
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: bundler
|
|
16
|
-
requirement:
|
|
17
|
-
none: false
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
16
|
requirements:
|
|
19
17
|
- - ! '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: 1.0.15
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
|
-
version_requirements:
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ! '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 1.0.15
|
|
25
27
|
- !ruby/object:Gem::Dependency
|
|
26
28
|
name: capistrano
|
|
27
|
-
requirement:
|
|
28
|
-
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ! '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: net-sftp
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
44
|
requirements:
|
|
30
45
|
- - ! '>='
|
|
31
46
|
- !ruby/object:Gem::Version
|
|
32
47
|
version: '0'
|
|
33
48
|
type: :runtime
|
|
34
49
|
prerelease: false
|
|
35
|
-
version_requirements:
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ! '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
36
55
|
- !ruby/object:Gem::Dependency
|
|
37
|
-
name:
|
|
38
|
-
requirement:
|
|
39
|
-
none: false
|
|
56
|
+
name: highline
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
40
58
|
requirements:
|
|
41
59
|
- - ! '>='
|
|
42
60
|
- !ruby/object:Gem::Version
|
|
43
61
|
version: '0'
|
|
44
62
|
type: :runtime
|
|
45
63
|
prerelease: false
|
|
46
|
-
version_requirements:
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ! '>='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
47
69
|
- !ruby/object:Gem::Dependency
|
|
48
70
|
name: gli
|
|
49
|
-
requirement:
|
|
50
|
-
none: false
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
51
72
|
requirements:
|
|
52
73
|
- - ! '>='
|
|
53
74
|
- !ruby/object:Gem::Version
|
|
54
75
|
version: 1.2.5
|
|
55
76
|
type: :runtime
|
|
56
77
|
prerelease: false
|
|
57
|
-
version_requirements:
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ! '>='
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 1.2.5
|
|
58
83
|
- !ruby/object:Gem::Dependency
|
|
59
84
|
name: json
|
|
60
|
-
requirement:
|
|
61
|
-
none: false
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
62
86
|
requirements:
|
|
63
87
|
- - ! '>='
|
|
64
88
|
- !ruby/object:Gem::Version
|
|
65
89
|
version: '0'
|
|
66
90
|
type: :runtime
|
|
67
91
|
prerelease: false
|
|
68
|
-
version_requirements:
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ! '>='
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
69
97
|
- !ruby/object:Gem::Dependency
|
|
70
98
|
name: git
|
|
71
|
-
requirement:
|
|
72
|
-
none: false
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
100
|
requirements:
|
|
74
101
|
- - ! '>='
|
|
75
102
|
- !ruby/object:Gem::Version
|
|
76
103
|
version: '0'
|
|
77
104
|
type: :runtime
|
|
78
105
|
prerelease: false
|
|
79
|
-
version_requirements:
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ! '>='
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
80
111
|
- !ruby/object:Gem::Dependency
|
|
81
112
|
name: erubis
|
|
82
|
-
requirement:
|
|
83
|
-
none: false
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
84
114
|
requirements:
|
|
85
115
|
- - ! '>='
|
|
86
116
|
- !ruby/object:Gem::Version
|
|
87
117
|
version: '0'
|
|
88
118
|
type: :runtime
|
|
89
119
|
prerelease: false
|
|
90
|
-
version_requirements:
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ! '>='
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
91
125
|
- !ruby/object:Gem::Dependency
|
|
92
126
|
name: activesupport
|
|
93
|
-
requirement:
|
|
94
|
-
none: false
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
95
128
|
requirements:
|
|
96
129
|
- - ! '>='
|
|
97
130
|
- !ruby/object:Gem::Version
|
|
98
131
|
version: '0'
|
|
99
132
|
type: :runtime
|
|
100
133
|
prerelease: false
|
|
101
|
-
version_requirements:
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ! '>='
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
102
139
|
- !ruby/object:Gem::Dependency
|
|
103
140
|
name: rspec
|
|
104
|
-
requirement:
|
|
105
|
-
none: false
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
106
142
|
requirements:
|
|
107
143
|
- - ! '>='
|
|
108
144
|
- !ruby/object:Gem::Version
|
|
109
145
|
version: '0'
|
|
110
146
|
type: :development
|
|
111
147
|
prerelease: false
|
|
112
|
-
version_requirements:
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ! '>='
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
113
153
|
- !ruby/object:Gem::Dependency
|
|
114
154
|
name: fakefs
|
|
115
|
-
requirement:
|
|
116
|
-
none: false
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
117
156
|
requirements:
|
|
118
157
|
- - ! '>='
|
|
119
158
|
- !ruby/object:Gem::Version
|
|
120
159
|
version: '0'
|
|
121
160
|
type: :development
|
|
122
161
|
prerelease: false
|
|
123
|
-
version_requirements:
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ! '>='
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
124
167
|
- !ruby/object:Gem::Dependency
|
|
125
168
|
name: mocha
|
|
126
|
-
requirement:
|
|
127
|
-
none: false
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
170
|
requirements:
|
|
129
171
|
- - ! '>='
|
|
130
172
|
- !ruby/object:Gem::Version
|
|
131
173
|
version: '0'
|
|
132
174
|
type: :development
|
|
133
175
|
prerelease: false
|
|
134
|
-
version_requirements:
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - ! '>='
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: '0'
|
|
135
181
|
description: Easily deploy your Rails app to RailsHoster.com by using this gem.
|
|
136
182
|
email:
|
|
137
183
|
- fischer@enterprise-rails.de
|
|
@@ -152,6 +198,7 @@ files:
|
|
|
152
198
|
- Rakefile
|
|
153
199
|
- bin/railshoster
|
|
154
200
|
- gemfiles/Gemfile.ci
|
|
201
|
+
- gemfiles/Gemfile.ci.lock
|
|
155
202
|
- lib/init.rb
|
|
156
203
|
- lib/railshoster.rb
|
|
157
204
|
- lib/railshoster/app_url_command.rb
|
|
@@ -162,6 +209,7 @@ files:
|
|
|
162
209
|
- lib/railshoster/command.rb
|
|
163
210
|
- lib/railshoster/deploy_command.rb
|
|
164
211
|
- lib/railshoster/error.rb
|
|
212
|
+
- lib/railshoster/general_capistrano_helpers.rb
|
|
165
213
|
- lib/railshoster/init_capistrano_helpers.rb
|
|
166
214
|
- lib/railshoster/init_command.rb
|
|
167
215
|
- lib/railshoster/init_database_helpers.rb
|
|
@@ -191,28 +239,29 @@ files:
|
|
|
191
239
|
- spec/lib/railshoster/utilities_spec.rb
|
|
192
240
|
- spec/spec_helper.rb
|
|
193
241
|
- templates/h/deploy.rb.erb
|
|
242
|
+
- templates/h/deploy_version_2.rb.erb
|
|
243
|
+
- templates/h/deploy_version_3.rb.erb
|
|
194
244
|
homepage: http://www.railshoster.com
|
|
195
245
|
licenses: []
|
|
246
|
+
metadata: {}
|
|
196
247
|
post_install_message:
|
|
197
248
|
rdoc_options: []
|
|
198
249
|
require_paths:
|
|
199
250
|
- lib
|
|
200
251
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
|
-
none: false
|
|
202
252
|
requirements:
|
|
203
253
|
- - ! '>='
|
|
204
254
|
- !ruby/object:Gem::Version
|
|
205
255
|
version: '0'
|
|
206
256
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
|
-
none: false
|
|
208
257
|
requirements:
|
|
209
258
|
- - ! '>='
|
|
210
259
|
- !ruby/object:Gem::Version
|
|
211
260
|
version: '0'
|
|
212
261
|
requirements: []
|
|
213
262
|
rubyforge_project: railshoster
|
|
214
|
-
rubygems_version:
|
|
263
|
+
rubygems_version: 2.2.2
|
|
215
264
|
signing_key:
|
|
216
|
-
specification_version:
|
|
217
|
-
summary: RailsHoster
|
|
265
|
+
specification_version: 4
|
|
266
|
+
summary: RailsHoster Application Deployment Suite
|
|
218
267
|
test_files: []
|