Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice before pull request [gremlin] #68

Open
ghost opened this issue Jul 18, 2013 · 6 comments
Open

Advice before pull request [gremlin] #68

ghost opened this issue Jul 18, 2013 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 18, 2013

I'm hoping to use big on a new project i'm working on which is going to be backed by OrientDB - so i'll be slowly building resources to support connections etc.

The first one i've had a crack at is adding a gremlin resource, which i've managed to do (available here: https://github.com/nzdonjohnson/resources).

If you'd like to play around you'll need to:

npm install
install OrientDB graph edition
run orientDB server
copy applicable jars from orientdb lib directory to gremlin/node_modules/gremlin/lib
hopefully thats *all

I have some concerns about dependencies, and how deep into these we go to pull them into resources.

For example - i'm using https://github.com/entrendipity/gremlin-node which requires node-java (https://github.com/nearinfinity/node-java). Forget about maven, as that's just used for pulling in jars which isn't really required for production use.

So, should I be creating a resource for node-java? Or is pulling it in as is ok? I'm leaning towards making a resource for it, but i'm really not sure the value my resource would add - apart from resourcing the dependency.

Additionally node-java requires python 2.x be installed on the host, which possibly isn't applicable at the resourcing level, but is something to bear in mind for deployment.

So - thoughts from the creators?

Just to be clear:

I've created a gremlin resource which resources gremlin-node.

Gremlin-node requires node-java

If I resource node-java i'll need to hack how gremlin-node pulls in node-java, as all calls to it are through gremlin node.

Apologies if this is confusing, it's late. Thanks for the advice.

@ahdinosaur
Copy link

alternatively, if all you need is somewhere to handle extra dependencies and initialization stuff, you can make a gremlin.init resource method that will be automatically called upon resource.use('gremlin'). (https://github.com/bigcompany/resource/blob/master/lib/use.js#L69)

i tried to run your code but had an error with npm install gremlin related to installing java. will give it another try later.

it would be best if the resource dependencies were handled by the resource, such as installing gremlin-node, node-java, and necessary jars, but requiring python, java, and a running orientdb to already be installed is fine by me.

@ghost
Copy link
Author

ghost commented Jul 19, 2013

Thanks - yea, the init method is possibly a good replacement for my connect method.

I think i'll give lazy-loading gremlin-node and node-java a go, I should be able to sort that out. I'll have a think about the Jars, the issue with that is gremlin-node comes bundled with some, and you need to delete the versions other than the one you want to use for your DB.

This resource should provide support for any tinkerpop blueprints supported db (https://github.com/tinkerpop/blueprints/wiki) so the jars are contextually dependent.

@ahdinosaur
Copy link

.connect is probably better to be renamed to .start, as .init is meant for internal resource initialization and .start is meant for starting a service, opening a connection, etc.

yeah, resource should handle installing any npm dependencies in gremlin.dependencies upon the first gremlin method being called, as you probably already know.

for the jars, if it's not easy or possible, sufficient documentation on what to do if you want to use the resource works too, although still might be possible by using config resource (allows you to put resource config information in a json file) and intelligently using the config information in .init/.start

@ghost
Copy link
Author

ghost commented Jul 19, 2013

Thanks - good point, i'll convert it over to .start. I'll add better documentation to the resource as well. Are there any examples of detailed docs on resources?

I'd like to avoid writing a readme which gets over-written by the docs resource.

@Marak
Copy link
Member

Marak commented Jul 19, 2013

@nzdonjohnson - You should be able to create a /docs folder inside the resource. Any Markdown files in this directory should be merged in with the main README.md file for the resource.

See: https://github.com/bigcompany/resources/tree/master/account/docs

@ghost
Copy link
Author

ghost commented Jul 20, 2013

Thanks @Marak.

I've refactored to use init and start methods, and added a readme under docs/ folder. also added util for decoding stacktraces from java for applicable exceptions.

Anything i'm missing before launching a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants