Skip to content

Commit

Permalink
Merge pull request #94 from syberia/replace_project_active_binding
Browse files Browse the repository at this point in the history
Replace project active binding
  • Loading branch information
robertzk committed Jan 1, 2016
2 parents 8b25c03 + 9d2c72c commit 2e0ffcb
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: syberia
Type: Package
Title: Syberia
Version: 0.6.1
Version: 0.6.1.9000
Description: Syberia is a meta-framework for R that allows for on-the-fly
creation of concrete frameworks for constructing arbitrary software.
In its current formulation, the modeling engine provides an opiniated
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ S3method(should_exclude,syberia_engine)
export("%||%")
export(active_project)
export(build_engine)
export(project)
export(resource)
export(should_exclude)
export(syberia_engine)
export(syberia_project)
Expand Down
12 changes: 0 additions & 12 deletions R/engine.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,6 @@ active_project <- function() {
.syberia_env$active_project
}

#' @rdname active_project
#' @name project
#' @export
makeActiveBinding("project", function() active_project(), env = environment())

#' Compile a resource in the active syberia project.
#'
#' @seealso \code{\link{active_project}}
#' @name resource
#' @export
makeActiveBinding("resource", function() active_project()$resource, env = environment())

syberia_engine_ <- function(filepath, ...) {
UseMethod("syberia_engine_", filepath)
}
Expand Down
10 changes: 10 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
}
library(bettertrace)
}

makeActiveBinding("project", env = globalenv(),
function() getFromNamespace("active_project", "syberia")())
makeActiveBinding("resource", env = globalenv(),
function() getFromNamespace("active_project", "syberia")()$resource)

# We want to initialize a Syberia project in the current working directory
# because 9 times out of 10 this is what the user wants.
Expand All @@ -34,7 +39,12 @@
}

.onDetach <- function(...) {
try(silent = TRUE, detach("syberia:shims"))
# TODO: (RK) Detach any environments attached to the search path
# by the active project.
}

.onUnload <- function(...) {
try(silent = TRUE, detach("syberia:shims"))
}

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ in conjunction with Syberia modeling projects include
[testthatsomemore](https://github.com/robertzk/testthatsomemore), and
[treeskeleton](https://github.com/robertzk/treeskeleton).

### Development

To run the tests for the Syberia package, you will have to check
out its git submodules.

```
git submodule update --init --recursive
```

This will pull in `inst/engines/base.sy` from the [base engine](http://github.com/syberia/base.sy).

### License

This project is licensed under the MIT License:
Expand Down
1 change: 0 additions & 1 deletion man/active_project.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
% Please edit documentation in R/engine.R
\name{active_project}
\alias{active_project}
\alias{project}
\title{The current active Syberia project.}
\usage{
active_project()
Expand Down
12 changes: 0 additions & 12 deletions man/resource.Rd

This file was deleted.

0 comments on commit 2e0ffcb

Please sign in to comment.