5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/frank/publish.rb', line 5
def self.execute!
exit_unless_configured
puts "\nFrank is..."
puts " - \033[32mExporting templates\033[0m"
tmp_folder = "/tmp/frankexp-#{Frank.proj_name}"
FileUtils.rm_rf(tmp_folder) if File.exist?(tmp_folder)
Frank.export.path = tmp_folder
Frank.export.silent = true
Frank::Compile.export!
puts " - \033[32mPublishing to:\033[0m `#{Frank.publish.host}:#{Frank.publish.path}'"
ssh_options = {
:password => Frank.publish.password,
:port => Frank.publish.port
}
current = nil
Net::SSH.start(Frank.publish.host, Frank.publish.username, ssh_options) do |ssh|
ssh.scp.upload!("#{tmp_folder}/", Frank.publish.path, :recursive => true, :chunk_size => 2048) do |ch, name, sent, total|
puts " - #{name[tmp_folder.length..-1]}" unless name == current
current = name
end
end
FileUtils.rm_rf(tmp_folder)
puts "\n\033[32mPublish complete!\033[0m"
end
|