fstpackage / synthetic
1
#  syntheticbench - R package for benchmarking of dataset serialization
2
#
3
#  Copyright (C) 2019-present, Mark AJ Klik
4
#
5
#  This file is part of the lazyvec R package.
6
#
7
#  The lazyvec R package is free software: you can redistribute it and/or modify it
8
#  under the terms of the GNU Affero General Public License version 3 as
9
#  published by the Free Software Foundation.
10
#
11
#  The lazyvec R package is distributed in the hope that it will be useful, but
12
#  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
#  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
14
#  for more details.
15
#
16
#  You should have received a copy of the GNU Affero General Public License along
17
#  with the lazyvec R package. If not, see <http://www.gnu.org/licenses/>.
18
#
19
#  You can contact the author at:
20
#  - syntheticbench R package source repository : https://github.com/fstpackage/syntheticbench
21

22

23
.onAttach <- function(libname, pkgname) {
24

25
  # executed when attached to search() path such as by library() or require()
26 2
  if (!interactive()) return()
27

28 0
  v <- packageVersion("syntheticbench")
29 0
  d <- read.dcf(system.file("DESCRIPTION", package = "syntheticbench"), fields = c("Packaged", "Built"))
30

31 0
  if (is.na(d[1])) {
32 0
    if (is.na(d[2])) {
33 0
      return() # neither field exists
34
    } else {
35 0
      d <- unlist(strsplit(d[2], split = "; "))[3]
36
    }
37
  } else {
38 0
    d <- d[1]
39
  }
40

41
  # version number odd => dev
42 0
  dev <- as.integer(v[1, 3]) %% 2 == 1
43

44 0
  packageStartupMessage("syntheticbench package v", v, if (dev) paste0(" IN DEVELOPMENT built ", d))
45

46
  # check for old version
47 0
  if (dev && (Sys.Date() - as.Date(d)) > 28)
48 0
    packageStartupMessage("\n!!! This development version of the package is rather old, please update !!!")
49
}

Read our documentation on viewing source code .

Loading