From 796545230489d7b4f11881c2642ced3ec522f845 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Wed, 11 Nov 2020 17:44:28 +0300 Subject: [PATCH] R: allow Bash envvars in repos: values --- lib/travis/build/script/r.rb | 4 ++-- spec/build/script/r_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/travis/build/script/r.rb b/lib/travis/build/script/r.rb index ee049afc91..93f85aa811 100644 --- a/lib/travis/build/script/r.rb +++ b/lib/travis/build/script/r.rb @@ -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 diff --git a/spec/build/script/r_spec.rb b/spec/build/script/r_spec.rb index 22bd55ac53..8ee7ef9da3 100644 --- a/spec/build/script/r_spec.rb +++ b/spec/build/script/r_spec.rb @@ -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