Skip to content

Commit ce84b83

Browse files
committed
Merge branch 'master' of https://github.com/Funz/Funz.R
2 parents 8378109 + b36de4a commit ce84b83

File tree

4 files changed

+41
-37
lines changed

4 files changed

+41
-37
lines changed

Diff for: .github/workflows/check.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
r-version: [ 3.6, oldrel, release, devel ]
1717

1818
env:
19-
debian-deps: libssl-dev libcurl4-openssl-dev
19+
debian-deps: libssl-dev libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev
2020
macos-deps: openssl-1.1.1h
2121
windows-deps: openssl
2222

@@ -31,7 +31,7 @@ jobs:
3131
distribution: 'adopt'
3232
java-version: 11
3333

34-
- uses: r-lib/actions/setup-r@v1
34+
- uses: r-lib/actions/setup-r@v2
3535
with:
3636
r-version: ${{ matrix.r-version }}
3737

@@ -53,16 +53,19 @@ jobs:
5353
run: |
5454
echo "C:\rtools" >> $GITHUB_PATH
5555
echo "C:\rtools40" >> $GITHUB_PATH
56+
echo "C:\rtools41" >> $GITHUB_PATH
57+
echo "C:\rtools42" >> $GITHUB_PATH
58+
echo "C:\rtools43" >> $GITHUB_PATH
5659
shell: bash
5760
- name: Install Windows dependencies
5861
if: ${{ runner.os == 'Windows' && env.windows-deps != '' }}
5962
run: |
60-
mingw32.exe pacman -Sy
61-
mingw64.exe pacman -Sy
63+
mingw32.exe pacman -Sy || echo "No mingw32.exe"
64+
mingw64.exe pacman -Sy || echo "No mingw64.exe"
6265
for i in ${{ env.windows-deps }}; do
6366
echo -n " $i"
64-
mingw32.exe pacman --sync --noconfirm mingw-w64-i686-$i
65-
mingw64.exe pacman --sync --noconfirm mingw-w64-x86_64-$i mingw-w64-i686-$i
67+
mingw32.exe pacman --sync --noconfirm mingw-w64-i686-$i || echo "No mingw32.exe"
68+
mingw64.exe pacman --sync --noconfirm mingw-w64-x86_64-$i mingw-w64-i686-$i || echo "No mingw64.exe"
6669
done
6770
shell: bash
6871

Diff for: .github/workflows/examples.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, windows-latest, macos-latest]
16-
R: [3.6, 4.0, 4.1]
16+
R: [3.6, oldrel, release, devel ]
1717
runs-on: ${{ matrix.os }}
1818
env:
1919
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
java-version: 11
2424
distribution: 'adopt'
25-
- uses: r-lib/actions/setup-r@v1
25+
- uses: r-lib/actions/setup-r@v2
2626
with:
2727
r-version: ${{ matrix.R }}
2828
- run: mkdir ${{ matrix.os }}-R${{ matrix.R }}
@@ -36,9 +36,9 @@ jobs:
3636
- if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
3737
run: sudo R CMD javareconf
3838
- if: matrix.os == 'ubuntu-latest'
39-
run: sudo apt install -y libcurl4-openssl-dev
39+
run: sudo apt install -y libcurl4-openssl-dev libharfbuzz-dev libfribidi-dev
4040
- run: |
41-
Rscript -e "if (R.Version()$os!='linux-gnu') options(install.packages.compile.from.source='never'); install.packages('remotes', repos = 'https://cloud.r-project.org'); download.file('https://raw.githubusercontent.com/Funz/Funz.R/master/DESCRIPTION','DESCRIPTION'); remotes::install_deps(dependencies=TRUE)" > ${{ matrix.os }}-R${{ matrix.R }}/install.Rout; \
41+
Rscript -e "if (R.Version()[['os']]!='linux-gnu') options(install.packages.compile.from.source='never'); install.packages('remotes', repos = 'https://cloud.r-project.org'); download.file('https://raw.githubusercontent.com/Funz/Funz.R/master/DESCRIPTION','DESCRIPTION'); remotes::install_deps(dependencies=TRUE)" > ${{ matrix.os }}-R${{ matrix.R }}/install.Rout; \
4242
Rscript -e "install.packages('devtools', repos= 'https://cloud.r-project.org'); devtools::install_github('Funz/Funz.R',dependencies=FALSE, INSTALL_opts=c('--no-multiarch'))" > ${{ matrix.os }}-R${{ matrix.R }}/install.Rout; \
4343
Rscript -e "library(Funz); install.Design('GradientDescent')" >> ${{ matrix.os }}-R${{ matrix.R }}/install.Rout
4444
shell: bash

Diff for: DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Description: Binding to Funz <https://funz.github.io/> parametric computing envi
88
Also provide function to deal with Funz setup (eg. install plugin/binding to simulation software, algorithms, ...).
99
License: Apache License (>= 2)
1010
Encoding: UTF-8
11-
Imports: rJava (>= 1.0-0), Rserve (>= 1.8), xml2, utils, foreach, parallel, processx, gh
11+
Imports: rJava (>= 1.0-0), Rserve (>= 1.8), xml2, utils, foreach, parallel, processx, curl, jsonlite
1212
SystemRequirements: Java (>= 8)
1313
URL: https://github.com/Funz/Funz.R
1414
RoxygenNote: 7.2.3

Diff for: R/install.R

+27-26
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
.github_pattern))))
4545
}
4646

47-
.github_repos <- gh::gh("/orgs/Funz/repos",.token=NA)
48-
if (length(.github_repos)==0) .github_repos <- NA
47+
# should blok at package install/lazy load if not connected: .github_repos <- gh::gh("/orgs/Funz/repos",.token=NA, per_page=100)
48+
#if (length(.github_repos)==0)
49+
.github_repos <- NA
4950

5051
############################ Models #################################
5152

@@ -73,11 +74,12 @@ installed.Models <- function() {
7374
#' }
7475
available.Models <- function(refresh_repo = F) {
7576
if (refresh_repo | any(is.na(.github_repos)))
76-
.env$.github_repos <- gh::gh("/orgs/Funz/repos",.token=NA)
77+
.github_repos <- jsonlite::fromJSON(readLines(curl::curl("https://api.github.com/orgs/Funz/repos?per_page=100"),warn=FALSE))
78+
# not working behind some proxy: gh::gh("/orgs/Funz/repos",.token=NA, per_page=100)
7779

7880
gsub("plugin-","",
79-
unlist(lapply(.github_repos,
80-
function(r) {if (length(grep("plugin-",r$name))>0) r$name else NULL})),
81+
unlist(lapply(.github_repos$name,
82+
function(r) {if (length(grep("plugin-",r))>0) r else NULL})),
8183
fixed=T)
8284
}
8385

@@ -155,7 +157,7 @@ setup.Model <- function(model, edit.script=FALSE) {
155157
attr(node,"command") <- normalizePath(script)
156158
cplugin = file.path(FUNZ_HOME,"plugins","calc",paste0(model,".cplugin.jar"))
157159
if (file.exists(cplugin))
158-
attr(node,"cplugin") <- paste0("file:/",normalizePath(cplugin))
160+
attr(node,"cplugin") <- paste0("file://",normalizePath(cplugin))
159161
}
160162
if (isTRUE(node == "[ comment ]")) {
161163
node <- NA
@@ -169,7 +171,7 @@ setup.Model <- function(model, edit.script=FALSE) {
169171
attr(node,"command") <- normalizePath(script)
170172
cplugin = file.path(FUNZ_HOME,"plugins","calc",paste0(model,".cplugin.jar"))
171173
if (file.exists(cplugin))
172-
attr(node,"cplugin") <- paste0("file:/",normalizePath(cplugin))
174+
attr(node,"cplugin") <- paste0("file://",normalizePath(cplugin))
173175
}
174176
calculator.xml$CALCULATOR[[i+1]] <- node
175177
names(calculator.xml$CALCULATOR)[[i+1]] <- "CODE"
@@ -233,14 +235,13 @@ install_github.Model <- function(model,force=F, edit.script=FALSE) {
233235
#' install.Model('Modelica')
234236
#' }
235237
install.Model <- function(model,force=F, edit.script=FALSE) {
236-
if (file.exists(model))
237-
install_file.Model(model, force, edit.script)
238-
else {
239-
if (model %in% available.Models())
240-
install_github.Model(model, force, edit.script)
241-
else
242-
stop("Model ",model," is not available.")
243-
}
238+
if (file.exists(model) && !dir.exists(model))
239+
try({install_file.Model(model, force, edit.script); return()})
240+
241+
if (model %in% available.Models())
242+
install_github.Model(model, force, edit.script)
243+
else
244+
stop("Model ",model," is not available.")
244245
}
245246

246247

@@ -269,11 +270,12 @@ installed.Designs <- function() {
269270
#' }
270271
available.Designs <- function(refresh_repo = F) {
271272
if (refresh_repo | any(is.na(.github_repos)))
272-
.env$.github_repos <- gh::gh("/orgs/Funz/repos",.token=NA)
273+
.github_repos <- jsonlite::fromJSON(readLines(curl::curl("https://api.github.com/orgs/Funz/repos?per_page=100"),warn=FALSE))
274+
# not working behind some proxy: gh::gh("/orgs/Funz/repos",.token=NA, per_page=100)
273275

274276
gsub("algorithm-","",
275-
unlist(lapply(.github_repos,
276-
function(r) {if (length(grep("algorithm-",r$name))>0) r$name else NULL})),
277+
unlist(lapply(.github_repos$name,
278+
function(r) {if (length(grep("algorithm-",r))>0) r else NULL})),
277279
fixed=T)
278280
}
279281

@@ -347,12 +349,11 @@ install_github.Design <- function(design,force=F) {
347349
#' install.Design('GradientDescent')
348350
#' }
349351
install.Design <- function(design,force=F) {
350-
if (file.exists(design))
351-
install_file.Design(design, force)
352-
else {
353-
if (design %in% available.Designs())
354-
install_github.Design(design, force)
355-
else
356-
stop("Design ",design," is not available.")
357-
}
352+
if (file.exists(design) && !dir.exists(design))
353+
try({install_file.Design(design, force); return()})
354+
355+
if (design %in% available.Designs())
356+
install_github.Design(design, force)
357+
else
358+
stop("Design ",design," is not available.")
358359
}

0 commit comments

Comments
 (0)