Class: Karo::Assets
- Inherits:
-
Thor
show all
- Includes:
- Common
- Defined in:
- lib/karo/assets.rb
Instance Method Summary
collapse
Methods included from Common
#branch_exists?, #checkout_branch, #create_and_checkout_branch, #create_branch, #current_branch, #git_repo, #make_command, #run_it
Instance Method Details
#pull ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/karo/assets.rb', line 24
def pull
configuration = Config.load_configuration(options)
assets = configuration["assets"]
assets ||= {}
path_local = assets["local"]
path_local ||= "public/system/dragonfly/development"
path_local = File.expand_path(path_local)
empty_directory path_local if !File.exists?(path_local) && !options[:dryrun]
path_server = assets["server"]
path_server ||= File.join(configuration["path"], "shared/system/dragonfly/#{options[:environment]}")
host = "#{configuration["user"]}@#{configuration["host"]}"
command = "rsync -az --progress #{host}:#{path_server}/ #{path_local}/"
run_it command, options[:verbose]
say "Assets sync complete", :green
end
|
#push ⇒ Object
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/karo/assets.rb', line 61
def push
configuration = Config.load_configuration(options)
assets = configuration["assets"]
assets ||= {}
path_local = assets["local"]
path_local ||= "public/system/dragonfly/development"
path_local = File.expand_path(path_local)
unless File.exists?(path_local)
raise Thor::Error, "Please make sure that this local path exists? '#{path_local}'"
end
host = "#{configuration["user"]}@#{configuration["host"]}"
path_server = assets["server"]
path_server ||= File.join(configuration["path"], "shared/system/dragonfly/#{options[:environment]}")
command_1 = "ssh #{host} 'mkdir -p #{path_server}'"
command_2 = "rsync -az --progress #{path_local}/ #{host}:#{path_server}/"
if yes?("Are you sure?", :yellow)
run_it command_1, options[:verbose]
run_it command_2, options[:verbose]
say "Assets sync complete", :green
else
say "Assets sync cancelled", :yellow
end
end
|