hadley/devtools — pull request #280 by wch (2013-04-05 17:37:21+00:00)
Title: Call .onAttach and .onLoad with lib path and package name

Fixes #279. It calls `.onAttach` and `.onLoad` with the lib path and package name. It also issues a warning if the package dir doesn't match the package name. For example, I copied over the testLoadHooks test package to testLoadHooks2 (but didn't change the package name in DESCRIPTION), and here's what it does:

```
> load_all('inst/tests/testLoadHooks/', reset=TRUE)
Loading devtools
Loading testLoadHooks

> load_all('inst/tests/testLoadHooks2/', reset=TRUE)
Loading devtools
Loading testLoadHooks
Warning messages:
1: In run_onload(pkg) :
Calling .onLoad() when the package directory "testLoadHooks2" does not match the package name "testLoadHooks" can result in problems. Please rename the directory to match the package name.
2: In run_onattach(pkg) :
Calling .onAttach() when the package directory "testLoadHooks2" does not match the package name "testLoadHooks" can result in problems. Please rename the directory to match the package name.
```