Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source single file gist without filename; fixes #1266 #1268

Closed
wants to merge 3 commits into from
Closed

Source single file gist without filename; fixes #1266 #1268

wants to merge 3 commits into from

Conversation

adamdsmith
Copy link

This fixes an issue in which an attempt to source a gist containing a single filename, but without specifying that filename, fails. Fixes issue #1266.

This fixes an issue in which an attempt to source a gist containing a single filename, but without specifying that filename, fails.  Fixes issue #1266.
@Chris-Larkin
Copy link

The issue page /issues/1266 seems to indicate this has been fixed, but I'm getting the same error as @Cauchy2. I've updated devtools and attempted to call gist_source() but to no avail.

> library(devtools)
> source_gist(9112634)
Error in r_files[[which]] : invalid subscript type 'closure'

I'm a bit of a novice with this stuff so apologies in advance if i'm missing something simple!

@@ -137,8 +137,8 @@ find_gist <- function(id, filename) {
}

} else {
if (length(r_files) > 1) {
warning("Multiple R files in gist, using first.")
if (length(r_files) >= 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather confusing logic. I think it would be better as:

if (length(r_files) == 1) {
   ...
} else {
   ...
}

Presumably zero files should also be an error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I'll adjust accordingly. You already exit with an error when length(r_files) == 0 so no additional modification is necessary. Thanks!

@@ -137,7 +137,9 @@ find_gist <- function(id, filename) {
}

} else {
if (length(r_files) > 1) {
if (length(r_files) = 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== ?

@adamdsmith
Copy link
Author

Of course. Thanks for your patience...

@hadley
Copy link
Member

hadley commented Aug 1, 2017

Sorry, I forgot about your PR and ended up fixing by hand.

@hadley hadley closed this Aug 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants