[Soiltexture-commits] r94 - /
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 9 11:12:27 CET 2014
Author: jmoeys
Date: 2014-01-09 11:12:27 +0100 (Thu, 09 Jan 2014)
New Revision: 94
Added:
2_RCMDcheck_noexamples.bat
2_RCMDcheck_noexamples.sh
packageUtilities.R
soiltexturetransformation_1_RCMDBUILD.bat
soiltexturetransformation_2_RCMDcheck_noexamples.bat
soiltexturetransformation_compile.R
Removed:
2_RCMDcheck_notests.bat
2_RCMDcheck_notests.sh
README
R_CMD_wrapper.R
Sweave_wrapper.R
rcmdwrapper_1.02.zip
Modified:
3_RCMDINSTALL_build.BAT
soiltexture_compile.R
soiltexture_transformations_compile.R
soiltexture_vignette_compile.R
Log:
Copied: 2_RCMDcheck_noexamples.bat (from rev 83, 2_RCMDcheck_notests.bat)
===================================================================
--- 2_RCMDcheck_noexamples.bat (rev 0)
+++ 2_RCMDcheck_noexamples.bat 2014-01-09 10:12:27 UTC (rev 94)
@@ -0,0 +1,9 @@
+set pkgname=soiltexture
+
+cd /D "%rPackagesDir%\%pkgname%\pkg"
+
+R CMD check --no-examples %pkgname%
+
+ at REM --as-cran _0.2.11.tar.gz
+
+pause
Copied: 2_RCMDcheck_noexamples.sh (from rev 79, 2_RCMDcheck_notests.sh)
===================================================================
--- 2_RCMDcheck_noexamples.sh (rev 0)
+++ 2_RCMDcheck_noexamples.sh 2014-01-09 10:12:27 UTC (rev 94)
@@ -0,0 +1,6 @@
+# cd "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg/"
+cd "/home/jmoeys/Documents/_WORK/R_PACKAGES/soiltexture/pkg/"
+R CMD check --no-tests --as-cran soiltexture
+echo "press any key to continue"; read line
+
+
Deleted: 2_RCMDcheck_notests.bat
===================================================================
--- 2_RCMDcheck_notests.bat 2014-01-09 10:12:06 UTC (rev 93)
+++ 2_RCMDcheck_notests.bat 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,5 +0,0 @@
-c:
-cd \
-cd "C:\_R_PACKAGES\soiltexture\pkg"
-R CMD check --no-tests --as-cran soiltexture
-pause
Deleted: 2_RCMDcheck_notests.sh
===================================================================
--- 2_RCMDcheck_notests.sh 2014-01-09 10:12:06 UTC (rev 93)
+++ 2_RCMDcheck_notests.sh 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,6 +0,0 @@
-# cd "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg/"
-cd "/home/jmoeys/Documents/_WORK/R_PACKAGES/soiltexture/pkg/"
-R CMD check --no-tests --as-cran soiltexture
-echo "press any key to continue"; read line
-
-
Modified: 3_RCMDINSTALL_build.BAT
===================================================================
--- 3_RCMDINSTALL_build.BAT 2014-01-09 10:12:06 UTC (rev 93)
+++ 3_RCMDINSTALL_build.BAT 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,5 +1,7 @@
-c:
-cd \
-cd "C:\_R_PACKAGES\soiltexture\pkg"
-R CMD INSTALL --build --compact-docs --byte-compile soiltexture
+set pkgname=soiltexture
+
+cd /D "%rPackagesDir%\%pkgname%\pkg"
+
+R CMD INSTALL --build --compact-docs --byte-compile %pkgname%
+
pause
Deleted: README
===================================================================
--- README 2014-01-09 10:12:06 UTC (rev 93)
+++ README 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,58 +0,0 @@
- R-Forge SVN README
-
-
-(See "http://download.r-forge.r-project.org/manuals/R-Forge_Manual.pdf"
- for detailed information on registering a new project.)
-
-1. Introduction
------------------------------------------------------------------------
-R is free software distributed under a GNU-style copyleft. R-Forge is
-a central platform for the development of R packages, R-related
-software and further projects. Among many other web-based features it
-provides facilities for collaborative source code management via
-Subversion (SVN).
-
-2. The directory you're in
------------------------------------------------------------------------
-This is the repository of your project. It contains two important
-pre-defined directories namely 'pkg' and 'www'. These directories must
-not be deleted otherwise R-Forge's core functionality will not be
-available (i.e., daily checking and building of your package or the
-project websites).
-'pkg' and 'www' are standardized and therefore are going to be
-described in this README. The rest of your repository can be used as
-you like.
-
-3. 'pkg' directory
------------------------------------------------------------------------
-To make use of the package building and checking feature the package
-source code has to be put into the 'pkg' directory of your repository
-(i.e., 'pkg/DESCRIPTION', 'pkg/R', 'pkg/man', etc.) or, alternatively,
-a subdirectory of 'pkg'. The latter structure allows for having more
-than one package in a single project, e.g., if a project consists of
-the packages foo and bar then the source code will be located in
-'pkg/foo' and 'pkg/bar', respectively.
-
-R-Forge automatically examines the 'pkg' directory of every repository
-and builds the package sources as well as the package binaries on a
-daily basis for Mac OSX and Windows (if applicable). The package builds
-are provided in the 'R Packages' tab for download or can be installed
-directly in R from a CRAN-style repository using
-'install.packages("foo", repos="http://R-Forge.R-project.org")'.
-Furthermore, in the 'R Packages' tab developers can examine logs
-generated by the build and check process on different platforms.
-
-4. 'www' directory
------------------------------------------------------------------------
-Developers may present their work on a subdomain of R-Forge, e.g.,
-'http://foo.R-Forge.R-project.org', or via a link to an external
-website.
-
-This directory contains the project homepage which gets updated hourly
-on R-Forge, so please take into consideration that it will not be
-available right after you commit your changes or additions.
-
-5. Help
------------------------------------------------------------------------
-If you need help don't hesitate to contact us at R-Forge at R-project.org
-
Deleted: R_CMD_wrapper.R
===================================================================
--- R_CMD_wrapper.R 2014-01-09 10:12:06 UTC (rev 93)
+++ R_CMD_wrapper.R 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,465 +0,0 @@
-if( !"inlinedocs" %in% as.character( installed.packages()[,1] ) )
-{ #
- install.packages("inlinedocs")
-} #
-
-
-
-require(inlinedocs)
-
-
-
-MC.search.path <- function
-### Search if a given file is present along the system PATH
-### Function created after Vladimir Eremeev, who created it after
-### Brian Ripley.
-### <http://finzi.psych.upenn.edu/R/Rhelp02/archive/101078.html> or
-### <http://finzi.psych.upenn.edu/R/Rhelp02/archive/92829.html>
-
-( #
- file.name = "7z.exe",
-### Name of the 7zip command line file.
- s.path = Sys.getenv("PATH"),
-### Value of windwos PATH variable. Default is set to Sys.getenv("PATH")
- p.sep = .Platform$path.sep
-### Platform specific folder separator in pathes. Default set to .Platform$path.sep
-){ #
- s.path <- strsplit(
- x = s.path,
- split = p.sep
- )[[1]]
- #
- tmp <- lapply(
- X = s.path,
- FUN = function(X){
- fp <- file.path(X, file.name)
- #
- file.exists( fp )
- } #
- ) #
- #
- return( any( unlist( tmp ) ) )
-### Returns TRUE if 7zip command line executable was found in along the PATH
-} #
-
-
-
-zipMe <- function
-### ZipMe is an R wrapper for 7zip command line executable. It is
-### used to compress files in ZIP archives format
-
-( #
- file.name,
-### Name of the file to be zipped.
- file.dir,
-### Directory of the file to be zipped.
- zip.name = "7z.exe",
-### Name of the 7zip command line file.
- intern = TRUE,
-### See ?system .
- ignore.stderr = FALSE,
-### See ?system .
- wait = TRUE,
-### See ?system .
- input = NULL,
-### See ?system .
- show.output.on.console = TRUE,
-### See ?system .
- minimized = TRUE,
-### See ?system .
- invisible = TRUE
-### See ?system .
-){ #
- old.dir <- getwd()
- #
- setwd( file.dir )
- #
- z7 <- MC.search.path( file.name = zip.name )
- #
- if( z7 )
- { #
- z7.cmd <- paste(
- sep = "",
- "7z a -tzip -mx=1 ",
- file.name, ".zip ",
- file.name
- ) #
- #
- sys.msg <- system(
- command = z7.cmd,
- intern = intern,
- ignore.stderr = ignore.stderr,
- wait = wait,
- input = input,
- show.output.on.console = show.output.on.console,
- minimized = minimized,
- invisible = invisible
- ) #
- #
- cat( sys.msg )
- }else{
- message("7zip not found. Files were not zipped")
- } #
- #
- setwd( old.dir )
-} #
-
-
-
-pkg.remove.wrapper <- function
-### A wrapper for the function 'remove.packages()' that checks
-### if the package is installed before.
-( #
- pkg.name
-### Name of the package
-){ #
- if( pkg.name %in% as.character( installed.packages()[,1] ) )
- { #
- remove.packages( pkg.name, lib = .Library )
- #
- print(
- paste(
- "Package",
- pkg.name,
- "successfully / probably removed"
- ) #
- ) #
- }else{
- print(
- paste(
- "Package",
- pkg.name,
- "NOT removed because NOT installed"
- ) #
- ) #
- } #
-### Prints a message that state if the package has been removed
-### or if it has not been removed (because not installed).
-} #
-
-
-
-pkg.description <- function(
- pkg.name,
-### Name of the package, and of the package directory
- pkg.dir,
-### Name of the directory in which the package directory is
-### located
- pkg.version,
-### Version of the package, to be written in the DESCRIPTION file
- pkg.depends=NULL
-### Vector of character. Names of the packages that needs to be installed
-### prior to the package installation. NULL if none
-){ #
- # Read the file DESCRIPTION
- desc <- readLines(
- con = file.path(
- pkg.dir,
- pkg.name,
- "DESCRIPTION"
- ) #
- ) #
- #
- # Find where the "Date:" line is
- desc.sel <- substr(
- x = desc,
- start = 1,
- stop = nchar("Date:")
- ) == "Date:"
- #
- # Modify the date
- desc[ desc.sel ] <- paste(
- "Date:",
- Sys.Date()
- ) #
- #
- # Find where the "Date:" line is
- desc.sel <- substr(
- x = desc,
- start = 1,
- stop = nchar("Version:")
- ) == "Version:"
- #
- # Modify the date
- desc[ desc.sel ] <- paste(
- "Version:",
- pkg.version
- ) #
- #
- # Find where the "Depends:" line is
- desc.sel <- substr(
- x = desc,
- start = 1,
- stop = nchar("Depends:")
- ) == "Depends:"
- #
- # Get R version:
- r.ver <- R.Version()
- #
- # Modify the dependancies
- desc[ desc.sel ] <- paste(
- "Depends:",
- " R (>= ",
- r.ver[["major"]], ".", r.ver[["minor"]], ")",
- ifelse(is.null(pkg.depends),"",", "),
- paste( pkg.depends, collapse = ", " ),
- sep = ""
- ) #
- #
- # Write again the description file:
- desc <- writeLines(
- con = file.path(
- pkg.dir,
- pkg.name,
- "DESCRIPTION"
- ), #
- text = desc
- ) #
- #
- # Invisibly returns the text of the description file
- return( invisible( desc ) )
-### The function chnages the description file, and invisibly returns
-### the text of the file.
-} #
-
-
-
-pkg.build.wrapper <- function(
-### A wrapper function for R CMD build, for building a package
-### from sources
-
- pkg.name,
-### Name of the package, and of the package directory
-
- pkg.dir,
-### Name of the directory in which the package directory is
-### located
-
- r.cmd="R CMD build",
-### Command send to windows shell. Default is "R CMD build"
-
- bat.suffix="RCMDbuild",
-### Suffix of the batch (.bat) file create for this operation,
-### without extension
-
- r.cmd.op=""
-### Options to be passed after r.cmd, like "--no-tests"
-
-){ #
- cmd.build <- c(
- "c:",
- "cd \\",
- paste( sep = "", "cd \"", normalizePath( file.path( pkg.dir ) ), "\"" ),
- paste( sep = "", r.cmd, " ", r.cmd.op, " ", pkg.name )
- ) #
- #
- cat( cmd.build )
- #
- bat.build <- file.path(
- pkg.dir,
- paste(
- sep = "",
- pkg.name, "_",
- bat.suffix, ".bat"
- ) #
- ) #
- #
- writeLines(
- text = cmd.build,
- con = bat.build,
- sep = "\n"
- ) #
- #
- # print( as.character( bat.build ) )
- #
- sys.res <- system(
- command = bat.build, #
- intern = TRUE,
- minimized = TRUE,
- invisible = TRUE
- ) #
- #
- file.remove( bat.build )
- #
- return( sys.res )
-### The function returns the system / shell log
-} #
-
-
-
-pkg.install.wrapper <- function
-### A wrapper function for R CMD INSTALL --build, for building
-### a package from sources
-( #
- pkg.name,
-### Name of the package, and of the package directory
- pkg.dir,
-### Name of the directory in which the package directory is
-### located
- r.cmd = "R CMD INSTALL --build",
-### Command send to windows shell. Default is "R CMD INSTALL --build"
- bat.suffix = "RCMDINSTALL"
-### Suffix of the batch (.bat) file create for this operation,
-### without extension
-){ #
- cmd.install <- c(
- "c:",
- "cd \\",
- paste( sep = "", "cd \"", normalizePath( file.path( pkg.dir ) ), "\"" ),
- paste( sep = "", r.cmd, " ", pkg.name )
- ) #
- #
- bat.install <- file.path(
- pkg.dir,
- paste(
- sep = "",
- pkg.name, "_",
- bat.suffix, ".bat"
- ) #
- ) #
- #
- writeLines(
- text = cmd.install,
- con = bat.install,
- sep = "\n"
- ) #
- #
- sys.res <- system(
- command = bat.install, #
- intern = TRUE,
- minimized = TRUE,
- invisible = TRUE
- ) #
- #
- file.remove( bat.install )
- #
- return( sys.res )
-### The function returns the system / shell log
-} #
-
-
-
-pkg.check.wrapper <- function(
-### A wrapper function for R CMD check, for checking a package
-### sources
-
- pkg.name,
-### Name of the package, and of the package directory
-
- pkg.dir,
-### Name of the directory in which the package directory is
-### located
-
- r.cmd="R CMD check",
-### Command send to windows shell. Default is "R CMD check"
-
- r.cmd.op="",
-### Options to be passed after r.cmd, like "--no-tests"
-
- bat.suffix="RCMDcheck"
-### Suffix of the batch (.bat) file create for this operation,
-### without extension
-
-){ #
- cmd.checks <- c(
- "c:",
- "cd \\",
- paste( sep = "", "cd \"", normalizePath( file.path( pkg.dir ) ), "\"" ),
- paste( sep = "", r.cmd, " ", r.cmd.op," ", pkg.name )
- ) #
- #
- cat( cmd.checks )
- #
- bat.checks <- file.path(
- pkg.dir,
- paste(
- sep = "",
- pkg.name, "_",
- bat.suffix, ".bat"
- ) #
- ) #
- #
- writeLines(
- text = cmd.checks,
- con = bat.checks,
- sep = "\n"
- ) #
- #
- sys.res <- system(
- command = bat.checks, #
- intern = TRUE,
- minimized = TRUE,
- invisible = TRUE
- ) #
- #
- file.remove( bat.checks )
- #
- Rcheck.dir <- paste(
- sep = "",
- pkg.name,
- ".Rcheck"
- ) #
- #
- zipMe(
- file.name = Rcheck.dir,
- file.dir = pkg.dir
- ) #
- #
- shell(
- cmd = paste(
- "rmdir /S /Q \"",
- file.path(
- pkg.dir,
- Rcheck.dir
- ), #
- "\"",
- sep = ""
- ), #
- intern = TRUE,
- wait = TRUE
- ) #
- #
- # unlink(
- # x = file.path(
- # pkg.dir,
- # Rcheck.dir
- # ), #
- # recursive = TRUE
- # ) #
- #
- return( sys.res )
-### The function returns the system / shell log
-} #
-
-
-
-
-
-
-install.packages.zip <- function(
- pkg.name,
-### Name of the package, and of the package directory
- pkg.dir,
-### Name of the directory in which the package directory is
-### located
- pkg.version
-### Version of the package, to be written in the DESCRIPTION file
-){ #
- install.packages(
- pkgs = file.path(
- pkg.dir,
- paste(
- pkg.name,
- "_",
- pkg.version,
- ".zip",
- sep = ""
- ) #
- ), #
- repos = NULL
- ) #
-### The function returns nothing
-} #
-
-
-
Deleted: Sweave_wrapper.R
===================================================================
--- Sweave_wrapper.R 2014-01-09 10:12:06 UTC (rev 93)
+++ Sweave_wrapper.R 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,250 +0,0 @@
-texi2dvi.wrapper <- function(# Internal. Wrapper for tools:texi2dvi.
-### This function is a wrapper to tools:texi2dvi that also deletes
-### the images when the pdf file was created
-
- file.name.root,
-### Root of the sweave (and tex) file name (without extention)
-
- work.wd,
-### Path of the working directory
-
- inout.dir,
-### Path of the subdirectory in which the images are outputted
-
- tex.ext = ".tex"
-### Tex file extesion. Any other value than ".tex" may not work
-
-){ #
- old.dir <- getwd()
- #
- setwd( work.wd )
- #
- testfile2 <- paste(
- file.name.root,
- tex.ext,
- sep = ""
- ) #
- #
- msg <- tools::texi2dvi(
- file = testfile2,
- pdf = TRUE,
- clean = TRUE,
- texinputs = work.wd
- ) #
- #
- cat( "\n\n\n" )
- cat( paste( "tools::texi2dvi message ", msg, "\n\n\n" ) )
- #
- ## Clean the inout directory
- if( all( is.null(msg) ) )
- { #
- if( inout.dir != "" )
- { #
- inout.wd <- file.path( work.wd, inout.dir )
- }else{
- inout.wd <- work.wd
- } #
- #
- files.lst <- list.files(
- path = inout.wd,
- full.names = TRUE
- ) #
- #
- files.nbc <- nchar( files.lst )
- #
- files.ext <- substr(
- x = files.lst,
- start = files.nbc - 2,
- stop = files.nbc
- ) #
- #
- file.name.root2 <- file.path( inout.wd, paste( file.name.root, "-", sep = "" ) )
- #
- files.pre <- substr(
- x = files.lst,
- start = 1,
- stop = nchar( file.name.root2 )
- ) #
- #
- sel.del <- (files.ext %in% c("pdf","eps")) &
- (files.pre == file.name.root2 )
- #
- rm.res <- file.remove( files.lst[ sel.del ] )
- #
- cat( "\n\n\n" )
- cat( paste( "Number of images deleted:", sum( rm.res ), "\n" ) )
- cat( paste( "Number of images not deleted:", sum( !rm.res ), "\n\n\n" ) )
- #
- return( TRUE )
- }else{
- cat( "No images deleted. Something went wrong\n\n\n" )
- #
- return( FALSE )
- } #
- #
- setwd( old.dir )
- #
-### The function returns several messages about the Stangle, Sweave,
-### tools::texi2dvi and image deleting processes. It also returns
-### TRUE if the images were deleted, and FALSE if not
-} #
-
-
-
-Sweave.wrapper <- function(# Wrapper around Stangle, Sweave and tools::texi2dvi
-### Sweave.wrapper is a function that performs different
-### operations otherwise done step by step with Stangle, Sweave and
-### tools::texi2dvi, and that do a bit of cleaning in the folder
-### after that (delete images)
-
- file.name.root,
-### Root of the sweave (and tex) file name (without extention)
-
- work.wd,
-### Path of the working directory
-
- inout.dir,
-### Path of the subdirectory in which the images are outputted
-
- sweave.ext = ".Rnw",
-### Sweave file extesion. Any other value than ".Rnw" may not work
-
- tex.ext = ".tex"
-### Tex file extesion. Any other value than ".tex" may not work
-
-){ #
- old.dir <- getwd()
- #
- setwd( work.wd )
- #
- testfile <- paste(
- file.name.root,
- sweave.ext,
- sep = ""
- ) #
- #
- cat( paste( "Ready to process ", testfile, "\n\n\n" ) )
- #
- ## enforce par(ask=FALSE)
- options(device.ask.default=FALSE)
- #
- # Extract the R code from the Sweave file
- Stangle( testfile )
- #
- ## create a LaTeX file
- Sweave( testfile )
- #
- setwd( work.wd )
- #
- res <- texi2dvi.wrapper(
- file.name.root = file.name.root,
- work.wd = work.wd,
- inout.dir = inout.dir,
- tex.ext = tex.ext
- ) #
- #
- setwd( old.dir )
- #
- return( res )
-### The function returns several messages about the Stangle, Sweave,
-### tools::texi2dvi and image deleting processes. It also returns
-### TRUE if the images were deleted, and FALSE if not
-} #
-
-
-
-MC.search.path <- function
-### Search if a given file is present along the system PATH
-### Function created after Vladimir Eremeev, who created it after
-### Brian Ripley.
-### <http://finzi.psych.upenn.edu/R/Rhelp02/archive/101078.html> or
-### <http://finzi.psych.upenn.edu/R/Rhelp02/archive/92829.html>
-
-( #
- file.name = "7z.exe",
-### Name of the 7zip command line file.
- s.path = Sys.getenv("PATH"),
-### Value of windwos PATH variable. Default is set to Sys.getenv("PATH")
- p.sep = .Platform$path.sep
-### Platform specific folder separator in pathes. Default set to .Platform$path.sep
-){ #
- s.path <- strsplit(
- x = s.path,
- split = p.sep
- )[[1]]
- #
- tmp <- lapply(
- X = s.path,
- FUN = function(X){
- fp <- file.path(X, file.name)
- #
- file.exists( fp )
- } #
- ) #
- #
- return( any( unlist( tmp ) ) )
-### Returns TRUE if 7zip command line executable was found in along the PATH
-} #
-
-
-
-zipMe <- function
-### ZipMe is an R wrapper for 7zip command line executable. It is
-### used to compress files in ZIP archives format
-
-( #
- file.name,
-### Name of the file to be zipped.
- file.dir,
-### Directory of the file to be zipped.
- zip.name = "7z.exe",
-### Name of the 7zip command line file.
- intern = TRUE,
-### See ?system .
- ignore.stderr = FALSE,
-### See ?system .
- wait = TRUE,
-### See ?system .
- input = NULL,
-### See ?system .
- show.output.on.console = TRUE,
-### See ?system .
- minimized = TRUE,
-### See ?system .
- invisible = TRUE
-### See ?system .
-){ #
- old.dir <- getwd()
- #
- setwd( file.dir )
- #
- z7 <- MC.search.path( file.name = zip.name )
- #
- if( z7 )
- { #
- z7.cmd <- paste(
- sep = "",
- "7z a -tzip -mx=1 ",
- file.name, ".zip ",
- file.name
- ) #
- #
- sys.msg <- system(
- command = z7.cmd,
- intern = intern,
- ignore.stderr = ignore.stderr,
- wait = wait,
- input = input,
- show.output.on.console = show.output.on.console,
- minimized = minimized,
- invisible = invisible
- ) #
- #
- cat( sys.msg )
- }else{
- message("7zip not found. Files were not zipped")
- } #
- #
- setwd( old.dir )
-} #
-
Added: packageUtilities.R
===================================================================
--- packageUtilities.R (rev 0)
+++ packageUtilities.R 2014-01-09 10:12:27 UTC (rev 94)
@@ -0,0 +1,175 @@
+
+
+
+pkgRemove <- function(# Remove a package
+### A wrapper for the function 'remove.packages()' that checks
+### if the package is installed before.
+
+ pkgName
+### Name of the package
+
+){
+ ip <- installed.packages()
+
+ if( pkgName %in% rownames( ip ) )
+ {
+ LibPath <- ip[ pkgName, "LibPath" ]
+
+ remove.packages( pkgName, lib = LibPath )
+
+ print(
+ paste(
+ "Package",
+ pkgName,
+ "successfully / probably removed"
+ )
+ )
+ }else{
+ print(
+ paste(
+ "Package",
+ pkgName,
+ "NOT removed because NOT installed"
+ )
+ )
+ }
+### Prints a message that state if the package has been removed
+### or if it has not been removed (because not installed).
+} #
+
+
+
+pkgDescription <- function(# Modify a package's DESCRIPTION file
+### Modify a package's DESCRIPTION file
+
+ pkgName,
+### Name of the package, and of the package directory
+
+ pkgDir,
+### Name of the directory in which the package directory is
+### located
+
+ pkgVersion,
+### Single _character_ string. Version of the package, to be written
+### in the DESCRIPTION file
+
+ RVersion=NULL,
+### Single _character_ string. Minimum version of R on which the
+### package works (presumably). Use the style "R (>= 2.2.1)".
+### If set to NULL, the current R version will be used.
+
+ pkgDepends=NULL,
+### Vector of character strings. Names of the packages that needs to be installed
+### prior to the package installation. NULL if none
+
+ pkgSuggests=NULL
+### Vector of character string. Names of the packages that needs
+### to be cited in the "Suggests" field. NULL if none
+
+){
+ # Read the file DESCRIPTION
+ desc <- readLines(
+ con = file.path(
+ pkgDir,
+ pkgName,
+ "DESCRIPTION"
+ ) #
+ ) #
+
+ # Find where the "Date:" line is
+ desc.sel <- substr(
+ x = desc,
+ start = 1,
+ stop = nchar("Date:")
+ ) == "Date:"
+
+ # Modify the date
+ desc[ desc.sel ] <- paste(
+ "Date:",
+ Sys.Date()
+ ) #
+
+ # Find where the "Version:" line is
+ desc.sel <- substr(
+ x = desc,
+ start = 1,
+ stop = nchar("Version:")
+ ) == "Version:"
+
+ # Modify the version
+ desc[ desc.sel ] <- paste(
+ "Version:",
+ pkgVersion
+ ) #
+
+ # Find where the "Depends:" line is
+ desc.sel <- substr(
+ x = desc,
+ start = 1,
+ stop = nchar("Depends:")
+ ) == "Depends:"
+
+ if( is.null( RVersion ) )
+ {
+ # Get R version:
+ RVersion <- R.Version()
+
+ RVersion <- paste(
+ sep = "",
+ "R (>= ",
+ RVersion[["major"]],
+ ".",
+ RVersion[["minor"]],
+ ")"
+ )
+ }
+
+ # Modify the dependancies
+ desc[ desc.sel ] <- paste(
+ "Depends: ",
+ RVersion,
+ ifelse(is.null(pkgDepends),"",", "),
+ paste( pkgDepends, collapse = ", " ),
+ sep = ""
+ )
+
+
+
+ # Find where the "Suggests:" line is
+ desc.sel2 <- substr(
+ x = desc,
+ start = 1,
+ stop = nchar("Suggests:")
+ ) == "Suggests:"
+
+ suggests.txt <- paste(
+ "Suggests: ",
+ paste( pkgSuggests, collapse = ", " ),
+ sep = ""
+ )
+
+ if( any( desc.sel2 ) )
+ {
+ desc[ desc.sel2 ] <- suggests.txt
+ }else{
+ desc <- c(
+ desc,
+ suggests.txt
+ )
+ }
+
+ # Write again the description file:
+ desc <- writeLines(
+ con = file.path(
+ pkgDir,
+ pkgName,
+ "DESCRIPTION"
+ ), #
+ text = desc
+ )
+
+ # Invisibly returns the text of the description file
+ return( invisible( desc ) )
+### The function chnages the description file, and invisibly returns
+### the text of the file.
+} #
Deleted: rcmdwrapper_1.02.zip
===================================================================
(Binary files differ)
Modified: soiltexture_compile.R
===================================================================
--- soiltexture_compile.R 2014-01-09 10:12:06 UTC (rev 93)
+++ soiltexture_compile.R 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,50 +1,44 @@
+
+
rm(list=ls(all=TRUE))
-pkg.dir <- "C:/_R_PACKAGES/soiltexture/pkg"
-# pkg.dir <- "/home/jules/_WORK/R_PACKAGES/soiltexture/pkg"
-pkg.name <- "soiltexture"
-pkg.version <- "1.2.10"
-pkg.depends <- c("sp","MASS")
-pkg.suggests <- c("drc","plotrix","xtable")
-RVersion <- "R (>= 2.4.1)"
-# r.path <- "C:/Program Files/_SCIENCE/R_PROJECT_2-4-1/bin"
-r.path <- "" # Use curent R version
+pkgName <- "soiltexture"
+pkgDir <- file.path( "D:/Users/julienm/Documents/_WORKS/_PROJECTS/r_packages",
+ pkgName, "pkg" )
+library( "inlinedocs" )
-require( "rcmdwrapper" ) # See rcmdwrapper_1.1.zip
+# Source some utility functions
+source( file.path( pkgDir, "..", "packageUtilities.R" ) )
# Change the description file:
-pkg.description(
- pkg.name = pkg.name,
- pkg.dir = pkg.dir,
- pkg.version = pkg.version,
- pkg.depends = pkg.depends,
- pkg.suggests = pkg.suggests,
- RVersion = RVersion
-) #
+pkgDescription(
+ pkgName = pkgName,
+ pkgDir = pkgDir,
+ pkgVersion = "1.2.11",
+ pkgDepends = c("sp","MASS"),
+ pkgSuggests = "xtable", # c("drc","plotrix"),
+ RVersion = NULL
+)
-# Create the package skeleton with inlinedocs
package.skeleton.dx(
- pkgdir = file.path( pkg.dir, pkg.name ),
- namespace = TRUE
+ pkgdir = file.path( pkgDir, pkgName ),
+ namespace = TRUE
) #
-# file.copy(
-# from = file.path( pkg.dir, pkg.name, "inst", "doc", "TT.env.Rd" ),
-# to = file.path( pkg.dir, pkg.name, "man", "TT.env.Rd" ),
-# overwrite = TRUE
-# ) #
file.copy(
- from = file.path( pkg.dir, "..", "prepare", "TT.env.Rd" ),
- to = file.path( pkg.dir, pkg.name, "man", "TT.env.Rd" ),
+ from = file.path( pkgDir, "..", "prepare", "TT.env.Rd" ),
+ to = file.path( pkgDir, pkgName, "man", "TT.env.Rd" ),
overwrite = TRUE
) #
-pkg.remove.wrapper( pkg.name = pkg.name )
+pkgRemove( pkgName = pkgName )
+
+
Modified: soiltexture_transformations_compile.R
===================================================================
--- soiltexture_transformations_compile.R 2014-01-09 10:12:06 UTC (rev 93)
+++ soiltexture_transformations_compile.R 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,45 +1,44 @@
-# Running the latest part of this script (zipMe) requires to have
-# 7zip installed and available on Windows path.
+detach( package:soiltexture )
rm(list=ls(all=TRUE))
-if( tolower(Sys.info()["sysname"]) == "windows" ){
- work.wd <- "C:/_R_PACKAGES/soiltexture/pkg/soiltexture/inst"
- Sweave.wrapper.fun <- "C:/_R_PACKAGES/soiltexture/Sweave_wrapper.R"
-}else{ # Linux
- work.wd <- "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg/soiltexture/inst"
- Sweave.wrapper.fun <- "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/Sweave_wrapper.R"
-} #
-subdir1 <- "doc"
-file.name.root <- "transformations"
-sweave.ext <- ".Rnw"
-inout.dir <- ""
-eval( parse( Sweave.wrapper.fun ) )
+setwd( "D:/Users/julienm/Documents/_WORKS/_PROJECTS/r_packages/soiltexture/pkg/soiltexture/vignettes" )
+Stangle( "transformations.Rnw" )
+Sweave( "transformations.Rnw" )
-res <- Sweave.wrapper(
- file.name.root = file.name.root,
- work.wd = file.path( work.wd, subdir1 ),
- inout.dir = inout.dir
-) #
+for( clean in c(FALSE,FALSE,TRUE) ){
+ msg <- tools::texi2dvi(
+ file = "transformations.tex",
+ pdf = TRUE,
+ clean = clean,
+ texinputs = getwd()
+ )
+
+ # if( !clean ){
+ # detach( package:soiltexture )
+ # }
+}
-file.remove( list.files( file.path( work.wd, subdir1 ), "\\.tex$", full.names = TRUE ) )
-file.remove( list.files( file.path( work.wd, subdir1 ), "\\.bib.bak$", full.names = TRUE ) )
file.remove( list.files( file.path( work.wd, subdir1 ), "\\.R$", full.names = TRUE ) )
-library("tools")
-res <- compactPDF( paths = file.path( work.wd, subdir1 ), gs_quality = "ebook" ) # paste(sep="",file.name.root,".pdf")
-res
+## Copy the vignette's pdf into the 'doc' folder
+file.copy(
+ from = "transformations.pdf",
+ to = "../inst/doc/transformations.pdf",
+ overwrite = TRUE )
+# file.remove( "transformations.pdf" )
-### If LaTeX failed because the pdf file was open, run:
-# res <- texi2dvi.wrapper(
-# file.name.root = file.name.root,
-# work.wd = work.wd,
-# inout.dir = inout.dir
-# ) #
+for( ext in c( "\\.tex$", "\\.bib.bak$", "\\.R$", "\\.aux$",
+ "\\.bbl$", "\\.blg$", "\\.log$", "\\.out$", "\\.toc$", "\\.pdf$" ) ){
+
+ file.remove( list.files( getwd(), ext, full.names = TRUE ) )
+}
+
+
Modified: soiltexture_vignette_compile.R
===================================================================
--- soiltexture_vignette_compile.R 2014-01-09 10:12:06 UTC (rev 93)
+++ soiltexture_vignette_compile.R 2014-01-09 10:12:27 UTC (rev 94)
@@ -1,66 +1,42 @@
-# Running the latest part of this script (zipMe) requires to have
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/soiltexture -r 94
More information about the Soiltexture-commits
mailing list