Class: Charu::FtpClariant

Inherits:
Object
  • Object
show all
Defined in:
lib/Charu/FTP.rb

Instance Method Summary collapse

Constructor Details

#initializeFtpClariant

Returns a new instance of FtpClariant.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/Charu/FTP.rb', line 7

def initialize()
  @config = Charu::Config.new()

  @server = @config.server
  @port = @config.port
  @user = @config.user
  @pass = @config.pass
  @dir = @config.www_html_out_path

  @list = Dir.glob(@dir + '*.html')
end

Instance Method Details

#put_fileObject



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
45
# File 'lib/Charu/FTP.rb', line 19

def put_file()
  ftp = Net::FTP.new
  ftp.connect(@server, @port)
  ftp.(@user, @pass)

  ftp.chdir('./')
  p "./  :初期ディレクトリ".encode(Encoding::SJIS)
  puts ftp.pwd

  file_list = []
  @list.each{|file|
    file_list << File::expand_path(file)
  }
  ftp.chdir(@dir)
  p @dir + ":移動ディレクトリ".encode(Encoding::SJIS)
  puts ftp.pwd

  # アップロード

  file_list.each{|file|
    p file
    ftp.put(file)
  }
  p "完了".encode(Encoding::SJIS)
  puts ftp.pwd

  ftp.quit
end