gather_tags: Gather tags

Description Usage Arguments Examples

View source: R/gather_tags.R

Description

Gather tags

Usage

1
2
3
4
5
gather_tags(x, token = NULL)

gather_files(x, token = NULL)

gather_release(x, token = NULL)

Arguments

x

a github repository in the form owner/repo, e.g,. ropensci/rfisheries

token

A GitHub PAT - can just pull your stored PAT from GITHUB_PAT env var

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## Not run: 
pkgs <- ropensci_pkgs()

# get tags
gather_tags(pkgs$owner_repo[[15]])

# get sha of lastest commit
last_sha(pkgs$owner_repo[[15]])

# get files
gather_files(pkgs$owner_repo[[15]])

# get latest release
gather_release(pkgs$owner_repo[[15]])

# get maintainer and their emails
library("ropkgs")
library("dplyr")
df <- ro_pkgs()

# do analysis
## get cran data
pkgnames <- df$packages %>%
  filter(on_cran) %>%
  .$name
res <- gather_crans(pkgnames)
crandat <- dplyr::bind_rows(res) %>%
   dplyr::rename(version = name, name = pkg, version_date = date)

## get github data
github_dat <- lapply(pkgs$owner_repo, function(x) {
  tags <- gather_tags(x)
  files <- gather_files(x)
  data.frame(pkg = strsplit(x, "/")[[1]][2],
             owner_repo = x,
             no_tags = NROW(tags),
             latest_tag = if (inherits(tags, "data.frame")) tags[1, "name"] else NA,
             has_news = any(grepl("NEWS", files$path)),
             release = gather_release(x),
             stringsAsFactors = FALSE)
})

out <- tbl_df(bind_rows(github_dat)) %>%
  dplyr::rename(name = pkg) %>%
  left_join(df$packages %>% select(name, maintainer, email, on_cran)) %>%
  left_join(crandat %>% group_by(name) %>% top_n(1) %>% ungroup())

# on CRAN, but no news file
out %>%
  filter(on_cran, !has_news)

# on CRAN, but no git tags
out %>%
  filter(on_cran, no_tags == 0)

# on CRAN, git tags, but no releases
out %>%
  filter(on_cran, no_tags > 0, nchar(release) == 0) %>% arrange(has_news)

# does the most recent CRAN version have a github repo release
## github releases ahead of CRAN verions should be fine
## it's CRAN versions ahead of github releases that's of concern
out %>%
  filter(on_cran, version != "archived", !is.na(latest_tag)) %>%
  select(name, latest_tag, version) %>%
  mutate(latest_tag = gsub("[A-Za-z]|-|\\.0$|\\.0\\.0$", "", latest_tag)) %>%
  mutate(version = gsub("\\.0$|\\.0\\.0$", "", version)) %>%
  mutate(matches = latest_tag == version) %>%
  arrange(matches) %>%
  filter(!matches) %>%
  left_join(out %>% select(name, maintainer, email))

## End(Not run)

ropensci/rostats documentation built on Oct. 15, 2019, 1:37 p.m.