Sha256: 58f41aa60b5094c1d4b6a9a027c5ee936fb5ae85f758272c5a0daba95ee6c23a
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
require 'karo/config' require 'thor' module Karo class Assets < Thor include Thor::Actions desc "pull", "syncs assets from server shared/system/dragonfly/<environment> directory into local system/dragonfly/development directory" def pull configuration = Config.load_configuration(options) path_local = File.expand_path("public/system/dragonfly/development") empty_directory path_local unless File.exists?(path_local) path_server = File.join(configuration["path"], "shared/system/dragonfly/#{options[:environment]}") host = "deploy@#{configuration["host"]}" cmd = "rsync -az --progress #{host}:#{path_server}/ #{path_local}/" system "#{cmd}" say "Assets sync complete", :green end desc "push", "syncs assets from system/dragonfly/development directory into local server shared/system/dragonfly/<environment> directory" def push configuration = Config.load_configuration(options) path_local = File.expand_path("public/system/dragonfly/development") unless File.exists?(path_local) raise Thor::Error, "Please make sure that this local path exists? '#{path_local}'" end host = "deploy@#{configuration["host"]}" path_server = File.join(configuration["path"], "shared/system/dragonfly/#{options[:environment]}") cmd_1 = "ssh #{host} 'mkdir -p #{path_server}'" cmd_2 = "rsync -az --progress #{path_local}/ #{host}:#{path_server}/" if yes?("Are you sure?", :yellow) system "#{cmd_1}" system "#{cmd_2}" say "Assets sync complete", :green else say "Assets sync cancelled", :yellow end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
karo-1.1.0 | lib/karo/assets.rb |
karo-1.0.0 | lib/karo/assets.rb |