Sha256: 83085eaf3c4d853ae07433cfac8e84b712242441e622a0773c5653ca2620285f

Contents?: true

Size: 1.94 KB

Versions: 82

Compression:

Stored size: 1.94 KB

Contents

def uploadreturnsfile
	require 'net/ftp'
	BasicSocket.do_not_reverse_lookup = true 
	@returnsftpdisplays = ""
	randomnumber = rand(9999) + 1000
	puts randomnumber.to_i


	returns_ftpsite = "ftp.superant.com"
	returns_ftplogin = "anonymous@superant.com"
	returns_ftppassword = "anonymous@superant.com"
	returns_ftpdirectory = "/incoming/returns/"

	begin
		platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
		platformdisplay =  platformdisplay + "Ruby Version " + VERSION + "\n" 
		platformdisplay  = platformdisplay  + "rwdtinker version " + RwdTinkerVersion + "\n"
		platformdisplay = platformdisplay + "application name " + $rwdapplicationidentity + "\n"
		platformdisplay = platformdisplay + "program directory " + $progdir + "\n"
		platformdisplay = platformdisplay  + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
		platformdisplay = platformdisplay +  "Date " +      Date.today().to_s + "\n"
		if ! @a_emailupload.empty?
			platformdisplay = platformdisplay + @a_emailupload + "\n"
		end
		if ! @a_emailupload.empty?
			platformdisplay = platformdisplay + @a_commentupload + "\n"
		end
		updatefile = Date.today().to_s + Resolv.getname(Resolv.getaddress("localhost")) + randomnumber.to_s

		tmpdir = ENV['TMP']
		if tmpdir.to_s.empty?
			tmpdir = "/tmp"   
		end
		fileName = File.join( tmpdir, updatefile)
		fd = File.open(fileName,"w")
		fd.print(platformdisplay) # save the record info to the file
		fd.close
		ftp = Net::FTP::new(returns_ftpsite)
		@returnsftpdisplay  = "data uploaded" + "\n" 

		filedirname = File.join(tmpdir,updatefile)

		ftp.debug_mode = false
		ftp.login(returns_ftplogin, returns_ftppassword)
		ftp.chdir(returns_ftpdirectory)
		print "I'm in the directory ", ftp.pwd(), "\n"

		puts filedirname
		ftp.puttextfile(filedirname  , updatefile)
		@returnsftpdisplay  =   @returnsftpdisplay + platformdisplay   


		ftp.close

	rescue
		@returnsftpdisplay = "upload error"
		if ftp
			ftp.close
		end
		print "ftp error"
	end
end

Version data entries

82 entries across 82 versions & 17 rubygems

Version Path
bigtinker-0.94 code/01rwdcore/uploadreturns.rb
bigtinker-0.93 code/01rwdcore/uploadreturns.rb
bigtinker-0.95 code/01rwdcore/uploadreturns.rb
bigtinker-0.97 code/01rwdcore/uploadreturns.rb
bigtinker-0.96 code/01rwdcore/uploadreturns.rb
rubyslippers-1.02 code/01rwdcore/uploadreturns.rb
rubyslippers-1.04 code/01rwdcore/uploadreturns.rb
rubyslippers-1.03 code/01rwdcore/uploadreturns.rb
rubyslippers-1.06 code/01rwdcore/uploadreturns.rb
rubyslippers-1.07 code/01rwdcore/uploadreturns.rb
rubyslippers-1.08 code/01rwdcore/uploadreturns.rb
rwdaddresses-1.03 code/01rwdcore/uploadreturns.rb
rwdaddresses-1.02 code/01rwdcore/uploadreturns.rb
rwdaddresses-1.05 code/01rwdcore/uploadreturns.rb
rwdaddresses-1.04 code/01rwdcore/uploadreturns.rb
rwddialogmap-0.01 code/01rwdcore/uploadreturns.rb
rwddialogmap-0.02 code/01rwdcore/uploadreturns.rb
rwdeliza-0.03 code/01rwdcore/uploadreturns.rb
rwddemo-0.92 code/01rwdcore/uploadreturns.rb
rwdfoldeditor-0.03 code/01rwdcore/uploadreturns.rb