luvit / lit

Toolkit for developing, sharing, and running luvit/lua programs and libraries.
http://lit.luvit.io/
Apache License 2.0
245 stars 58 forks source link

Install package + deps into custom directory #79

Closed sousoux closed 9 years ago

sousoux commented 9 years ago

I am using lit to pull in custom packages (not standard luvit/luvi packages). I need to install (i.e. retrieve from lit server) a base package into a custom directory and then install all its dependencies normally into deps under the install directory.

To do this I am pulling in core, vfs and db with a custom lit init file. I would prefer not to do this.

I would also prefer not to have to set this in a litconfig file since I already have a centralized settings scheme (with command line overrides etc) for the application.

creationix commented 9 years ago

Ok, so you want to use some of the libs inside lit without the conventions and assumptions of lit? I'll see if I can make a standalone lit client library that lets you sync down hashes from an upstream to a local db.

creationix commented 9 years ago

I made progress here. More of the git logic was moved to deps in the lit repo (where they can be consumed as standalone libraries). More refactoring to come.

creationix commented 9 years ago

I've refactored lit's internals a bit. There is no longer an autocore function. The main exports is now a core generator. To use lit's core API, simply pass in a config table. If you leave out the table, it will fallback to autoconfig which contains the old logic from autocore.

local core = require('lit')({
  database = "path/to/custom/database.git"
})

Make sure you're running in a coroutine since this will likely use some coroutine based I/O.

coroutine.wrap(function ()
  local core = require('lit')({
    database = "path/to/custom/database.git"
  })
  p(core)
end)()

Lit does this by requiring the commands from inside a coroutine in main.lua.

creationix commented 9 years ago

I actually have need of an API where I download a package + deps to a custom zip file. I can make sure to organize the code in such a way that writing to a folder is possible too.

sousoux commented 9 years ago

Thanks Tim. I'll look at it this week. I've got diverted by some customer issues again!

sousoux commented 9 years ago

Works perfectly. Thanks.