lbhrr 1.0.22 → 1.0.24

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/lbhrr +62 -54
  3. data/lib/lbhrr/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8283276d5bf89e33e6cdf8068ea2e4ed8ff7f58a955a1f93c913a8012b8da95b
4
- data.tar.gz: 8bdca3fa3fead999888a1661fa1cea9b02cdc33c918a5ed2d07ca21a60281c37
3
+ metadata.gz: dd06f5b2b2c2ead4e766e8db02df61b8e698cbf9a45c96ab63724c74644114d6
4
+ data.tar.gz: e2c15f6103ed1a0f4a1d9f356bb08ad7fdb8e7f6ac6245d27ef1eb0ee9c912be
5
5
  SHA512:
6
- metadata.gz: 473725a676dcd369011cce1067cb20b60e613a3612ff0bd74c7e85eccfa7ad8a0bc09b4244d79e232344c60c4af932b6e97d45bd5596465cc6c6fd0b600960ee
7
- data.tar.gz: 5575e5aad6d2e5198b465847eef34cf21ced867d43e6c2fbe9a2111384036b087edfa9a67e83bf44df73e9d9b7945454245c5c3198c4b7da8e81ea41091af5dc
6
+ metadata.gz: 5ed7d928a8b43c5930aff091d063589843daf4d4975bf0f08f983e28492d4abadd5560477637747bb81cf581605125f8b426dc18d6730de7e8191a7c56c70178
7
+ data.tar.gz: 273804677d3c8e4bdb2916d9f5a09ea201a40ddc118c831c2942db69b81136f6fddf08c75980a818199beb5dc839f0769ddafd36ddf7f2bb8d74e973ff2d14d4
data/exe/lbhrr CHANGED
@@ -5,7 +5,7 @@ class LbhrrCLI < Thor
5
5
  no_commands do
6
6
 
7
7
  def manifest?
8
- File.join(Dir.pwd, "config","manifest.yml")
8
+ File.exist? File.join(Dir.pwd, "config","manifest.yml")
9
9
  end
10
10
 
11
11
  def package
@@ -32,8 +32,7 @@ class LbhrrCLI < Thor
32
32
  system("git add .") or raise "Failed to add changes to Git"
33
33
  system("git commit -m 'packaged #{version}'") or raise "Failed to commit changes to Git"
34
34
  puts "Packaging completed successfully."
35
- rescue => e
36
- puts "Packaging error: #{e.message}"
35
+
37
36
  end
38
37
 
39
38
  def amend_last_commit(new_message)
@@ -194,7 +193,13 @@ class LbhrrCLI < Thor
194
193
  user = config["user"]
195
194
 
196
195
  if name.nil?
197
- name = File.basename(Dir.pwd)
196
+
197
+ unless manifest?
198
+ puts "no manifest found!"
199
+ return
200
+ end
201
+
202
+ name = config["name"]
198
203
  end
199
204
 
200
205
  puts "Destroying app: #{name}"
@@ -205,50 +210,51 @@ class LbhrrCLI < Thor
205
210
 
206
211
  desc "raise", "Deploy an application using the configuration from config/manifest.yml to staging"
207
212
  def raise
208
- unless manifest?
213
+ if manifest?
214
+
215
+ package
216
+
217
+
218
+ config = load_configuration
219
+ host = config["host"]
220
+ user = config["user"]
221
+ raise "Host configuration missing" unless host
222
+
223
+ local_manifest_path = File.join(Dir.pwd, "config", "manifest.yml")
224
+ raise "Local manifest file not found at #{local_manifest_path}" unless File.exist?(local_manifest_path)
225
+
226
+ local_config = YAML.load_file(local_manifest_path) || {}
227
+ version = local_config["version"].to_i
228
+ raise "Version not specified in manifest.yml" unless version
229
+
230
+ basename = File.basename(Dir.pwd)
231
+ base_directory = "/var/harbr/containers/#{basename}"
232
+ versions_directory = "#{base_directory}/versions"
233
+ data_directory = "/var/dddr/#{basename}/"
234
+ destination_path = "#{versions_directory}/#{version}"
235
+ # Prepare the rsync exclude option using .gitignore
236
+ gitignore_path = File.join(Dir.pwd, ".gitignore")
237
+ exclude_option = File.exist?(gitignore_path) ? "--exclude='.git' --exclude-from='#{gitignore_path}'" : ""
238
+
239
+
240
+ # Check and create the versions directory on the server
241
+ `ssh #{user}@#{host} 'mkdir -p #{versions_directory}'`
242
+ `ssh #{user}@#{host} 'mkdir -p #{data_directory}'`
243
+
244
+ # Rsync files to the new version directory, excluding files as per .gitignore
245
+ rsync_command = "rsync -avz #{exclude_option} ./ #{user}@#{host}:#{destination_path}"
246
+
247
+ if `#{rsync_command}`
248
+ puts "Successfully deployed application version #{version} to #{host}"
249
+ deployed(local_manifest_path, version)
250
+ else
251
+ puts "Failed to deploy application version #{version} to #{host}"
252
+ end
253
+
254
+ else
209
255
  puts "no manifest found!"
210
- return
211
256
  end
212
257
 
213
- package
214
-
215
- config = load_configuration
216
- host = config["host"]
217
- user = config["user"]
218
- raise "Host configuration missing" unless host
219
-
220
- local_manifest_path = File.join(Dir.pwd, "config", "manifest.yml")
221
- raise "Local manifest file not found at #{local_manifest_path}" unless File.exist?(local_manifest_path)
222
-
223
- local_config = YAML.load_file(local_manifest_path) || {}
224
- version = local_config["version"].to_i
225
- raise "Version not specified in manifest.yml" unless version
226
-
227
- basename = File.basename(Dir.pwd)
228
- base_directory = "/var/harbr/containers/#{basename}"
229
- versions_directory = "#{base_directory}/versions"
230
- data_directory = "/var/dddr/#{basename}/"
231
- destination_path = "#{versions_directory}/#{version}"
232
- # Prepare the rsync exclude option using .gitignore
233
- gitignore_path = File.join(Dir.pwd, ".gitignore")
234
- exclude_option = File.exist?(gitignore_path) ? "--exclude='.git' --exclude-from='#{gitignore_path}'" : ""
235
-
236
-
237
- # Check and create the versions directory on the server
238
- `ssh #{user}@#{host} 'mkdir -p #{versions_directory}'`
239
- `ssh #{user}@#{host} 'mkdir -p #{data_directory}'`
240
-
241
- # Rsync files to the new version directory, excluding files as per .gitignore
242
- rsync_command = "rsync -avz #{exclude_option} ./ #{user}@#{host}:#{destination_path}"
243
-
244
- if `#{rsync_command}`
245
- puts "Successfully deployed application version #{version} to #{host}"
246
- deployed(local_manifest_path, version)
247
- else
248
- puts "Failed to deploy application version #{version} to #{host}"
249
- end
250
- rescue => e
251
- puts "Deployment error: #{e.message}"
252
258
  end
253
259
 
254
260
  desc "logs", "Show logs for a container"
@@ -265,7 +271,8 @@ class LbhrrCLI < Thor
265
271
  return
266
272
  end
267
273
 
268
- container_name = File.basename(Dir.pwd)
274
+ container_name = config["name"]
275
+
269
276
  else
270
277
  container_name = name
271
278
  end
@@ -290,15 +297,15 @@ class LbhrrCLI < Thor
290
297
 
291
298
  desc "hoist", "Deploy an application using the configuration from config/manifest.yml to production"
292
299
  def hoist(name=nil)
300
+ config = load_configuration
301
+ host = config["host"]
302
+ user = config["user"]
303
+
293
304
  if name.nil?
294
305
  unless manifest?
295
306
  puts "no manifest found!"
296
307
  return
297
308
  end
298
-
299
- config = load_configuration
300
- host = config["host"]
301
- user = config["user"]
302
309
  name = config["name"]
303
310
  end
304
311
  puts `ssh #{user}@#{host} 'harbr deploy #{name}'`
@@ -306,15 +313,16 @@ class LbhrrCLI < Thor
306
313
 
307
314
  desc "rollback", "rollback an application using the configuration from config/manifest.yml"
308
315
  def rollback(name=nil)
316
+
317
+ config = load_configuration
318
+ host = config["host"]
319
+ user = config["user"]
320
+
309
321
  if name.nil?
310
322
  unless manifest?
311
323
  puts "no manifest found!"
312
324
  return
313
325
  end
314
-
315
- config = load_configuration
316
- host = config["host"]
317
- user = config["user"]
318
326
  name = config["name"]
319
327
  end
320
328
  puts `ssh #{user}@#{host} 'harbr rollback #{name}'`
data/lib/lbhrr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lbhrr
4
- VERSION = "1.0.22"
4
+ VERSION = "1.0.24"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbhrr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.22
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke