14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/diggit/developers_activity/joins/developer_turnover_join.rb', line 14
def run
db_match = @options[:mongo][:url].match(%r{^mongodb://(.+):27017/(.+)$})
r.database_host = db_match[1]
r.database_name = db_match[2]
r.working_dir = WORKING_DIR
FileUtils.mkdir_p(WORKING_DIR)
r.web_working_dir = WEB_WORKING_DIR
FileUtils.mkdir_p(WEB_WORKING_DIR)
puts('Running R sript...')
r.eval <<-EOS
options(warn=-1)
if (require(developerTurnover) == FALSE) {
if (require(devtools) == FALSE) {
install.packages("devtools", repos = "http://cran.rstudio.com")
library(devtools)
}
install_github("matthieu-foucault/RdeveloperTurnover")
library(devtools)
library(developerTurnover)
}
developer_turnover(database_host, database_name, working_dir, web_working_dir)
print("R script finished")
options(warn=0)
EOS
end
|