lbhrr 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/exe/lbhrr +53 -46
  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: 97455904c9513fd9f6a8c594c5747b85195c9c0e253e2c99d16ca2bc106304d8
4
- data.tar.gz: 6b375eef27e9101c046ba628724df7a9ab467a511bc82123adedf3df7fa04881
3
+ metadata.gz: dd06f5b2b2c2ead4e766e8db02df61b8e698cbf9a45c96ab63724c74644114d6
4
+ data.tar.gz: e2c15f6103ed1a0f4a1d9f356bb08ad7fdb8e7f6ac6245d27ef1eb0ee9c912be
5
5
  SHA512:
6
- metadata.gz: e07cc919f47975a307d68c1f95ccd09a41114bdbfaf9d480f80c359e66729fdae0476eab46461bb6d306ea437b09d96c0ed97ddb51120e2ba6104e83764b5059
7
- data.tar.gz: 2129dee935ff5dd79bebd2e068d75d1bf440c52faf176f9fbf418c7f90e62a543e7b1db30e9d8a9ddbbbb417174e262638fe82574a836a985520e6d6edceff13
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
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.23"
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.23
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke