aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/cran.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-09-15 22:33:50 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-09-15 22:33:50 +0200
commit41b8b05c9e515e43753ddbed24b70e27b5c3be31 (patch)
treed4d9da4b1fd907400e7f01d95f79f45f2c4a36b2 /gnu/packages/cran.scm
parent4112ff7e74ee1d1f13c3a7f4aaa6dc9d0ca8c3eb (diff)
downloadguix-41b8b05c9e515e43753ddbed24b70e27b5c3be31.tar
guix-41b8b05c9e515e43753ddbed24b70e27b5c3be31.tar.gz
gnu: Add r-shinytree.
* gnu/packages/cran.scm (r-shinytree): New variable.
Diffstat (limited to 'gnu/packages/cran.scm')
-rw-r--r--gnu/packages/cran.scm78
1 files changed, 78 insertions, 0 deletions
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm
index 5398b4dca3..d33eb20a37 100644
--- a/gnu/packages/cran.scm
+++ b/gnu/packages/cran.scm
@@ -797,6 +797,84 @@ extensive prebuilt widgets make it possible to build beautiful,
responsive, and powerful applications with minimal effort.")
(license license:artistic2.0)))
+;; This package includes minified JavaScript files. When upgrading please
+;; check that there are no new minified JavaScript files.
+(define-public r-shinytree
+ (package
+ (name "r-shinytree")
+ (version "0.2.7")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (cran-uri "shinyTree" version))
+ (sha256
+ (base32
+ "0jfx2capckv7hf2yx3fn8i4rcmhi222ah91jnmhg497x8wgz31s3"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Delete minified JavaScript
+ (for-each delete-file
+ '("inst/www/jsTree-3.3.7/libs/require.js"
+ "inst/www/jsTree-3.3.7/libs/jquery.js"
+ "inst/www/jsTree-3.3.7/jstree.min.js"))
+ #t))))
+ (properties `((upstream-name . "shinyTree")))
+ (build-system r-build-system)
+ (arguments
+ `(#:modules ((guix build utils)
+ (guix build r-build-system)
+ (srfi srfi-1)
+ (ice-9 popen))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'replace-minified-javascript
+ (lambda* (#:key inputs #:allow-other-keys)
+ (with-directory-excursion "inst/www/jsTree-3.3.7/"
+ (symlink (string-append (assoc-ref inputs "js-requirejs")
+ "/share/javascript/require.min.js")
+ "libs/require.js")
+ (call-with-values
+ (lambda ()
+ (unzip2
+ `((,(assoc-ref inputs "js-jquery")
+ "libs/jquery.js")
+ ("jstree.js"
+ "jstree.min.js"))))
+ (lambda (sources targets)
+ (for-each (lambda (source target)
+ (format #t "Processing ~a --> ~a~%"
+ source target)
+ (let ((minified (open-pipe* OPEN_READ "uglify-js" source)))
+ (call-with-output-file target
+ (lambda (port)
+ (dump-port minified port)))))
+ sources targets))))
+ #t)))))
+ (propagated-inputs
+ `(("r-htmlwidgets" ,r-htmlwidgets)
+ ("r-jsonlite" ,r-jsonlite)
+ ("r-promises" ,r-promises)
+ ("r-shiny" ,r-shiny)
+ ("r-stringr" ,r-stringr)))
+ (inputs
+ `(("js-requirejs" ,js-requirejs)))
+ (native-inputs
+ `(("uglify-js" ,uglify-js)
+ ("js-jquery"
+ ,(origin
+ (method url-fetch)
+ (uri "https://code.jquery.com/jquery-3.3.1.js")
+ (sha256
+ (base32
+ "1b8zxrp6xwzpw25apn8j4qws0f6sr7qr7h2va5h1mjyfqvn29anq"))))))
+ (home-page "https://cran.r-project.org/web/packages/shinyTree/")
+ (synopsis "jsTree bindings for Shiny")
+ (description
+ "This package exposes R bindings to jsTree, a JavaScript library that
+supports interactive trees, to enable rich, editable trees in Shiny.")
+ (license license:expat)))
+
(define-public r-shinydashboard
(package
(name "r-shinydashboard")