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