akamai 0.0.4 → 0.0.5
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 +17 -18
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/lib/akamai.rb
CHANGED
@@ -51,28 +51,27 @@ module Akamai
|
|
51
51
|
tempfile.close
|
52
52
|
puts "Generated file deleted from tmp."
|
53
53
|
|
54
|
-
|
55
54
|
end
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
57
|
+
def self.put_file(local_path, location, filename)
|
58
|
+
ftp = Net::FTP::new(self.configuration.netstorage_ftp_host)
|
59
|
+
ftp.passive = true
|
60
|
+
|
61
|
+
ftp.login(self.configuration.netstorage_username, self.configuration.netstorage_password)
|
62
|
+
ftp.chdir(self.configuration.netstorage_basedir) if self.configuration.netstorage_basedir
|
63
|
+
ftp.chdir(location)
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
ftp.put(local_path, "#{filename}.new")
|
66
|
+
ftp.delete(filename) unless ftp.ls(filename)
|
67
|
+
ftp.rename("#{filename}.new", filename)
|
68
|
+
ftp.close
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
70
|
+
puts "Akamai upload completed for #{filename}."
|
71
|
+
|
72
|
+
puts "Sending purge request"
|
73
|
+
purge_result = purge("http://#{self.configuration.netstorage_public_host}/#{location}/#{filename}")
|
74
|
+
puts "Purge request #{ purge_result ? 'was successful' : 'failed' }."
|
76
75
|
end
|
77
76
|
|
78
77
|
end
|