Sha256: 21583f5d350c0282269847aea375a5f43d2ef2e48a3c674f8d48a03f5645b5e4

Contents?: true

Size: 998 Bytes

Versions: 4

Compression:

Stored size: 998 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'net/ftp'

module Charu
  class FtpClariant
    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

    def put_file()
      ftp = Net::FTP.new
      ftp.connect(@server, @port)
      ftp.login(@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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
Charu-0.0.9 lib/Charu/FTP.rb
Charu-0.0.8 lib/Charu/FTP.rb
Charu-0.0.7 lib/Charu/FTP.rb
Charu-0.0.6 lib/Charu/FTP.rb