diff options
author | mms <git@sapka.me> | 2025-01-08 21:24:33 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2025-01-08 21:24:33 +0100 |
commit | 4004a55b0e324c35cbc7d58b831e49efd484ab93 (patch) | |
tree | 3ff4c68c28165b6d08c1a49532e8421193433d65 /new/lib/crys/deployer.rb | |
parent | 2781360c7c25404c5a1fd03ed3472d43367ed8c6 (diff) |
feat: rubocop
Diffstat (limited to 'new/lib/crys/deployer.rb')
-rw-r--r-- | new/lib/crys/deployer.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/new/lib/crys/deployer.rb b/new/lib/crys/deployer.rb new file mode 100644 index 00000000..501ea046 --- /dev/null +++ b/new/lib/crys/deployer.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'rsync' + +module Crys + class Deployer + DEST_PREFIX = '/usr/local/sites/' + + def initialize(dest:, source:) + @dest = dest + @source = source + + Rsync.configure do |config| + config.host = 'mms@10.0.7.0' + end + end + + def run + puts "source: #{source}" + full_dest = DEST_PREFIX + dest + puts "dest: #{full_dest}" + + Rsync.run(source, full_dest, ['-rtz']) do |result| + if result.success? + result.changes.each do |change| + puts "#{change.filename} (#{change.summary})" + end + else + puts result.error + end + end + end + + private + + attr_reader :dest, :source + end +end |