Suggestion: The README.txt file could include instructions on how to include the Grammar Parser library in a module.

I think all it needs to say is something like this:

Using Grammar Parser in a module
-----------------------------------------------
To use the Grammar Parser library in a module:
1. In your module's .info file:
dependencies[] = libraries
dependencies[] = grammar_parser_lib

2. Before any calls to Grammar Parser library code:
$library = libraries_load($name));
if (empty($library['loaded']) {
    // If this is empty, it's an error and the Grammar Parser has not been installed properly.
}

At least, I think that's right... I'm working on the D7 port of API module right now and that seems to be what I need to do, but I'm not exactly sure. Anyway, some instructions would be helpful to have in the README, I think.

Comments

solotandem’s picture

On the theory that more is better, sure.

There are README files in both the Grammar Parser and the Lib modules that refer to these things, and the latter project includes drush make files. The Libraries documentation page includes the same example code. In order not to duplicate documentation, I would prefer to refer to that page.

I believe it is more proper to only include the grammar_parser_lib as your module dependency as it defines it own dependencies (currently only the libraries dependency).

jhodgdon’s picture

True, regarding dependencies. :)

The reason that I suggested adding that to the README is that I had to open up the grammar_parser_lib.module file to find out what the libraries API name for the module was (I probably could have guessed, but prefer not to leave things to chance). So I thought that should have been in the README.

Oh, I see, I pasted the wrong thing into my issue report. My (hopefully better) suggestion is this:

Using Grammar Parser in a module
-----------------------------------------------
To use the Grammar Parser library in a module:
1. In your module's .info file:
dependencies[] = grammar_parser_lib

2. Before any calls to Grammar Parser library code:
$library = libraries_load('grammar_parser));
if (empty($library['loaded']) {
    // If this is empty, it's an error and the Grammar Parser has not been installed properly.
}

[Edit: the U in Using got cut off, sorry]

jhodgdon’s picture

Oh, and another correction. Although this project is at grammar_parser_lib and the directory is grammar_parser_lib, the file is gplib.module, so you need to do:

dependencies[] = gplib

Hmph.

drupalnesia’s picture

Look like we need Drush Make module also as a dependency one?

jhodgdon’s picture

You do not need to use Drush Make. That is optional.

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Fixed

Added a usage section to the README.txt file.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nancydru’s picture

Status: Closed (fixed) » Active

For those who don't Drush, how about some real instructions, please?

jhodgdon’s picture

Suggested text to add to the Installation part of the README file (right after where it says "To use this module, install it in a modules directory. See http://drupal.org/node/895232 for further information.):

---
To use this module, you will also need to download the Grammar Parser library from http://drupal.org/project/grammar_parser and extract its files in your sites/all/libraries directory (or a site-specific sites/*/libraries directory). You will also need to install the Libraries module (http://drupal.org/project/libraries).
---

I think that would be sufficient. Thoughts?

nancydru’s picture

solotandem’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.