egads 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/egads/cli.rb +29 -5
- data/lib/egads/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWY0MDIwNDgxMGQ3ZTRmYjYwZjI2NmUwNmZhOGUxZjdiZGQ4NTI2MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTNlYTZhNGUyNjkxY2JlOTUxZTgxZmM2YjcwOTMwNDFmOGRkNGZkNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDAwNDBlMTE1NTZmY2RiMWVlMDlhYzU0Zjc5NGI2OGM1NTQ4YzViZmEzZmU1
|
10
|
+
YTM2MTYyOWQ2ODYwMTc0N2RlNzE3ZGNjYjYwZDM1YjdlYzgwNzZiMzIwMjJk
|
11
|
+
NWMzN2Q4NzQwZWFkNDcyZjczNWFmYzg2NTI3NTcwZGM5ZmUzODA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzMxZWU1ZjkzNjdiYmYwYTI3NTVlNjQ1NzVhZmE1YTg5NTU5YjMyNzFlMTMw
|
14
|
+
MTMwNmQ4NDI2ZThlZjMxOGQ1OWQxNGQ4ZTE2YzNhMWE4YjgwMmZiZmFiMDRh
|
15
|
+
MThhYzY4YmZkMWQ2MDc5NWFkMTA3NDdjNDQ3ODA4MjVjOTM5ODk=
|
data/lib/egads/cli.rb
CHANGED
@@ -124,6 +124,16 @@ module Egads
|
|
124
124
|
if shared_path = ENV['SHARED_PATH']
|
125
125
|
symlink_directory File.join(shared_path, 'system'), File.join(dir, 'public', 'system')
|
126
126
|
symlink_directory File.join(shared_path, 'log'), File.join(dir, 'log')
|
127
|
+
|
128
|
+
# Symlink config files
|
129
|
+
shared_config = File.join(shared_config, 'config')
|
130
|
+
if File.directory?(shared_config)
|
131
|
+
Dir.glob("#{shared_config}/*").each do |source|
|
132
|
+
basename = File.basename(source)
|
133
|
+
destination = File.join(dir, 'config', basename)
|
134
|
+
symlink(source, destination)
|
135
|
+
end
|
136
|
+
end
|
127
137
|
end
|
128
138
|
|
129
139
|
run_hooks_for(:stage, :after)
|
@@ -144,23 +154,30 @@ module Egads
|
|
144
154
|
run_hooks_for(:release, :before)
|
145
155
|
end
|
146
156
|
|
147
|
-
|
157
|
+
# destination of the current symlink
|
158
|
+
current_release = File.readlink(RemoteConfig.release_to) rescue nil
|
159
|
+
unless dir == current_release
|
160
|
+
# Symlink this release to the release_to
|
161
|
+
symlink_directory(dir, RemoteConfig.release_to) unless dir == current_release
|
162
|
+
end
|
163
|
+
|
148
164
|
inside RemoteConfig.release_to do
|
149
165
|
# Restart services
|
150
166
|
run_or_die(RemoteConfig.restart_command)
|
151
167
|
run_hooks_for(:release, :after)
|
152
168
|
end
|
153
|
-
invoke(:clean)
|
154
169
|
|
170
|
+
FileUtils.touch(dir) # Ensure this release isn't trimmed
|
171
|
+
invoke(:trim, [4])
|
155
172
|
end
|
156
173
|
|
157
|
-
desc "
|
158
|
-
def
|
174
|
+
desc "trim N", "[remote, plumbing] Deletes old releases, keeping the N most recent (by mtime)"
|
175
|
+
def trim(n=4)
|
159
176
|
inside RemoteConfig.extract_to do
|
160
177
|
dirs = Dir.glob('*').sort_by{|path| File.mtime(path) }
|
161
178
|
dirs.slice!(n..-1)
|
162
179
|
dirs.each do |dir|
|
163
|
-
say_status :
|
180
|
+
say_status :trim, "Deleting #{dir}"
|
164
181
|
FileUtils.rm_rf(dir)
|
165
182
|
end
|
166
183
|
end
|
@@ -186,5 +203,12 @@ module Egads
|
|
186
203
|
FileUtils.rm_rf(dest)
|
187
204
|
FileUtils.ln_s(src, dest)
|
188
205
|
end
|
206
|
+
|
207
|
+
def symlink(src, dest)
|
208
|
+
raise ArgumentError.new("#{src} is not a file") unless File.file?(src)
|
209
|
+
say_status :symlink, "from #{src} to #{dest}"
|
210
|
+
FileUtils.ln_sf(src, dest)
|
211
|
+
end
|
212
|
+
|
189
213
|
end
|
190
214
|
end
|
data/lib/egads/version.rb
CHANGED