Skip to content

Commit

Permalink
enable marker for private repos
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Sidi committed Jul 21, 2018
1 parent 33b523f commit 1747af1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
11 changes: 10 additions & 1 deletion R/grep_remote.R
Expand Up @@ -29,7 +29,7 @@
#' path = list(path = 'timelyportfolio/vueR',subdir='R|inst',vcs='github'),
#' padding=3,value=TRUE,fixed=TRUE)}
#' @export
#' @importFrom httr content GET
#' @importFrom httr content GET parse_url
#' @importFrom utils tail head
#' @importFrom crayon green red
#' @importFrom jsTree jsTree
Expand Down Expand Up @@ -106,6 +106,15 @@ grepr <- function(pattern,path,recursive=FALSE, whole_word = FALSE, padding=0,us
args0$value=FALSE
g0=do.call(grep,args0)
if(length(g0)>0){

if(!is.null(httr::parse_url(x)$scheme)){
cat(s,
file = file.path(
tempdir(),
basename(gsub('\\?(.*?)$','',x)))
)
}

g=g0
if(length(g0)>1){
rmIdx=which(utils::tail(g0,-1)-utils::head(g0,-1)<=padding)
Expand Down
13 changes: 4 additions & 9 deletions R/make_marker.R
@@ -1,4 +1,3 @@
#' @importFrom httr parse_url
make_marker <- function(pattern,x){

rstudioapi::callFun("sourceMarkers",
Expand All @@ -7,16 +6,12 @@ make_marker <- function(pattern,x){

if(!is.null(httr::parse_url(nx)$scheme)){

new_nx <- file.path(tempdir(),basename(nx))

cat(
readLines(nx),
file = new_nx,
sep='\n'
)

new_nx <- file.path(tempdir(),basename(gsub('\\?(.*?)$','',nx)))

}else{

new_nx <- nx

}

lapply(x[[nx]],function(xx){
Expand Down
13 changes: 8 additions & 5 deletions R/navigate_remote.R
Expand Up @@ -3,6 +3,7 @@
#' @param path character, Path to root directory of git repository or a name of a github/bitbucket repository, Default: setwd()
#' @param branch character, alias of the github/bitbucket branch to retrieve directory structure, Default: 'master'
#' @param vcs character, choose which version control system to search (github, bitbucket, git (head of checkout repo), svn), Default: 'github'
#' @param show_tree boolean, show jsTree widget output in viewer, Default: TRUE
#' @details
#' By default path assumes a local address, if path is a valid repository name eg 'tidyverse/glue'
#' then the pattern is checked on the specified pulic github repository
Expand All @@ -14,14 +15,16 @@
#' navigate_remote('tidyverse/glue',branch='named_args')
#' @seealso
#' \code{\link[jsTree]{jsTree}}
navigate_remote <- function(path=getwd(), branch='master', vcs='github', show = TRUE){
navigate_remote <- function(path=getwd(), branch='master', vcs='github', show_tree = TRUE){

tree <- jsTree::jsTree$new(ls_remote(path = path,branch = branch,vcs = vcs))

tree$add_vcs(remote_repo = path,vcs = vcs,remote_branch = branch)

if(show)
tree$show()

return(invisible(tree))
if(show_tree){
tree$show()
}else{
invisible(tree)
}

}
4 changes: 3 additions & 1 deletion man/navigate_remote.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1747af1

Please sign in to comment.