lbhrr 1.0.0 → 1.0.6

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 +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: fffc06ffb0010dbc2c65b66567a13f3da1ec40c38455e94752759b6c7e9b2d92
4
- data.tar.gz: 89ca58e74fbdcd9e7bc2bd46b972c39249d510e3d3a1731dffc57f1edcce45e5
3
+ metadata.gz: 14f484333308696cc1f728428f328b3c8330b466ddd7dabbcf0bfe7bf61f22fb
4
+ data.tar.gz: b0b574e3cc24289433bf65f312812732615f8e62045b2c31e84068a38eaeb0c3
5
5
  SHA512:
6
- metadata.gz: 90ab791268e10b4846a8679a66ab1a666e9c3bf16f753681babe97f7c2ca2e2baf457b454763ce0407635f2dc423fdcc9011f0abbfacf4963fa168b237222169
7
- data.tar.gz: 39021ee7bbf173c16e2afd5a89ba7cfe1d38c1834f984fd91493cb15225d2f27a05c92d9d58a6f45a7b0df317487ab90c159156cb8d03a2ad689f97747aab899
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 --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.0"
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.0
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-02 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