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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGVkZTJjMDhlOWI1MTNiMzgyYzBiOWE2ZmM0ZDUwMzQ1YTAxNjk3Ng==
4
+ NWY0MDIwNDgxMGQ3ZTRmYjYwZjI2NmUwNmZhOGUxZjdiZGQ4NTI2MQ==
5
5
  data.tar.gz: !binary |-
6
- ZTA2MzAwYjUwNDRhMTI0YjFjYjkxYjY2ZTdhMzI5ZDFmOWY5NzMxNQ==
6
+ NTNlYTZhNGUyNjkxY2JlOTUxZTgxZmM2YjcwOTMwNDFmOGRkNGZkNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmVlNDg5MDRmM2JkZjc4YzA4Mjc0MzZlMWUzNjU0ZWY3NWVmY2RkOWM4Y2Fi
10
- MDI3NjQyNTk5YTA1ZDRiZGQ0Y2JkNWU4NTRhNWQwYmY2MzRiZThhNzVkNzVj
11
- NjlhMzE2NDgyOWJlNGQ1YzQ2ZTJjMGY0ZmJkNzJmZDgwZGNkMzk=
9
+ NDAwNDBlMTE1NTZmY2RiMWVlMDlhYzU0Zjc5NGI2OGM1NTQ4YzViZmEzZmU1
10
+ YTM2MTYyOWQ2ODYwMTc0N2RlNzE3ZGNjYjYwZDM1YjdlYzgwNzZiMzIwMjJk
11
+ NWMzN2Q4NzQwZWFkNDcyZjczNWFmYzg2NTI3NTcwZGM5ZmUzODA=
12
12
  data.tar.gz: !binary |-
13
- YzhmODc0OWQ1MDRkNjE1ZTY1NmIwOWRhNzJiNTA3YzI5YmZmZGJmZDg5Njk0
14
- NDM0YmExZGMwNWFjNzNmNzBhZDUxNmZkNWFmN2ZkNTg2MDA3ZjI0ZTE3OGRl
15
- MzVlMjlmMjNjODZhZWVmN2UyNmU4M2EzOWE1ZjAxYzBiZDA3ZTE=
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
- symlink_directory(dir, RemoteConfig.release_to) unless RemoteConfig.release_to == File.readlink(dir)
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 "clean N", "[remote, plumbing] Deletes old releases, keeping the N most recent (by mtime)"
158
- def clean(n=4)
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 :clean, "Deleting #{dir}"
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
@@ -1,3 +1,3 @@
1
1
  module Egads
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: egads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Suggs