Skip to content

Commit 55f832e

Browse files
committed
v0.1.2 pandoc version
1 parent 7797938 commit 55f832e

9 files changed

+155
-134
lines changed

Diff for: DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: gitdown
22
Title: Turn Your Git Commit Messages into a HTML Book
3-
Version: 0.1.1.9000
3+
Version: 0.1.2
44
Authors@R:
55
c(person(given = "Sébastien",
66
family = "Rochette",

Diff for: NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# gitdown (development version)
1+
# gitdown 0.1.2
2+
3+
* Protect from older Pandoc versions
24

35
# gitdown 0.1.1
46

Diff for: R/get_info_files.R

+7-3
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ present_files <- function(repo = ".", path = "R",
175175
#'
176176
#' # Creates vignette
177177
#' repo <- fake_repo(as.package = TRUE)
178-
#' create_vignette_last_modif(repo, path = "R")
178+
#' if (rmarkdown::pandoc_available("1.12.3")) {
179+
#' create_vignette_last_modif(repo, path = "R")
180+
#' }
179181

180182
create_vignette_last_modif <- function(repo = ".", path = "R",
181183
recursive = TRUE, untracked = TRUE) {
@@ -196,8 +198,10 @@ create_vignette_last_modif <- function(repo = ".", path = "R",
196198
#' @examples
197199
#' # update vignette
198200
#' repo <- fake_repo(as.package = TRUE)
199-
#' update_vignette_last_modif(repo, path = "R")
200-
#' rmarkdown::render(file.path(repo, "vignettes", "modification_files.Rmd"))
201+
#' if (rmarkdown::pandoc_available("1.12.3")) {
202+
#' update_vignette_last_modif(repo, path = "R")
203+
#' rmarkdown::render(file.path(repo, "vignettes", "modification_files.Rmd"))
204+
#' }
201205
update_vignette_last_modif <- function(repo = ".", path = "R",
202206
recursive = TRUE, untracked = TRUE) {
203207
vig <- file.path(repo, "vignettes")

Diff for: R/git_down.R

+8-4
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
#'
2727
#' @examples
2828
#' repo <- fake_repo()
29-
#' res <- git_down(repo, pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
30-
#' open = FALSE)
29+
#' if (rmarkdown::pandoc_available("1.12.3")) {
30+
#' res <- git_down(repo, pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
31+
#' open = FALSE)
32+
#' }
3133
#' \dontrun{
3234
#' # Open the book
3335
#' browseURL(res)
@@ -36,8 +38,10 @@
3638
#' pattern.table <- data.frame(number = c("#2", "#1"),
3739
#' title = c("#2 A second issue to illustrate a blog post",
3840
#' "#1 An example of issue"))
39-
#' res <- git_down(repo, pattern = c("Issues" = "#[[:digit:]]+"),
40-
#' pattern.table = pattern.table, open = FALSE)
41+
#' if (rmarkdown::pandoc_available("1.12.3")) {
42+
#' res <- git_down(repo, pattern = c("Issues" = "#[[:digit:]]+"),
43+
#' pattern.table = pattern.table, open = FALSE)
44+
#' }
4145
#' \dontrun{
4246
#' # Open the book
4347
#' browseURL(res)

Diff for: dev_history.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ devtools::build_readme()
7171
urlchecker::url_check()
7272
urlchecker::url_update()
7373

74-
# usethis::use_release_issue(version = "0.1.1")
7574
usethis::use_version('patch')
7675

7776
rcmdcheck::rcmdcheck(args = "--as-cran")
@@ -80,6 +79,7 @@ rhub::validate_email()
8079
rhub::check_for_cran()
8180
rhub::check_on_windows(check_args = "--force-multiarch")
8281
rhub::check_on_fedora()
82+
rhub::check_on_solaris()
8383
devtools::check_win_devel()
8484
devtools::check_win_release()
8585

Diff for: man/create_vignette_last_modif.Rd

+7-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: man/git_down.Rd

+8-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: tests/testthat/test-get_info_files.R

+24-23
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,27 @@ test_that("present_files error", {
5151
})
5252

5353
# create_vignette_last_modif ----
54-
create_vignette_last_modif(repo_pkg)
55-
# browseURL(repo_pkg)
56-
57-
test_that("create_vignette_last_modif works", {
58-
expect_true(file.exists(file.path(repo_pkg, "vignettes", "modification_files.Rmd")))
59-
})
60-
# Clean repo
61-
file.remove(file.path(repo_pkg, "vignettes", "modification_files.Rmd"))
62-
63-
# All files
64-
create_vignette_last_modif(repo_pkg, path = "")
65-
66-
test_that("create_vignette_last_modif works", {
67-
expect_true(file.exists(file.path(repo_pkg, "vignettes", "modification_files.Rmd")))
68-
})
69-
# Clean repo
70-
file.remove(file.path(repo_pkg, "vignettes", "modification_files.Rmd"))
71-
72-
# No vignettes/
73-
test_that("create_vignette_last_modif error", {
74-
expect_error(create_vignette_last_modif(repo_no_pkg))
75-
})
76-
54+
if (rmarkdown::pandoc_available("1.12.3")) {
55+
create_vignette_last_modif(repo_pkg)
56+
# browseURL(repo_pkg)
57+
58+
test_that("create_vignette_last_modif works", {
59+
expect_true(file.exists(file.path(repo_pkg, "vignettes", "modification_files.Rmd")))
60+
})
61+
# Clean repo
62+
file.remove(file.path(repo_pkg, "vignettes", "modification_files.Rmd"))
63+
64+
# All files
65+
create_vignette_last_modif(repo_pkg, path = "")
66+
67+
test_that("create_vignette_last_modif works", {
68+
expect_true(file.exists(file.path(repo_pkg, "vignettes", "modification_files.Rmd")))
69+
})
70+
# Clean repo
71+
file.remove(file.path(repo_pkg, "vignettes", "modification_files.Rmd"))
72+
73+
# No vignettes/
74+
test_that("create_vignette_last_modif error", {
75+
expect_error(create_vignette_last_modif(repo_no_pkg))
76+
})
77+
}

Diff for: tests/testthat/test-git_down.R

+96-94
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,106 @@
1-
library(withr)
2-
3-
repo_input <- tempfile(pattern = "git2r-")
4-
repo <- fake_repo(repo_input)
5-
6-
# Classic use
7-
with_dir(repo, {
8-
res <- git_down(author = "Cervan",
9-
pattern = c("Issue" = "#[[:digit:]]+"),
10-
open = FALSE
11-
)
12-
})
13-
lines <- readLines(file.path(dirname(res), "section-issue.html"))
14-
one_line_exists <- grep('<h2><span class="header-section-number">1.2</span> Issue: #1</h2>',
15-
lines, fixed = TRUE)
16-
sub_commit_1 <- grep('<h3><span class="header-section-number">1.2.1</span> commit: example: modification</h3>',
17-
lines, fixed = TRUE)
18-
sub_commit_2 <- grep('<h3><span class="header-section-number">1.2.2</span> commit: Add NEWS</h3>',
19-
lines, fixed = TRUE)
20-
21-
test_that("git_down function",{
22-
expect_match(res, regexp = ".html")
23-
expect_true(file.exists(file.path(dirname(res), "section-issue.html")))
24-
expect_length(one_line_exists, 1)
25-
expect_length(sub_commit_1, 1)
26-
expect_length(sub_commit_2, 1)
27-
})
28-
29-
# clean dir
30-
unlink(dirname(res), recursive = TRUE)
31-
32-
# Pattern without name and special characters cleaned
33-
with_dir(repo, {
34-
res <- git_down(author = "StatnMap",
35-
pattern = c("#[[:digit:]]+"),
36-
open = FALSE
37-
)
38-
})
39-
40-
lines <- readLines(file.path(dirname(res), "section-digit.html"))
41-
one_line_exists <- grep('<h2><span class="header-section-number">1.2</span> <code>#--:digit:--+</code>: #1</h2>',
42-
lines, fixed = TRUE)
43-
44-
test_that("git_down no name function",{
45-
expect_match(res, regexp = ".html")
46-
expect_true(file.exists(file.path(dirname(res), "section-digit.html")))
47-
expect_true(length(one_line_exists) == 1)
48-
})
49-
50-
# clean dir
51-
unlink(dirname(res), recursive = TRUE)
52-
53-
# With multiple patterns ----
54-
with_dir(repo, {
55-
res <- git_down(author = "Seb",
56-
pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
57-
open = FALSE
58-
)
59-
})
60-
61-
test_that("git_down multiple pattern works", {
62-
expect_match(res, regexp = ".html")
63-
64-
issues_file <- normalizePath(file.path(dirname(res), "section-issues.html"))
65-
tickets_file <- normalizePath(file.path(dirname(res), "section-tickets.html"))
66-
67-
expect_true(file.exists(issues_file))
68-
expect_true(file.exists(tickets_file))
69-
70-
lines <- readLines(tickets_file)
71-
one_line_ticket_exists <- grep('<h2><span class="header-section-number">1.2</span> Ticket: ticket1234</h2>',
72-
lines, fixed = TRUE)
73-
74-
expect_true(length(one_line_ticket_exists) == 1)
75-
76-
lines <- readLines(issues_file)
77-
one_line_exists <- grep('<h2><span class="header-section-number">2.2</span> Issue: #1</h2>',
78-
lines, fixed = TRUE)
79-
expect_true(length(one_line_exists) == 1)
80-
})
81-
82-
# clean dir
83-
unlink(dirname(res), recursive = TRUE)
1+
if (rmarkdown::pandoc_available("1.12.3")) {
2+
library(withr)
843

85-
# With table of correspondence
86-
pattern.table <- data.frame(
87-
number = c("#2", "#1", "#1000"),
88-
title = c("#2 A second issue to illustrate a blog post",
89-
"#1 An example of issue",
90-
"#1000 issue with no commit"))
4+
repo_input <- tempfile(pattern = "git2r-")
5+
repo <- fake_repo(repo_input)
916

92-
test_that("git_down with pattern table",{
7+
# Classic use
938
with_dir(repo, {
949
res <- git_down(author = "Cervan",
9510
pattern = c("Issue" = "#[[:digit:]]+"),
96-
pattern.table = pattern.table,
9711
open = FALSE
9812
)
13+
})
14+
lines <- readLines(file.path(dirname(res), "section-issue.html"))
15+
one_line_exists <- grep('<h2><span class="header-section-number">1.2</span> Issue: #1</h2>',
16+
lines, fixed = TRUE)
17+
sub_commit_1 <- grep('<h3><span class="header-section-number">1.2.1</span> commit: example: modification</h3>',
18+
lines, fixed = TRUE)
19+
sub_commit_2 <- grep('<h3><span class="header-section-number">1.2.2</span> commit: Add NEWS</h3>',
20+
lines, fixed = TRUE)
21+
22+
test_that("git_down function",{
23+
expect_match(res, regexp = ".html")
24+
expect_true(file.exists(file.path(dirname(res), "section-issue.html")))
25+
expect_length(one_line_exists, 1)
26+
expect_length(sub_commit_1, 1)
27+
expect_length(sub_commit_2, 1)
28+
})
29+
30+
# clean dir
31+
unlink(dirname(res), recursive = TRUE)
32+
33+
# Pattern without name and special characters cleaned
34+
with_dir(repo, {
35+
res <- git_down(author = "StatnMap",
36+
pattern = c("#[[:digit:]]+"),
37+
open = FALSE
38+
)
39+
})
40+
41+
lines <- readLines(file.path(dirname(res), "section-digit.html"))
42+
one_line_exists <- grep('<h2><span class="header-section-number">1.2</span> <code>#--:digit:--+</code>: #1</h2>',
43+
lines, fixed = TRUE)
44+
45+
test_that("git_down no name function",{
46+
expect_match(res, regexp = ".html")
47+
expect_true(file.exists(file.path(dirname(res), "section-digit.html")))
48+
expect_true(length(one_line_exists) == 1)
49+
})
50+
51+
# clean dir
52+
unlink(dirname(res), recursive = TRUE)
53+
54+
# With multiple patterns ----
55+
with_dir(repo, {
56+
res <- git_down(author = "Seb",
57+
pattern = c("Tickets" = "ticket[[:digit:]]+", "Issues" = "#[[:digit:]]+"),
58+
open = FALSE
59+
)
60+
})
61+
62+
test_that("git_down multiple pattern works", {
9963
expect_match(res, regexp = ".html")
64+
65+
issues_file <- normalizePath(file.path(dirname(res), "section-issues.html"))
66+
tickets_file <- normalizePath(file.path(dirname(res), "section-tickets.html"))
67+
68+
expect_true(file.exists(issues_file))
69+
expect_true(file.exists(tickets_file))
70+
71+
lines <- readLines(tickets_file)
72+
one_line_ticket_exists <- grep('<h2><span class="header-section-number">1.2</span> Ticket: ticket1234</h2>',
73+
lines, fixed = TRUE)
74+
75+
expect_true(length(one_line_ticket_exists) == 1)
76+
77+
lines <- readLines(issues_file)
78+
one_line_exists <- grep('<h2><span class="header-section-number">2.2</span> Issue: #1</h2>',
79+
lines, fixed = TRUE)
80+
expect_true(length(one_line_exists) == 1)
81+
})
82+
83+
# clean dir
84+
unlink(dirname(res), recursive = TRUE)
85+
86+
# With table of correspondence
87+
pattern.table <- data.frame(
88+
number = c("#2", "#1", "#1000"),
89+
title = c("#2 A second issue to illustrate a blog post",
90+
"#1 An example of issue",
91+
"#1000 issue with no commit"))
92+
93+
test_that("git_down with pattern table",{
94+
with_dir(repo, {
95+
res <- git_down(author = "Cervan",
96+
pattern = c("Issue" = "#[[:digit:]]+"),
97+
pattern.table = pattern.table,
98+
open = FALSE
99+
)
100+
expect_match(res, regexp = ".html")
101+
})
100102
})
101-
})
102103

103-
# clean dir
104-
unlink(dirname(res), recursive = TRUE)
104+
# clean dir
105+
unlink(dirname(res), recursive = TRUE)
106+
}

0 commit comments

Comments
 (0)