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


On Wednesday, June 6, 2018 at 5:56:43 AM UTC-5, Jason McMahan wrote:
>
> 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.
>
> On Tuesday, June 5, 2018 at 4:15:08 PM UTC-5, Hassan Schroeder wrote:
>>
>> On Tue, Jun 5, 2018 at 1:14 PM, Jason McMahan <[email protected]> 
>> wrote: 
>>
>> > I am new to rails and would like suggestions/help to copy a file from 
>> github 
>> > to a local directory. 
>>
>> 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 
>>
>> -- 
>> Hassan Schroeder ------------------------ [email protected] 
>> twitter: @hassan 
>> Consulting Availability : Silicon Valley or remote 
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/87e0ac94-1633-4066-94f1-a62d339281ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to