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

R envvars in repo #1971

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/travis/build/script/r.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def configure
end

# Set repos in ~/.Rprofile
repos_str = repos.collect {|k,v| "#{k} = \"#{v}\""}.join(", ")
repos_str = repos.collect {|k,v| "#{k} = \\\"#{v}\\\""}.join(", ")
options_repos = "options(repos = c(#{repos_str}))"
sh.cmd %Q{echo '#{options_repos}' > ~/.Rprofile.site}
sh.cmd %Q{echo "#{options_repos}" > ~/.Rprofile.site}
sh.export 'R_PROFILE', "~/.Rprofile.site", echo: false

# PDF manual requires latex
Expand Down
6 changes: 3 additions & 3 deletions spec/build/script/r_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@

it 'sets repos in ~/.Rprofile.site with defaults' do
data[:config][:cran] = 'https://cloud.r-project.org'
should include_sexp [:cmd, "echo 'options(repos = c(CRAN = \"https://cloud.r-project.org\"))' > ~/.Rprofile.site",
should include_sexp [:cmd, "echo \"options(repos = c(CRAN = \\\"https://cloud.r-project.org\\\"))\" > ~/.Rprofile.site",
assert: true, echo: true, timing: true]
end

it 'sets repos in ~/.Rprofile.site with user specified repos' do
data[:config][:cran] = 'https://cran.rstudio.org'
should include_sexp [:cmd, "echo 'options(repos = c(CRAN = \"https://cran.rstudio.org\"))' > ~/.Rprofile.site",
should include_sexp [:cmd, "echo \"options(repos = c(CRAN = \\\"https://cran.rstudio.org\\\"))\" > ~/.Rprofile.site",
assert: true, echo: true, timing: true]
end

it 'sets repos in ~/.Rprofile.site with additional user specified repos' do
data[:config][:repos] = {CRAN: 'https://cran.rstudio.org', ropensci: 'http://packages.ropensci.org'}
should include_sexp [:cmd, "echo 'options(repos = c(CRAN = \"https://cran.rstudio.org\", ropensci = \"http://packages.ropensci.org\"))' > ~/.Rprofile.site",
should include_sexp [:cmd, "echo \"options(repos = c(CRAN = \\\"https://cran.rstudio.org\\\", ropensci = \\\"http://packages.ropensci.org\\\"))\" > ~/.Rprofile.site",
assert: true, echo: true, timing: true]
end

Expand Down