Sha256: fe1675e251e6442efd6cc2f7f755cb796d350348ca6c987958de734d64f01dd7
Contents?: true
Size: 1.91 KB
Versions: 5
Compression:
Stored size: 1.91 KB
Contents
require 'karo/config' require 'thor' module Karo class Assets < Thor include Thor::Actions class_option :config_file, type: :string, default: Config.default_file_name, aliases: "-c", desc: "name of the file containing server configuration" class_option :environment, aliases: "-e", desc: "server environment", default: "production" 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
karo-1.5.0 | lib/karo/assets.rb |
karo-1.4.0 | lib/karo/assets.rb |
karo-1.3.0 | lib/karo/assets.rb |
karo-1.2.1 | lib/karo/assets.rb |
karo-1.2.0 | lib/karo/assets.rb |