Module: Encapsulator::ProvR
- Defined in:
- lib/encapsulator/provr.rb
Class Method Summary collapse
Class Method Details
.run(script) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/encapsulator/provr.rb', line 5 def ProvR.run script FileUtils.mkdir_p './prov' require 'rinruby' r = RinRuby.new(echo: false) r.eval "chooseCRANmirror(ind=81)" r.eval "install.packages('devtools')" r.eval "require('devtools')" r.eval "install_github('provtools/provR', ref='dev')" r.eval "require('provR')" r.eval "prov.capture('#{script}')" r.eval "f <- file('./prov/ddg.json')" r.eval "writeLines(prov.json(), f)" r.eval "close(f)" end |
.run_script(script) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/encapsulator/provr.rb', line 30 def ProvR.run_script script if !$ran_script run script $ran_script = true end prov_folder = './prov' Dir.chdir prov_folder do yield end end |
.tidy(script) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/encapsulator/provr.rb', line 20 def ProvR.tidy script require 'rinruby' r = RinRuby.new(echo: false) r.eval "chooseCRANmirror(ind=81)" r.eval "install.packages('formatR', repos = 'http://cran.rstudio.com')" r.eval "require('formatR')" r.eval "tidy_file('#{script}')" end |