akamai 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/akamai.rb +12 -6
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/akamai.rb
CHANGED
@@ -45,27 +45,33 @@ module Akamai
|
|
45
45
|
tempfile.flush
|
46
46
|
|
47
47
|
puts "Tempfile generated for #{filename} at #{tempfile.path}."
|
48
|
+
|
49
|
+
put_file(tempfile.path, location, filename)
|
50
|
+
|
51
|
+
tempfile.close
|
52
|
+
puts "Generated file deleted from tmp."
|
48
53
|
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.put_file(local_path, location, filename)
|
49
58
|
ftp = Net::FTP::new(self.configuration.netstorage_ftp_host)
|
50
59
|
ftp.passive = true
|
51
60
|
|
52
61
|
ftp.login(self.configuration.netstorage_username, self.configuration.netstorage_password)
|
53
62
|
ftp.chdir(self.configuration.netstorage_basedir) if self.configuration.netstorage_basedir
|
54
|
-
ftp.chdir(
|
63
|
+
ftp.chdir(location)
|
55
64
|
|
56
|
-
ftp.put(
|
65
|
+
ftp.put(local_path, "#{filename}.new")
|
57
66
|
ftp.delete(filename) unless ftp.ls(filename)
|
58
67
|
ftp.rename("#{filename}.new", filename)
|
59
68
|
ftp.close
|
60
69
|
|
61
70
|
puts "Akamai upload completed for #{filename}."
|
62
71
|
|
63
|
-
tempfile.close
|
64
|
-
puts "Generated file deleted from tmp."
|
65
|
-
|
66
72
|
puts "Sending purge request"
|
67
73
|
purge_result = purge("http://#{self.configuration.netstorage_public_host}/#{location}/#{filename}")
|
68
|
-
puts "Purge request #{
|
74
|
+
puts "Purge request #{ purge_result ? 'was successful' : 'failed' }."
|
69
75
|
end
|
70
76
|
end
|
71
77
|
|