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

Future of haxelib #217

Open
ibilon opened this issue Jun 7, 2015 · 7 comments
Open

Future of haxelib #217

ibilon opened this issue Jun 7, 2015 · 7 comments

Comments

@ibilon
Copy link
Member

ibilon commented Jun 7, 2015

Hi,

In the spirit of moving haxelib forward I think what it really needs is a good API,

it would make a very clean separation of logic and cli, and would allow tools to be easily compiled against it instead of running a haxelib process.

I propose this: https://gist.github.com/ibilon/74e5d8ed46cc25b95056 (only a draft ofc, need to see in practice if it works)
there's only the current features of haxelib but before moving most code around we should consider what would be the roadmap of future features
there's also a haxe-pseudocode example (draft too, didn't try to compile obviously) of how the api would be used to make the current commands.

thoughts?

@ibilon ibilon changed the title Futur of haxelib Future of haxelib Jun 7, 2015
@larsiusprime
Copy link

👍

@ncannasse
Copy link
Member

FYI haxelib client has been built on a haxe remoting API since the very first version of it, you can have a look at the API here :
https://github.com/HaxeFoundation/haxelib/blob/master/src/tools/haxelib/SiteApi.hx

@ibilon
Copy link
Member Author

ibilon commented Jun 8, 2015

Thanks,
I updated my suggestion with it, and move those into Server instead of HaxelibProvider, which makes more sense.

Also most data structure from here https://github.com/HaxeFoundation/haxelib/blob/master/src/tools/haxelib/Data.hx could stay the same, no need to change everything.

@ibilon
Copy link
Member Author

ibilon commented Jul 8, 2015

https://github.com/openfl/hxpm/tree/haxelib/

It's a prototype of the API I linked in my first message, it has a cli completely decoupled from the logic code, it's multilingual and can easily be linked against/used by a third party tool.

It's not finished though, it's lacking the extraction of the downloaded zip, the code for upgrade and the submit, hg and git commands.

But it should be enough to give an idea about what kind of thing I'm talking about.

@nadako
Copy link
Member

nadako commented Dec 10, 2015

This looks like a great start! I'm thinking about finally refactoring haxelib (clean up the mess, separate haxelib functions from the ui, etc) and looks like you've already done a huge part. I'll look deeply in your code and comment further.

@ibilon
Copy link
Member Author

ibilon commented Dec 10, 2015

Cool thanks.

There's a couple of things that didn't quite work the way I envisioned,
the implicit save with setter actually make things confusing and more complex,
the use of a provider to tell if it can use the uri was made to limit coupling but in the end there's still the need to list them all.

The use of exception did work like I expected and I think it's better than null values (exception now vs null pointer error later) but it does make verbose code.

Also something I didn't look at the time, but may be worth thing about, is to separate getting informations/displaying them from the validation/call to haxelib for the ui. To limit duplicated code between a cli and a gui mode (which I think would be a good addition).

@nadako
Copy link
Member

nadako commented Dec 10, 2015

the implicit save with setter actually make things confusing and more complex,

Yup, I agree, a setter that writes to filesystem is really bad practice IMO :)

the use of a provider to tell if it can use the uri was made to limit coupling but in the end there's still the need to list them all.

I think the provider system is still good, it allows us to add new types of haxelib sources easily. We should look into implementing something like this (related issue #238).

The use of exception did work like I expected and I think it's better than null values (exception now vs null pointer error later) but it does make verbose code.

That's for sure. No more Error: (+) pls! :)


Anyway, I decided to start in a separate branch with extracting a class that represents installed libraries and allows to install/uninstall/set current/set dev, but has no knowledge of anything else (so no network, ui or config files) and I think it's going good!

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

No branches or pull requests

4 participants