go-deploy 1.0.5 → 1.0.6
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 +4 -4
- data/lib/go_deploy/deploy.rb +17 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50058ed1eb8d11ed5de965b64fe7199f393f39d92e0d727ce5a11b35846dd29f
|
4
|
+
data.tar.gz: 72cd1cc0ed9a164c397cceb3914da8fcf0e0200a6ced4fa195561f68adfbab2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca05a668523babc01f6165e53027b519ac478b441c37fdc374babf32108e993ce7df9d91926922effb265b36a1cbe50217997e1dde88d17a4f3bdfc221a4740b
|
7
|
+
data.tar.gz: bc63fa11fbb69a17009e4f63724d244687adf6bfdc322473278dbff8919a2fb88b9284ce6a4b29a5ca1f42b15cf1961635a35b556bd40272559c9a7c4edc537d
|
data/lib/go_deploy/deploy.rb
CHANGED
@@ -93,31 +93,38 @@ module GoDeploy
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def git_check
|
96
|
+
@git_repo_url = @service['git_repo_url']
|
96
97
|
puts 'Step 2 git:check'.green
|
97
|
-
@console.exec(ssh: ssh, command: "git ls-remote #{@
|
98
|
+
@console.exec(ssh: ssh, command: "git ls-remote #{@git_repo_url} HEAD")
|
98
99
|
end
|
99
100
|
|
100
101
|
def git_clone
|
101
102
|
@deploy_to = @service['deploy_to']
|
102
103
|
puts 'Step 3 git:clone'.green
|
103
104
|
@console.exec(ssh: ssh, command: "mkdir -p #{@deploy_to}")
|
104
|
-
@console.exec(ssh: ssh, command: "git clone #{@
|
105
|
+
@console.exec(ssh: ssh, command: "git clone #{@git_repo_url} #{@deploy_to}/repo")
|
105
106
|
# clean up files
|
106
107
|
@service['copy_files'].each do |file_name|
|
107
108
|
@console.exec(ssh: ssh, command: "rm -rf #{@deploy_to}/#{file_name}")
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
112
|
+
def git_update
|
113
|
+
puts 'Step 4 git:clone'.green
|
114
|
+
@console.exec(ssh: ssh, command: "cd #{@deploy_to}/repo && git remote set-url origin #{git_repo_url}")
|
115
|
+
@console.exec(ssh: ssh, command: "cd #{@deploy_to}/repo && git remote update --prune")
|
116
|
+
end
|
117
|
+
|
111
118
|
def set_env
|
112
|
-
|
119
|
+
@deploy_env_file = "#{@deploy_to}/repo/.env"
|
113
120
|
@env_file = @service['env_file']
|
114
|
-
puts 'Step
|
115
|
-
@console.log(command: "Uploading #{project_env_file}") if ssh.scp.upload!(@env_file,
|
121
|
+
puts 'Step 5 set:env'.green
|
122
|
+
@console.log(command: "Uploading #{project_env_file}") if ssh.scp.upload!(@env_file, @deploy_env_file)
|
116
123
|
end
|
117
124
|
|
118
125
|
def build_go
|
119
126
|
@service_name = @service['name']
|
120
|
-
puts 'Step
|
127
|
+
puts 'Step 6 build:go'.green
|
121
128
|
@is_restart = @service['is_restart']
|
122
129
|
|
123
130
|
if @is_restart
|
@@ -129,9 +136,8 @@ module GoDeploy
|
|
129
136
|
end
|
130
137
|
|
131
138
|
def copy_files
|
132
|
-
puts 'Step
|
133
|
-
@
|
134
|
-
@console.exec(ssh: ssh, command: "cd #{@deploy_to}/repo && mv .env #{@deploy_to}")
|
139
|
+
puts 'Step 7 copy files'.green
|
140
|
+
@console.exec(ssh: ssh, command: "cd #{@deploy_to}/repo && mv #{@deploy_env_file} #{@deploy_to}")
|
135
141
|
|
136
142
|
@service['copy_files'].each do |file_name|
|
137
143
|
@console.exec(ssh: ssh, command: "cd #{@deploy_to}/repo && mv #{file_name} #{@deploy_to}")
|
@@ -141,7 +147,7 @@ module GoDeploy
|
|
141
147
|
end
|
142
148
|
|
143
149
|
def remove_files
|
144
|
-
puts 'Step
|
150
|
+
puts 'Step 8 removed:files'.green
|
145
151
|
@console.exec(ssh: ssh, command: "cd #{@deploy_to}/repo && mv #{@service_name} #{@deploy_to}")
|
146
152
|
@console.exec(ssh: ssh, command: "rm -rf #{@deploy_to}/repo")
|
147
153
|
@console.exec(ssh: ssh, command: "rm -rf #{@git_wrapper_path}")
|
@@ -149,7 +155,7 @@ module GoDeploy
|
|
149
155
|
end
|
150
156
|
|
151
157
|
def start_go_service
|
152
|
-
puts "Step
|
158
|
+
puts "Step 9 systemctl:start:#{@service_name}".green
|
153
159
|
@console.sudo_exec(ssh: ssh, command: "sudo systemctl start #{@service_name}.service")
|
154
160
|
puts "\tStart #{@service_name} service".green
|
155
161
|
end
|