newbie: copy file from github to local directory?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

newbie: copy file from github to local directory?

Jason McMahan
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

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8943f08a-38ea-4f1c-aad1-79bff84278f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: newbie: copy file from github to local directory?

Joe Guerra
just download it.

On Tue, Jun 5, 2018 at 4:14 PM, Jason McMahan <[hidden email]> 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

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8943f08a-38ea-4f1c-aad1-79bff84278f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAOFgAMmqbO3imNnOF871NsAm%3DuqzZ1K0erYtkC7P8UO2DxhVxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: newbie: copy file from github to local directory?

Ralph Shnelvar
In reply to this post by Jason McMahan
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
--
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
[hidden email].
To post to this group, send email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/8943f08a-38ea-4f1c-aad1-79bff84278f3%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.




Ralph

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/919808085.20180605142954%40dos32.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: newbie: copy file from github to local directory?

Hassan Schroeder-2
In reply to this post by Jason McMahan
On Tue, Jun 5, 2018 at 1:14 PM, Jason McMahan <[hidden email]> 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 ------------------------ [hidden email]
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yD%2Bx6B%2Bty6r7-6jh_qTkQHcBuqjfcE2Q8tHcAkO-bX%3DTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: newbie: copy file from github to local directory?

Jason McMahan
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="69zhMdF0AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jason.m...@...> 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:

  <a href="https://ruby-doc.org/stdlib-2.5.1/libdoc/open-uri/rdoc/OpenURI.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fruby-doc.org%2Fstdlib-2.5.1%2Flibdoc%2Fopen-uri%2Frdoc%2FOpenURI.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFGEPMm32PUGPcTfBee5LNiroFG4w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fruby-doc.org%2Fstdlib-2.5.1%2Flibdoc%2Fopen-uri%2Frdoc%2FOpenURI.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFGEPMm32PUGPcTfBee5LNiroFG4w&#39;;return true;">https://ruby-doc.org/stdlib-2.5.1/libdoc/open-uri/rdoc/OpenURI.html

--
Hassan Schroeder ------------------------ <a href="javascript:" target="_blank" gdf-obfuscated-mailto="69zhMdF0AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">hassan.s...@...
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d34da507-c63b-453e-82b6-36adeac1c614%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: newbie: copy file from github to local directory?

Jason McMahan
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 <a href="https://github.com/Azure/WALinuxAgent/blob/master/config/66-azure-storage.rules" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FAzure%2FWALinuxAgent%2Fblob%2Fmaster%2Fconfig%2F66-azure-storage.rules\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFNUcb6YrYpnD8QaIShprfeUSXWbw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FAzure%2FWALinuxAgent%2Fblob%2Fmaster%2Fconfig%2F66-azure-storage.rules\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFNUcb6YrYpnD8QaIShprfeUSXWbw&#39;;return true;">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 <[hidden email]> 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:

  <a href="https://ruby-doc.org/stdlib-2.5.1/libdoc/open-uri/rdoc/OpenURI.html" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fruby-doc.org%2Fstdlib-2.5.1%2Flibdoc%2Fopen-uri%2Frdoc%2FOpenURI.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFGEPMm32PUGPcTfBee5LNiroFG4w&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fruby-doc.org%2Fstdlib-2.5.1%2Flibdoc%2Fopen-uri%2Frdoc%2FOpenURI.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFGEPMm32PUGPcTfBee5LNiroFG4w&#39;;return true;">https://ruby-doc.org/stdlib-2.5.1/libdoc/open-uri/rdoc/OpenURI.html

--
Hassan Schroeder ------------------------ [hidden email]
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 [hidden email].
To post to this group, send email to [hidden email].
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 | Threaded
Open this post in threaded view
|

Re: newbie: copy file from github to local directory?

Hassan Schroeder-2
On Wed, Jun 6, 2018 at 5:49 AM, Jason McMahan <[hidden email]> wrote:
> Would this code work or am i way off?

Why not just try it?

--
Hassan Schroeder ------------------------ [hidden email]
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCWo6k9opQ-1qqC1%3DaOXzHPMj11YyQHm19EBnarc07FLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.