Skip to content

Commit

Permalink
Added install.LyX
Browse files Browse the repository at this point in the history
  • Loading branch information
talgalili committed Mar 11, 2013
1 parent 353a475 commit b843c33
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export(install.git)
export(install.GitHub) export(install.GitHub)
export(install.GraphicsMagick) export(install.GraphicsMagick)
export(install.ImageMagick) export(install.ImageMagick)
export(install.LyX)
export(install.MikTeX) export(install.MikTeX)
export(install.packages.zip) export(install.packages.zip)
export(install.pandoc) export(install.pandoc)
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ NEW FUNCTIONS ADDED:
* add.installr.GUI and remove.installr.GUI - for adding a menu system to Rgui * add.installr.GUI and remove.installr.GUI - for adding a menu system to Rgui
* install.ImageMagick * install.ImageMagick
* install.GraphicsMagick * install.GraphicsMagick
* install.LyX


UPDATED FUNCTIONS: UPDATED FUNCTIONS:
* install.URL - * install.URL -
Expand Down
60 changes: 60 additions & 0 deletions R/install.r
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -365,6 +365,64 @@ install.MikTeX <- function(version, page_with_download_url="http://miktex.org/d
# #








#' @title Downloads and installs LyX for windows
#' @description Allows the user to downloads and install the latest version of LyX for Windows.
#' @details
#' LyX is an advanced open source document processor running on Linux/Unix, Windows, and Mac OS X. It is called a "document processor", because unlike standard word processors, LyX encourages an approach to writing based on the structure of your documents, not their appearance. LyX lets you concentrate on writing, leaving details of visual layout to the software. LyX automates formatting according to predefined rule sets, yielding consistency throughout even the most complex documents. LyX produces high quality, professional output – using LaTeX, an open source, industrial strength typesetting engine, in the background.
#' @param page_with_download_url the URL of the LyX download page.
#' @new_installation boolean. TRUE means we should make a new installation of LyX. FALSE means to update an existing installation. Missing - prompts the user to decide.
#' @param ... extra parameters to pass to \link{install.URL}
#' @return TRUE/FALSE - was the installation successful or not.
#' @export
#' @references
#' \itemize{
#' \item LyX homepage: \url{http://www.lyx.org/}
#' }
#' @examples
#' \dontrun{
#' install.LyX() # installs the latest version of git
#' }
install.LyX <- function(page_with_download_url="http://www.lyx.org/Download", new_installation, ...) {

# get download URL:
page <- readLines(page_with_download_url, warn = FALSE)


# decide which version to get:
if(missing(new_installation) || is.logical(new_installation)) {
choices <- c("New: install a new version of LyX",
"Update: update an existing installation of LyX")
the_answer <- menu(choices, graphics = FALSE, title = "Do you wish a new installation of LyX\n or an update to an existing installation?")
} else {
the_answer <- ifelse(new_installation, 1, 2)
}

pat <- switch(the_answer,
"ftp://ftp.lyx.org/pub/lyx/bin/[0-9.]+/LyX-[0-9.]+-Bundle-[0-9.]+.exe",
"ftp://ftp.lyx.org/pub/lyx/bin/[0-9.]+/LyX-[0-9.]+-Installer-[0-9.]+.exe"
)

# ftp://ftp.lyx.org/pub/lyx/bin/2.0.5.1/LyX-2.0.5.1-Bundle-4.exe
# URL = "ftp://ftp.lyx.org/pub/lyx/bin/2.0.5.1/LyX-2.0.5.1-Installer-4.exe"
# install.URL(URL)

target_line <- grep(pat, page, value = TRUE);
m <- regexpr(pat, target_line);
URL <- regmatches(target_line, m) # (The http still needs to be prepended.

# install.
install.URL(URL,...)
}






#' @title Downloads and installs RStudio for windows #' @title Downloads and installs RStudio for windows
#' @description Allows the user to downloads and install the latest version of RStudio for Windows. #' @description Allows the user to downloads and install the latest version of RStudio for Windows.
#' @details #' @details
Expand Down Expand Up @@ -607,6 +665,7 @@ installr <- function(use_GUI = TRUE, ...) {
"Rtools", "Rtools",
"git", "git",
"MikTeX", "MikTeX",
"LyX",
"pandoc", "pandoc",
"GitHub", "GitHub",
"ImageMagick", "ImageMagick",
Expand All @@ -621,6 +680,7 @@ installr <- function(use_GUI = TRUE, ...) {
install.Rtools(), install.Rtools(),
install.git(), install.git(),
install.MikTeX(), install.MikTeX(),
install.LyX(),
install.pandoc(), install.pandoc(),
install.GitHub(), install.GitHub(),
install.ImageMagick(), install.ImageMagick(),
Expand Down
44 changes: 44 additions & 0 deletions man/install.LyX.Rd
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,44 @@
\name{install.LyX}
\alias{install.LyX}
\title{Downloads and installs LyX for windows}
\usage{
install.LyX(page_with_download_url = "http://www.lyx.org/Download",
new_installation, ...)
}
\arguments{
\item{page_with_download_url}{the URL of the LyX download
page.}

\item{...}{extra parameters to pass to
\link{install.URL}}
}
\value{
TRUE/FALSE - was the installation successful or not.
}
\description{
Allows the user to downloads and install the latest
version of LyX for Windows.
}
\details{
LyX is an advanced open source document processor running
on Linux/Unix, Windows, and Mac OS X. It is called a
"document processor", because unlike standard word
processors, LyX encourages an approach to writing based
on the structure of your documents, not their appearance.
LyX lets you concentrate on writing, leaving details of
visual layout to the software. LyX automates formatting
according to predefined rule sets, yielding consistency
throughout even the most complex documents. LyX produces
high quality, professional outputusing LaTeX, an
open source, industrial strength typesetting engine, in
the background.
}
\examples{
\dontrun{
install.LyX() # installs the latest version of git
}
}
\references{
\itemize{ \item LyX homepage: \url{http://www.lyx.org/} }
}

0 comments on commit b843c33

Please sign in to comment.