immosquare-capistrano 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d21992d6862c4412d439d94e332daa87bd4388d897968d622cbcfec44b288f55
|
4
|
+
data.tar.gz: d4038ca94a06375b0c01c74f09c94678cf397ac538d866b940b0968cdb9dbecd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76a896e2b628412f9bb2a4b1b4ade6c8def6020dbe73430c64d9c86739b723d7050fc544f9d00a2271d7110ebed1a3d6c50aacc3f61e3061a7b38e8954343313
|
7
|
+
data.tar.gz: dc02e35d9e183637e9ce333605b071ef3473c1c25892b8cc0bb23f14d8c2afae91f81b50f9af2696e705ca57de3a46288ab706543eedbc9c3caa15b72bb505ec
|
@@ -14,11 +14,5 @@ namespace :load do
|
|
14
14
|
## SolidQueue
|
15
15
|
##============================================================##
|
16
16
|
set_if_empty :solid_queue_service_unit_name, -> { "solid_queue_#{fetch(:application)}_#{fetch(:stage)}" }
|
17
|
-
|
18
|
-
##============================================================##
|
19
|
-
## rvm
|
20
|
-
##============================================================##
|
21
|
-
set_if_empty :rvm_ruby_version, -> { "default" }
|
22
|
-
set_if_empty :rvm_map_bins, -> { ["gem", "rake", "ruby", "bundle"] }
|
23
17
|
end
|
24
18
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require_relative "defaults"
|
2
2
|
|
3
|
-
|
4
3
|
##============================================================##
|
5
4
|
## We load rvm tasks
|
6
5
|
##============================================================##
|
@@ -13,5 +12,4 @@ load File.expand_path("tasks/rvm.rake", __dir__)
|
|
13
12
|
##============================================================##
|
14
13
|
Capistrano::DSL.stages.each do |stage|
|
15
14
|
after stage, "rvm:hook"
|
16
|
-
# after stage, "rvm:check"
|
17
15
|
end
|
@@ -13,25 +13,55 @@ namespace :rvm do
|
|
13
13
|
elsif test("[ -d #{rvm_system_path} ]")
|
14
14
|
rvm_system_path
|
15
15
|
else
|
16
|
-
|
16
|
+
error("RVM path not found on server. Please install RVM first")
|
17
|
+
exit(1)
|
17
18
|
end
|
19
|
+
info "RVM path detected: #{rvm_path}"
|
20
|
+
rvm_bin_path = "#{rvm_path}/bin/rvm"
|
18
21
|
|
19
22
|
##============================================================##
|
20
|
-
##
|
23
|
+
## Set the RVM command map
|
21
24
|
##============================================================##
|
22
|
-
|
23
|
-
|
25
|
+
SSHKit.config.command_map[:rvm] = rvm_bin_path
|
24
26
|
|
25
27
|
##============================================================##
|
26
|
-
##
|
28
|
+
## Check if the RVM Ruby version is set
|
27
29
|
##============================================================##
|
28
|
-
|
30
|
+
rvm_ruby_version = fetch(:rvm_ruby_version)
|
31
|
+
if rvm_ruby_version.nil?
|
32
|
+
error "rvm_ruby_version not set. Please set the rvm_ruby_version in your deploy.rb file with format ruby-x.y.z@your-app-name"
|
33
|
+
exit 1
|
34
|
+
elsif rvm_ruby_version !~ /^ruby-\d+\.\d+\.\d+@[a-z0-9\-_]+$/i
|
35
|
+
error "rvm_ruby_version format is invalid. Please set the rvm_ruby_version in your deploy.rb file with format ruby-x.y.z@your-app-name"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
info "rvm_ruby_version set: #{rvm_ruby_version}"
|
29
39
|
|
30
40
|
##============================================================##
|
31
41
|
## Set the RVM prefix for the commands
|
32
42
|
##============================================================##
|
33
|
-
|
34
|
-
SSHKit.config.command_map.prefix[command.to_sym].unshift("#{
|
43
|
+
["gem", "rake", "ruby", "bundle"].each do |command|
|
44
|
+
SSHKit.config.command_map.prefix[command.to_sym].unshift("#{rvm_bin_path} #{rvm_ruby_version} do")
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
##============================================================##
|
49
|
+
## Check if ruby version is installed
|
50
|
+
##============================================================##
|
51
|
+
ruby_version = rvm_ruby_version.split("@").first
|
52
|
+
unless test("#{rvm_bin_path} #{ruby_version} do ruby --version")
|
53
|
+
error "Ruby version #{ruby_version} is not installed on the server. Please install it first with 'rvm install #{ruby_version}'"
|
54
|
+
exit 1
|
55
|
+
end
|
56
|
+
info "#{ruby_version} is installed on the server."
|
57
|
+
|
58
|
+
##============================================================##
|
59
|
+
## Check if gemset exists, if not create it
|
60
|
+
##============================================================##
|
61
|
+
gemset_name = rvm_ruby_version.split("@").last
|
62
|
+
unless test("#{rvm_bin_path} #{rvm_ruby_version} do rvm gemset list | grep -wq #{gemset_name}")
|
63
|
+
info "Creating gemset #{gemset_name} for #{ruby_version}"
|
64
|
+
execute :rvm, "#{ruby_version} do rvm gemset create #{gemset_name}"
|
35
65
|
end
|
36
66
|
end
|
37
67
|
end
|