diff --git a/DESCRIPTION b/DESCRIPTION index 6823edf..a3aafe6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,16 +1,21 @@ Package: wand Type: Package Title: Retrieve 'Magic' Attributes from Files and Directories -Version: 0.2.0 -Date: 2016-08-14 -Author: Bob Rudis (@hrbrmstr), Christos Zoulas [libmagic], Mans Rullgard [file], - Jonathan Ong [mime-db] +Version: 0.2.1 +Date: 2017-10-20 +Authors@R: c( + person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre"), + comment = c(ORCID = "0000-0001-5670-2640")), + person("Christos", "Zoulas", role=("ctb"), comment="libmagic"), + person("Mans", "Rullgard", role=("ctb"), comment="file"), + person("Jonathan", "Ong", role=("ctb"), comment="mime-db") + ) Maintainer: Bob Rudis Description: The 'libmagic' library provides functions to determine 'MIME' type and other metadata from files through their "magic" attributes. This is useful when you do not wish to rely solely on the honesty of a user or the extension on a file name. It also - incorporates other metadata from the mime-db database + incorporates other metadata from the 'mime-db' database . URL: http://github.com/hrbrmstr/wand BugReports: https://github.com/hrbrmstr/wand/issues @@ -34,4 +39,4 @@ Imports: Rcpp Encoding: UTF-8 LinkingTo: Rcpp -RoxygenNote: 5.0.1 +RoxygenNote: 6.0.1.9000 diff --git a/NAMESPACE b/NAMESPACE index 9b9542c..c01e076 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,4 +13,4 @@ importFrom(dplyr,mutate) importFrom(dplyr,mutate_all) importFrom(rappdirs,user_cache_dir) importFrom(utils,unzip) -useDynLib(wand) +useDynLib(wand, .registration=TRUE) diff --git a/R/RcppExports.R b/R/RcppExports.R index 9676da9..96faac7 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,11 +1,11 @@ -# This file was generated by Rcpp::compileAttributes +# Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 incant_ <- function(path, magic_db = "system") { - .Call('wand_incant_', PACKAGE = 'wand', path, magic_db) + .Call(`_wand_incant_`, path, magic_db) } lib_version <- function() { - .Call('wand_lib_version', PACKAGE = 'wand') + .Call(`_wand_lib_version`) } diff --git a/R/aaa.r b/R/aaa.r index 3ac56ed..cbd2465 100644 --- a/R/aaa.r +++ b/R/aaa.r @@ -1 +1 @@ -extensions <- mime_type <- response <- encoding <- NULL \ No newline at end of file +globalVariables(c("extensions", "mime_type", "response", "encoding")) diff --git a/R/wand-package.R b/R/wand-package.R index ce90ab8..882e1a5 100644 --- a/R/wand-package.R +++ b/R/wand-package.R @@ -16,7 +16,7 @@ #' @import tidyr #' @import stringi #' @importFrom rappdirs user_cache_dir -#' @useDynLib wand +#' @useDynLib wand, .registration=TRUE #' @importFrom Rcpp sourceCpp #' @importFrom utils unzip #' @importFrom dplyr mutate left_join mutate_all diff --git a/man/get_os.Rd b/man/get_os.Rd index bec2d3e..25f0615 100644 --- a/man/get_os.Rd +++ b/man/get_os.Rd @@ -9,4 +9,3 @@ get_os() \description{ ripped from rappdirs (ty Hadley!) } - diff --git a/man/incant.Rd b/man/incant.Rd index 9d7d6ae..d686906 100644 --- a/man/incant.Rd +++ b/man/incant.Rd @@ -39,4 +39,3 @@ system.file("extdata/img", package="wand") \%>\% See \url{http://openpreservation.org/blog/2012/08/09/magic-editing-and-creation-primer/} for information on how to create your own \code{magic} database } - diff --git a/man/magic_wand_file.Rd b/man/magic_wand_file.Rd index 158a011..e5305ad 100644 --- a/man/magic_wand_file.Rd +++ b/man/magic_wand_file.Rd @@ -33,4 +33,3 @@ system.file("extdata/img", package="wand") \%>\% incant(magic_wand_file()) \%>\% glimpse() } - diff --git a/man/mime_db.Rd b/man/mime_db.Rd index 7dc34ed..65f4d21 100644 --- a/man/mime_db.Rd +++ b/man/mime_db.Rd @@ -37,4 +37,3 @@ Last updated 2016-08-14; the only guaranteed field is \code{source} Ingested from \url{https://github.com/jshttp/mime-db}. } \keyword{datasets} - diff --git a/man/wand.Rd b/man/wand.Rd index 3ddadfd..29003a4 100644 --- a/man/wand.Rd +++ b/man/wand.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/wand-package.r +% Please edit documentation in R/wand-package.R \docType{package} \name{wand} \alias{wand} @@ -18,4 +18,3 @@ Based on \code{file} / \code{libmagic} - \url{https://github.com/file/file} \author{ Bob Rudis (@hrbrmstr) } - diff --git a/src/Makevars b/src/Makevars new file mode 100644 index 0000000..ca60114 --- /dev/null +++ b/src/Makevars @@ -0,0 +1,2 @@ +PKG_CPPFLAGS= -L/usr/include -L/usr/local/include +PKG_LIBS= -L/usr/local/lib -L/usr/lib -lmagic diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index 5d456d0..6660b2d 100755 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -1,4 +1,4 @@ -// This file was generated by Rcpp::compileAttributes +// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include @@ -7,23 +7,34 @@ using namespace Rcpp; // incant_ DataFrame incant_(CharacterVector path, std::string magic_db); -RcppExport SEXP wand_incant_(SEXP pathSEXP, SEXP magic_dbSEXP) { +RcppExport SEXP _wand_incant_(SEXP pathSEXP, SEXP magic_dbSEXP) { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< CharacterVector >::type path(pathSEXP); Rcpp::traits::input_parameter< std::string >::type magic_db(magic_dbSEXP); - __result = Rcpp::wrap(incant_(path, magic_db)); - return __result; + rcpp_result_gen = Rcpp::wrap(incant_(path, magic_db)); + return rcpp_result_gen; END_RCPP } // lib_version int lib_version(); -RcppExport SEXP wand_lib_version() { +RcppExport SEXP _wand_lib_version() { BEGIN_RCPP - Rcpp::RObject __result; - Rcpp::RNGScope __rngScope; - __result = Rcpp::wrap(lib_version()); - return __result; + Rcpp::RObject rcpp_result_gen; + Rcpp::RNGScope rcpp_rngScope_gen; + rcpp_result_gen = Rcpp::wrap(lib_version()); + return rcpp_result_gen; END_RCPP } + +static const R_CallMethodDef CallEntries[] = { + {"_wand_incant_", (DL_FUNC) &_wand_incant_, 2}, + {"_wand_lib_version", (DL_FUNC) &_wand_lib_version, 0}, + {NULL, NULL, 0} +}; + +RcppExport void R_init_wand(DllInfo *dll) { + R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); + R_useDynamicSymbols(dll, FALSE); +} diff --git a/tests/testthat/test-wand.R b/tests/testthat/test-wand.R index c3dc1fd..d21dcf6 100644 --- a/tests/testthat/test-wand.R +++ b/tests/testthat/test-wand.R @@ -1,5 +1,5 @@ -context("basic functionality") -test_that("we can do something", { +context("wand can correctly test files") +test_that("a sample image file is identified correctly", { tmp <- incant(list.files(system.file("extdata", "img", package="wand"), full.names=TRUE),