Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.85 KB | None | 0 0
  1. require 'net/ftp'
  2.  
  3. $cartella = 'Mind_blog_v1.1'
  4. $username = 'your_username'
  5. $password = 'your_password'
  6. $host = 'your_ftp' # ex: ftp.pitagora.hellospace.net
  7.  
  8. class CMS
  9.      def installa
  10.         ftp = Net::FTP.new($host)
  11.         ftp.login($username, $password)
  12.         ftp.mkdir($cartella)
  13.         ftp.chdir($cartella)
  14.         ftp.close
  15.      end
  16.      
  17.      def aggiungi(nome_file)
  18.         @file = nome_file
  19.         ftp = Net::FTP.new($host)
  20.         ftp.login($username, $password)
  21.         ftp.chdir($cartella)
  22.         ftp.putbinaryfile(@file)
  23.         ftp.close
  24.      end
  25. end
  26.  
  27. mind_blog = CMS.new
  28. stringa = ARGV[0]
  29.  
  30. if stringa == nil
  31.   print "Errore, avviare mind_blog!\n"
  32.  
  33. elsif stringa == '-add'
  34.   mind_blog.aggiungi(ARGV[1])
  35.  
  36. elsif stringa == '-install'
  37.   mind_blog.installa
  38.  
  39. else
  40.   print "Errore, avviare mind_blog!\n"
  41.  
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement