Skip to content

Commit 25b7129

Browse files
committed
build: +bloomrTree.AddVersion; bloomr.sys: -dbr.brmain, +.br.home
1 parent 4a638d2 commit 25b7129

File tree

13 files changed

+162
-140
lines changed

13 files changed

+162
-140
lines changed

bloomr.build.R

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,16 @@ bloomrTree <- function(){
529529
})
530530
}
531531

532+
bloomrTree.AddVersion <- function(){ # Add and possible relpace version file (ver, build, edition) to tree
533+
### Studio will replace the Lab version file, Lab will replace the Core file.
534+
535+
download.git("curver.txt", "curver.txt")
536+
ver <- file.read("curver.txt")[1]
537+
edt <- paste(get.edition(), "edition")
538+
build <- makeBuildnum()
539+
file.write(p0(ver, "\n", build, "\n", edt), app.pt("bloomr.txt"))
540+
}
541+
532542
bloomrTree.Core <- function(){
533543
### Make BloomR Core tree
534544
### All editions contain Core edition files, so this function output differs only in the name given to the build folder, which is
@@ -539,11 +549,12 @@ bloomrTree.Core <- function(){
539549
existMake(G$branch, TRUE, FALSE, p0(desc, " root dir:"))
540550
makeDir(app.pt(), "BloomR app dir:")
541551

542-
## Id files
552+
## Add version file
553+
bloomrTree.AddVersion()
543554
# download.git("curver.txt", app.pt("bloomr.txt"))
544-
download.git("curver.txt", "curver.txt")
545-
ver <- file.read("curver.txt")[1]
546-
file.write(p0(ver, "\n", makeBuildnum()), app.pt("bloomr.txt"))
555+
# download.git("curver.txt", "curver.txt")
556+
# ver <- file.read("curver.txt")[1]
557+
# file.write(p0(ver, "\n", makeBuildnum()), app.pt("bloomr.txt"))
547558

548559
## Copy R and make site directory
549560
from <- p0(G$rzip , '/app')
@@ -598,11 +609,11 @@ bloomrTree.Core <- function(){
598609
download.git("src/ed/bloomr.ed.cmd", app.pt("ed/bloomr.ed.cmd"))
599610

600611

601-
## Set the edition if this is the actual Core
602-
if(is.core()){ # No, if a BRemacs edition is building the core components
603-
edt <- paste(get.edition(), "edition")
604-
file.write(edt, app.pt("bloomr.txt"), append=TRUE)
605-
}
612+
### Set the edition if this is the actual Core
613+
#if(is.core()){ # No, if a BRemacs edition is building the core components
614+
# edt <- paste(get.edition(), "edition")
615+
# file.write(edt, app.pt("bloomr.txt"), append=TRUE)
616+
#}
606617
}
607618

608619
bloomrTree.brEmacs <- function(){
@@ -611,6 +622,9 @@ bloomrTree.brEmacs <- function(){
611622
bremacs <- app.pt("bremacs")
612623
existMake(bremacs, TRUE, FALSE, "BRemacs tree")
613624

625+
## Replace version file
626+
bloomrTree.AddVersion()
627+
614628
## Copy Emacs
615629
message("Copying main BRemacs files")
616630
from <- G$emacszip
@@ -786,28 +800,31 @@ br-keys.el br-menico.elc br-rnw.el br-setmodes.elc ess-init.R spli
786800

787801

788802
## Set the edition if this is the actual Lab
789-
if(is.lab()){ # No, if Studio is building common BRemacs
790-
## ver <- file.read(app.pt("bloomr.txt"))
791-
edt <- paste(get.edition(), "edition")
792-
## file.write(p0(ver, "\n", edt), app.pt("bloomr.txt"))
793-
file.write(edt, app.pt("bloomr.txt"), append=TRUE)
794-
}
803+
#if(is.lab()){ # No, if Studio is building common BRemacs
804+
# ## ver <- file.read(app.pt("bloomr.txt"))
805+
# edt <- paste(get.edition(), "edition")
806+
# ## file.write(p0(ver, "\n", edt), app.pt("bloomr.txt"))
807+
# file.write(edt, app.pt("bloomr.txt"), append=TRUE)
808+
#}
795809

796810
}
797811

798812

799813
bloomrTree.Studio <- function(){
800814
### We add the to the tree created by bloomrTree.brEmacs() the LaTeX related component
815+
816+
## Replace version file
817+
bloomrTree.AddVersion()
801818

802819
makeStudio.addLatex()
803820
makeStudio.addPerl()
804821
makeStudio.addPandoc()
805822

806823
## Set the edition
807-
## ver <- file.read(app.pt("bloomr.txt"))
808-
edt <- paste(get.edition(), "edition")
809-
## file.write(p0(ver, "\n", edt), app.pt("bloomr.txt"))
810-
file.write(edt, app.pt("bloomr.txt"), append=TRUE)
824+
# ver <- file.read(app.pt("bloomr.txt"))
825+
# edt <- paste(get.edition(), "edition")
826+
# file.write(p0(ver, "\n", edt), app.pt("bloomr.txt"))
827+
# file.write(edt, app.pt("bloomr.txt"), append=TRUE)
811828
}
812829

813830

@@ -1243,7 +1260,7 @@ makeBuildnum <- function(){
12431260

12441261
}
12451262

1246-
debug.mismatch <- function(){ # Test and stop on deb & what args consistence
1263+
debug.mismatch <- function(){ # Test and stop on deb & what args inconsistence
12471264
### When you use step by step build via 'deb'", this function checks that 'what' matches previous steps
12481265

12491266
wmess <-

latest.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@ _Change details_
1414

1515
build: UNC build support makeStudio (with miktex, mpm, initexmf), minimal Perl, user downloads folder,
1616
switch-based branching, find alternative TeX repos, removed refs to old Java API, apps dir,
17-
~get7zbin adapted to new installer content, ~cran.geturl skips non-standard build (eg UCRT Rcpp).
17+
~get7zbin adapted to new installer content, ~cran.geturl skips non-standard build (eg UCRT Rcpp),
1818
+melpa.getvers, +melpa.getpak, ~download.git, +makeBuildnum, +debug.mismatch, +squoteu, +dquoteu.
1919
br-init.el: ~tab-always-indent, ~inferior-ess-r-program, ~ess-r-post-run-hook, ~no req. ess markdown,
2020
+declare br-init-simple-menu, +br-init-autoloads, ~br-app-dir(basename is "apps").
2121
br-setmodes.el: -Disabled bremacs-rmd-mode, ~br-R-save-on-quit ~cl-defmethod ess-quit--override
2222
br-keys.el: -br-ess-quit, ~polymode-eval-region-or-chunk, +smart_assign.
23-
bloomr.sys.R: +q/quit, -.br.testBR, -br.getLatexAddons, -br.getPandoc,
24-
-.br.getPandoc.release, -download.bin.
25-
bloomr.rmd: +.br.addpaths, +perl, ~br.rmd2both, ~br.rmd2pdf, ~br.rmd2html, ~br.md2pdf, +buildenv, +br.rmd2slides.
23+
bloomr.sys.R: +q/quit, -.br.testBR, -br.getLatexAddons, -br.getPandoc, -.br.getPandoc.release, -download.bin,
24+
-dbr.brmain +.br.home
25+
bloomr.rmd: +.br.addpaths, +perl, ~br.rmd2both, ~br.rmd2pdf, ~br.rmd2html, ~br.md2pdf, +buildenv, +br.rmd2slides,
26+
'bloomr' env follows package 'stats' position and not 'base', the assign is compatible with recent R.
27+
bloomr.beta.Rmd: 'bloomr' env follows package 'stats' as for bloomr.rmd.
2628
xlx.R: plyr:::rbind.fill without loading package to avoid conflicts.
2729
ed: Cmds work from prompt, +BREMACSDBG, no Java, ~site-start.el.
2830
bloomr.nsi: Warn on existing install dir and low space.
31+
bloomr.api.R: Unused, hence removed
32+
bloomr.beta.OLD.Rmd: Unused, hence removed
33+
bloomr.download.build.R: now based on R curl and builds in date based folder in CWD.
2934

src/bloomr.R

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## ----store, opts.label='purlme'-----------------------------------------------
1+
## ----store, opts.label='purlme'----------------------------------------------------------------------------------------------------
22
## Purl this first
33
## Store br.* objects in bloomr env in base namespace
44
assign('bloomr.usr', new.env(parent=asNamespace("stats")))
@@ -18,7 +18,7 @@ store=function(sym){
1818
}
1919

2020

21-
## ----br.bdh, opts.label='purlme'----------------------------------------------
21+
## ----br.bdh, opts.label='purlme'---------------------------------------------------------------------------------------------------
2222
br.bdh=function(
2323
con, securities, fields="PX_LAST", start.date, end.date = NULL,
2424
option.names = NULL, option.values = NULL,
@@ -32,7 +32,7 @@ br.bdh=function(
3232
}
3333
store(br.bdh)
3434

35-
## ----br.bulk.csv, opts.label='purlme'-----------------------------------------
35+
## ----br.bulk.csv, opts.label='purlme'----------------------------------------------------------------------------------------------
3636
br.bulk.csv=function(con, file, start=Sys.Date()-5, field="PX_LAST", cols=NULL,
3737
addtype=FALSE, showtype=FALSE, use.xts=TRUE, comma=TRUE,
3838
price=TRUE, nrow=5, same.dates=FALSE, no.na=FALSE, empty.sec=0
@@ -77,7 +77,7 @@ br.bulk.csv=function(con, file, start=Sys.Date()-5, field="PX_LAST", cols=NULL,
7777
}
7878
store(br.bulk.csv)
7979

80-
## ----br.bulk.desc, opts.label='purlme'----------------------------------------
80+
## ----br.bulk.desc, opts.label='purlme'---------------------------------------------------------------------------------------------
8181
br.bulk.desc=function(con, tiks) {
8282

8383
LL = lapply(tiks, function(tik){
@@ -89,7 +89,7 @@ br.bulk.desc=function(con, tiks) {
8989
}
9090
store(br.bulk.desc)
9191

92-
## ----br.bulk.idx, opts.label='purlme'-----------------------------------------
92+
## ----br.bulk.idx, opts.label='purlme'----------------------------------------------------------------------------------------------
9393
br.bulk.idx=function(con, index, start=Sys.Date()-5, field="PX_LAST", showtype=FALSE,
9494
include.idx=TRUE, use.xts=TRUE,
9595
nsec=10, price=TRUE, nrow=5,
@@ -139,7 +139,7 @@ br.bulk.idx=function(con, index, start=Sys.Date()-5, field="PX_LAST", showtype=F
139139
}
140140
store(br.bulk.idx)
141141

142-
## ----br.bulk.tiks, opts.label='purlme'----------------------------------------
142+
## ----br.bulk.tiks, opts.label='purlme'---------------------------------------------------------------------------------------------
143143
br.bulk.tiks=function(
144144
con,
145145
tiks,
@@ -223,7 +223,7 @@ br.bulk.tiks=function(
223223
}
224224
store(br.bulk.tiks)
225225

226-
## ----br.desc, opts.label='purlme'---------------------------------------------
226+
## ----br.desc, opts.label='purlme'--------------------------------------------------------------------------------------------------
227227
br.desc=function(con, tik)
228228
{
229229

@@ -252,7 +252,7 @@ br.desc=function(con, tik)
252252
}
253253
store(br.desc)
254254

255-
## ----rmd-internal, opts.label='purlme'----------------------------------------
255+
## ----rmd-internal, opts.label='purlme'---------------------------------------------------------------------------------------------
256256
.br.addpaths <- function(pandonly = FALSE, quiet=TRUE){
257257
### Add to Windows System Path the executable directories of LaTeX, Pandoc, and Perl with this search priority, and
258258
### return invisibly the original path. If "pandonly" is true, add only Pandoc. If "quiet" is false, print the new path.
@@ -262,18 +262,18 @@ store(br.desc)
262262
stop("Sorry, Bloomberg Terminal only exists for Windows and so BloomR functions.")
263263

264264
## Find executables
265-
panexe=dbr.brmain("pandoc/bin/pandoc.exe")
265+
panexe=.br.home("pandoc/bin/pandoc.exe")
266266
if(!file.exists(panexe))
267267
stop(paste("Unable to find:", panexe, '\nYour BloomR edition might not support it.'))
268268
pandir=normalizePath(dirname(panexe))
269269

270-
latbin=dbr.brmain("latex/texmfs/install/miktex/bin/x64/latex.exe")
270+
latbin=.br.home("latex/texmfs/install/miktex/bin/x64/latex.exe")
271271
if(!file.exists(latbin) && !pandonly){
272272
stop(paste("Unable to find:", latbin, '\nYour BloomR edition might not support it.'))
273273
}
274274
latdir=normalizePath(dirname(latbin))
275275

276-
perlexe <- dbr.brmain("perl/bin/perl.exe")
276+
perlexe <- .br.home("perl/bin/perl.exe")
277277
if(!file.exists(perlexe) && !pandonly){
278278
stop(paste("Unable to find:", perlexe, '\nYour BloomR edition might not support it.'))
279279
}
@@ -299,7 +299,7 @@ store(br.desc)
299299

300300

301301

302-
## ----br.md2pdf, opts.label='purlme'-------------------------------------------
302+
## ----br.md2pdf, opts.label='purlme'------------------------------------------------------------------------------------------------
303303
br.md2pdf=function(md.file, pdf.file, quiet=TRUE){
304304
### Make a markdown file into a PDF
305305
### You need the proper BloomR version
@@ -324,7 +324,7 @@ br.md2pdf=function(md.file, pdf.file, quiet=TRUE){
324324
}
325325
store(br.md2pdf)
326326

327-
## ----br.rmd2html, opts.label='purlme'-----------------------------------------
327+
## ----br.rmd2html, opts.label='purlme'----------------------------------------------------------------------------------------------
328328
br.rmd2html=function(rmd.file, html.file, quiet=TRUE){
329329
### Make an R Markdown file into a HTML self-contained file
330330
### You need the proper BloomR edition
@@ -355,7 +355,7 @@ br.rmd2html=function(rmd.file, html.file, quiet=TRUE){
355355
}
356356
store(br.rmd2html)
357357

358-
## ----br.rmd2slides, opts.label='purlme'---------------------------------------
358+
## ----br.rmd2slides, opts.label='purlme'--------------------------------------------------------------------------------------------
359359
br.rmd2slides <- function(rmd.file, html.file, quiet=TRUE){
360360
### Make an R Markdown file into a Google Slides self-contained HTML file
361361
### You need proper BloomR edition
@@ -388,7 +388,7 @@ br.rmd2slides <- function(rmd.file, html.file, quiet=TRUE){
388388
store(br.rmd2slides)
389389

390390

391-
## ----br.rmd2pdf, opts.label='purlme'------------------------------------------
391+
## ----br.rmd2pdf, opts.label='purlme'-----------------------------------------------------------------------------------------------
392392
br.rmd2pdf=function(rmd.file, pdf.file, quiet=TRUE){
393393
### Make an R Markdown file into a PDF
394394
### You need BloomR LaTeX addons or the proper BloomR version
@@ -417,7 +417,7 @@ br.rmd2pdf=function(rmd.file, pdf.file, quiet=TRUE){
417417
}
418418
store(br.rmd2pdf)
419419

420-
## ----br.rmd2both, opts.label='purlme'-----------------------------------------
420+
## ----br.rmd2both, opts.label='purlme'----------------------------------------------------------------------------------------------
421421
br.rmd2both=function(rmd.file, out.dir, quiet=TRUE){
422422
### Make an R Markdown file into a PDF and an HTML self-contained file
423423
### You need BloomR LaTeX addons or the proper BloomR version
@@ -467,7 +467,7 @@ br.rmd2both=function(rmd.file, out.dir, quiet=TRUE){
467467
store(br.rmd2both)
468468

469469

470-
## ----br.sample, opts.label='purlme'-------------------------------------------
470+
## ----br.sample, opts.label='purlme'------------------------------------------------------------------------------------------------
471471
br.sample=function(nrow, nsec=1, price=TRUE, start=Sys.Date(), mean=ifelse(price, 10, 0.1), sd=1,
472472
jitter=0, same.dates=FALSE, no.na=FALSE, df=FALSE, empty.sec=0, sec.names=NULL)
473473
{
@@ -534,13 +534,13 @@ br.sample=function(nrow, nsec=1, price=TRUE, start=Sys.Date(), mean=ifelse(price
534534
}
535535
store(br.sample)
536536

537-
## ----deprecated, opts.label='purlme'------------------------------------------
537+
## ----deprecated, opts.label='purlme'-----------------------------------------------------------------------------------------------
538538
bbg.open=function() stop("Sorry 'bbg.open' is now deprecated. Please use br.open().")
539539
bbg.close=function(con) stop("Sorry 'bbg.close' is now deprecated. Please use br.close().")
540540
store(bbg.open)
541541
store(bbg.close)
542542

543-
## ----bbg-internal, opts.label='purlme'----------------------------------------
543+
## ----bbg-internal, opts.label='purlme'---------------------------------------------------------------------------------------------
544544

545545
## Check connection token
546546
.br.is.con=function(con) identical(attr(con, 'jclass'), "org/findata/blpwrapper/Connection")
@@ -566,7 +566,7 @@ store(bbg.close)
566566

567567

568568
.br.jar=function(){
569-
jarpath=dbr.brmain("/blpapi/bin")
569+
jarpath=.br.home("/blpapi/bin")
570570
Sys.glob(file.path(jarpath, "blpapi-[0-9]*.jar"))
571571
}
572572

@@ -577,14 +577,14 @@ store(.br.check.type)
577577
store(.br.cuttype)
578578
store(.br.jar)
579579

580-
## ----connections, opts.label='purlme'-----------------------------------------
580+
## ----connections, opts.label='purlme'----------------------------------------------------------------------------------------------
581581
br.open=function() blpConnect(blpapi.jar.file=.br.jar())
582582
br.close=function(conn) if(!is.null(conn)) blpDisconnect(conn)
583583

584584
store(br.open)
585585
store(br.close)
586586

587-
## ----miscfunc, opts.label='purlme'--------------------------------------------
587+
## ----miscfunc, opts.label='purlme'-------------------------------------------------------------------------------------------------
588588

589589
#Clean up
590590
## Remove visible and invisible objects
@@ -598,7 +598,7 @@ rm.var=function()
598598
store(rm.all)
599599
store(rm.var)
600600

601-
## ----betafun, opts.label='purlme'---------------------------------------------
601+
## ----betafun, opts.label='purlme'--------------------------------------------------------------------------------------------------
602602

603603
br.beta=function(){
604604
f=paste0(R.home("share"), "/bloomr/bloomr.beta.R")
@@ -608,7 +608,7 @@ br.beta=function(){
608608
store(br.beta)
609609

610610

611-
## ----time, opts.label='purlme'------------------------------------------------
611+
## ----time, opts.label='purlme'-----------------------------------------------------------------------------------------------------
612612
`%+%` <- function(x,y) UseMethod("%+%")
613613
`%+%.Date` <- function(date,n) seq(date, by = paste (n, "months"), length = 2)[2]
614614
`%-%` <- function(x,y) UseMethod("%-%")
@@ -664,7 +664,7 @@ store(last.day)
664664
store(day.us)
665665

666666

667-
## ----attach, opts.label='purlme'----------------------------------------------
667+
## ----attach, opts.label='purlme'---------------------------------------------------------------------------------------------------
668668
### Make visible br.* in bloomr env and base ns
669669
attach(bloomr.usr)
670670
rm(store)

src/bloomr.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,18 +797,18 @@ store(br.desc)
797797
stop("Sorry, Bloomberg Terminal only exists for Windows and so BloomR functions.")
798798
799799
## Find executables
800-
panexe=dbr.brmain("pandoc/bin/pandoc.exe")
800+
panexe=.br.home("pandoc/bin/pandoc.exe")
801801
if(!file.exists(panexe))
802802
stop(paste("Unable to find:", panexe, '\nYour BloomR edition might not support it.'))
803803
pandir=normalizePath(dirname(panexe))
804804
805-
latbin=dbr.brmain("latex/texmfs/install/miktex/bin/x64/latex.exe")
805+
latbin=.br.home("latex/texmfs/install/miktex/bin/x64/latex.exe")
806806
if(!file.exists(latbin) && !pandonly){
807807
stop(paste("Unable to find:", latbin, '\nYour BloomR edition might not support it.'))
808808
}
809809
latdir=normalizePath(dirname(latbin))
810810
811-
perlexe <- dbr.brmain("perl/bin/perl.exe")
811+
perlexe <- .br.home("perl/bin/perl.exe")
812812
if(!file.exists(perlexe) && !pandonly){
813813
stop(paste("Unable to find:", perlexe, '\nYour BloomR edition might not support it.'))
814814
}
@@ -1436,7 +1436,7 @@ Details
14361436
14371437
14381438
.br.jar=function(){
1439-
jarpath=dbr.brmain("/blpapi/bin")
1439+
jarpath=.br.home("/blpapi/bin")
14401440
Sys.glob(file.path(jarpath, "blpapi-[0-9]*.jar"))
14411441
}
14421442

0 commit comments

Comments
 (0)