lbhrr 1.0.1 → 1.0.6

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 +16 -21
  3. data/lib/lbhrr/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d366665ce2d3cf11822b1e3307de0d9da799428ad5ba420ac9a78aa526b3886
4
- data.tar.gz: 5fff131ca6d144186e5d3587c3b2cfbbe0cd35f5bbb70772f711bf50c0a6aabd
3
+ metadata.gz: 14f484333308696cc1f728428f328b3c8330b466ddd7dabbcf0bfe7bf61f22fb
4
+ data.tar.gz: b0b574e3cc24289433bf65f312812732615f8e62045b2c31e84068a38eaeb0c3
5
5
  SHA512:
6
- metadata.gz: bf8db87c2979d12bcce92c3372c3e8202914a13e1d9f1a29c85d66ca593e650f222cb0df08a525eef5a1f07964049363b73d622eb2190d9d242b703e82868dde
7
- data.tar.gz: 9d21b6364f353fcaae039d1e5d7cbf7fdb87eaaca68b42d66478afd91218e985ad7cf4dcaafe4db613d358afe962160fee866c2e354797c6f3ecc0e50efbda28
6
+ metadata.gz: f861df26bfb215ecfa3adff8fabb2887df18dfd70dfe7f6ab5abf5dbda58419554db12ac3dfb067ae5849a49f52122504d2688afdcf7fa056b5237ee3f563c3b
7
+ data.tar.gz: 3eac4bdf9442f160a75c8e6a22e8e28169d7c0b14c71572a1361d1c6d6cbabaf18d96a37caa0b0f6f69c80e5e3d169036c33d6f8102ce05a133edf05f4f367dd
data/exe/lbhrr CHANGED
@@ -77,6 +77,7 @@ class LbhrrCLI < Thor
77
77
 
78
78
  def create_example_local_config
79
79
  example_local_config = {
80
+ 'name' => File.basename(Dir.pwd),
80
81
  'version' => '0',
81
82
  'host' => "#{File.basename(Dir.pwd)}.harbr.zero2one.ee'"
82
83
  }
@@ -166,7 +167,6 @@ class LbhrrCLI < Thor
166
167
  end
167
168
 
168
169
 
169
-
170
170
  desc "deploy", "Deploy an application using the configuration from config/manifest.yml"
171
171
  def deploy
172
172
  begin
@@ -187,37 +187,32 @@ class LbhrrCLI < Thor
187
187
  basename = File.basename(Dir.pwd)
188
188
  base_directory = "/var/harbr/#{basename}"
189
189
  versions_directory = "#{base_directory}/versions"
190
- previous_version_path = "#{versions_directory}/#{version - 1}"
191
190
  destination_path = "#{versions_directory}/#{version}"
192
191
  current_path = "#{base_directory}/current"
193
192
 
194
193
  # Check and create the versions directory on the server
195
194
  system("ssh #{user}@#{host} 'mkdir -p #{versions_directory}'")
196
195
 
197
- # Copy the previous version to the new version directory if it exists
198
- system("ssh #{user}@#{host} '[ -d #{previous_version_path} ] && cp -R #{previous_version_path} #{destination_path} || mkdir -p #{destination_path}'")
199
-
200
- # Obtain the list of files tracked by Git and write to a temp file
201
- git_tracked_files = `git ls-files`.split("\n")
202
- Tempfile.create('git_files') do |tempfile|
203
- git_tracked_files.each { |file| tempfile.puts(file) }
204
- tempfile.close
205
-
206
- # Rsync files to the new version directory and update the symlink
207
- if system("rsync -avz --exclude=.git --files-from=#{tempfile.path} ./ #{user}@#{host}:#{destination_path}") &&
208
- system("ssh #{user}@#{host} 'ln -sfn #{destination_path} #{current_path}'")
209
- puts "Successfully deployed application version #{version} to #{host}"
210
- increment_version(local_manifest_path, version)
211
- deployed(version)
212
- else
213
- puts "Failed to deploy application version #{version} to #{host}"
214
- end
196
+ # Prepare the rsync exclude option using .gitignore
197
+ gitignore_path = File.join(Dir.pwd, '.gitignore')
198
+ exclude_option = File.exist?(gitignore_path) ? "--exclude='.git' --exclude-from='#{gitignore_path}'" : ""
199
+
200
+ # Rsync files to the new version directory, excluding files as per .gitignore
201
+ rsync_command = "rsync -avz #{exclude_option} ./ #{user}@#{host}:#{destination_path}"
202
+
203
+ if system(rsync_command) &&
204
+ system("ssh #{user}@#{host} 'ln -sfn #{destination_path} #{current_path}'")
205
+ puts "Successfully deployed application version #{version} to #{host}"
206
+ increment_version(local_manifest_path, version)
207
+ deployed(version)
208
+ else
209
+ puts "Failed to deploy application version #{version} to #{host}"
215
210
  end
216
211
  rescue => e
217
212
  puts "Deployment error: #{e.message}"
218
213
  end
219
214
  end
220
- # new method goes here
215
+
221
216
 
222
217
  end
223
218
 
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.1"
4
+ VERSION = "1.0.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbhrr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-04 00:00:00.000000000 Z
11
+ date: 2023-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh