akamai 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/akamai.rb +12 -6
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -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(self.configuration.location)
63
+ ftp.chdir(location)
55
64
 
56
- ftp.put(tempfile.path, "#{filename}.new")
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 #{ self.configuration.purge_result ? 'was successful' : 'failed' }."
74
+ puts "Purge request #{ purge_result ? 'was successful' : 'failed' }."
69
75
  end
70
76
  end
71
77
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akamai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Zeschin