net-ftp
net-ftp copied to clipboard
Quote and Literal subcommands are implemented
Fixes #33
The modifications in the pull request have been tested against an IBM z/OS Communications Server. The following code fragment uses FTP to submit a batch job to the mainframe, and collects the results.
def parse_job_number_from(line)
tokens = line.split('JOB')
raise StandardError, "Error: The string 'JOB' was not found in the FTP response." unless tokens.length == 2
job_number = tokens[1].split.first
job_number.sub(/^0+/, '') # Remove leading zeros
end
Net::FTP.open(@ip_or_domain) do |ftp|
ftp.login @uid, @pwd
ftp.quote 'site filetype=jes'
job_info = ftp.puttextfile @local_jcl_filepath
job_number = parse_job_number_from job_info
ftp.gettextfile "J#{job_number}", @local_results_file
end
It looks good. Thank you!
The version of the net-ftp
Ruby gem containing this PR was tagged as v0.3.6. Looks like v0.3.6 was not released and there were no change notes. There was no mention of this pull request in v0.3.7 either, although the code from this PR is there. Seems like the credit for my contribution fell through the cracks. Might it be possible to fix that somehow?
@mslinn It seems that v0.3.6 release was left as draft. I've just published it: https://github.com/ruby/net-ftp/releases/tag/v0.3.6
@shugo Many thanks!
I noticed that the sample code I showed above from May 3 does not appear in the documentation. How might that be accomplished?
I noticed that the sample code I showed above from May 3 does not appear in the documentation. How might that be accomplished?
What do you mean by the words "the sample code I showed above from May 3"?
It seems that documentation returned by ri
and gem server
contains description in your patch, but I couldn't find "sample code" in your patch.
$ ri Net::FTP#quote
= Net::FTP#quote
(from gem net-ftp-0.3.8)
=== Implementation from FTP
------------------------------------------------------------------------
quote(arguments)
------------------------------------------------------------------------
The "quote" subcommand sends arguments verbatim to the remote ftp
server. The "literal" subcommand is an alias for "quote". @param
arguments Array[String] to be sent verbatim to the remote ftp server
Here is the documentation again:
The modifications in the pull request have been tested against an IBM z/OS Communications Server. The following code fragment uses FTP to submit a batch job to the mainframe, and collects the results.
def parse_job_number_from(line)
tokens = line.split('JOB')
raise StandardError, "Error: The string 'JOB' was not found in the FTP response." unless tokens.length == 2
job_number = tokens[1].split.first
job_number.sub(/^0+/, '') # Remove leading zeros
end
Net::FTP.open(@ip_or_domain) do |ftp|
ftp.login @uid, @pwd
ftp.quote 'site filetype=jes'
job_info = ftp.puttextfile @local_jcl_filepath
job_number = parse_job_number_from job_info
ftp.gettextfile "J#{job_number}", @local_results_file
end