newbie: copy file from github to local directory?

Good day,
I am new to rails and would like suggestions/help to copy a file from github to a local directory.

I assume use the FileUtils but any help would be appreciated.

Thank you

just download it.

Re: [Rails] newbie: copy file from github to local directory?
Jason,

I am not aware of any Rails/Ruby-native facility to download stuff from github.

As has been stated elseelse - and I will paraphrase - just use github-native commands.

Ralph

Tuesday, June 5, 2018, 2:14:49 PM, you wrote:

Good day,

I am new to rails and would like suggestions/help to copy a file from github to a local directory.

I assume use the FileUtils but any help would be appreciated.

Thank you

Not a Rails question at all, but assuming you know the URL of the
file you want to retrieve:

  https://ruby-doc.org/stdlib-2.5.1/libdoc/open-uri/rdoc/OpenURI.html

The url is https://github.com/Azure/WALinuxAgent/blob/master/config/66-azure-storage.rules

I thought something along the lines of

if File.exist? ‘/etc/udev/rules.d/66-azure-storage.rules’

setcode do

#something

end

else

#Copy file from url to /etc/udev/rules.d/66-azure-storage.rules

#then do something.

end

Thank you all the quick replies and help thus far it is appreciated.

Would this code work or am i way off?

setcode do

if File.exist? ‘/etc/udev/rules.d/66-azure-storage.rules’

#do something

else

download = open(‘https://github.com/Azure/WALinuxAgent/blob/master/config/66-azure-storage.rules’)

IO.copy_stream(download, ‘/etc/udev/rules.d/66-azure-storage.rules’)

#do something

end

end

Why not just try it?