zcaudate-me / lein-repack

moved -> 'lucid.distribute'
65 stars 5 forks source link

Allow customization of generated project.clj files #3

Closed jeroenvandijk closed 10 years ago

jeroenvandijk commented 10 years ago

I have a (private) project with a high level of nesting of namespaces (E.g. my-company.product-type.functionality).

I have a configuration like this:

:repack {
 :root my-company
 :exclude [] 
 :levels 3}

When I look at the project.clj files in the interim dir after lein repack split I see project definitions with names like:

my-company.product-type.functionality.product-type.functionality.a

I would like to customize this to something like

my-company/product-type.functionality.a

I tried some hacking in project.clj, but I think this is only possible by changing some internals of lein-repack.

zcaudate commented 10 years ago

Hi Jeroen,

You're right. I've actually got the same problem in my day to day job. Let me have a think about this feature and get back to you :)

Chris.

On 7 Jul 2014, at 23:27, Jeroen van Dijk notifications@github.com wrote:

I have a (private) project with a high level of nesting of namespaces (E.g. my-company.product-type.functionality).

I have a configuration like this:

:repack { :root my-company :exclude [] :levels 3} When I look at the project.clj files in the interim dir after lein repack split I see project definitions with names like:

my-company.product-type.functionality.product-type.functionality.a I would like to customize this to something like

my-company/product-type.functionality.a I tried some hacking in project.clj, but I think this is only possible by changing some internals of lein-repack.

— Reply to this email directly or view it on GitHub.

jeroenvandijk commented 10 years ago

Hi Chris,

I had a thought about it as well. I think the main power of lein-repack is to sort out the dependencies of the sub projects and make a first division. Since there a probably other customizations required in other contexts, maybe it makes sense to have an extra configuration option for repack, a function, that can be used to manipulate the sub project.clj edn and will be called just before writing the intermediaries. Does this make sense?

Cheers, Jeroen

zcaudate commented 10 years ago

Hey Jeroen,

I don't think it's too difficult to add in the extra bit of functionality. Though there may be some corner cases that are a little tricky. I'm just a little bit swamped at the moment with other things. Unless i am mistaken, The logic should be isolated to manifest and split.

Would you be able to give a example of what you would want to write under the :repack key in project.clj for your project - and that'll give us an example to work off.

jeroenvandijk commented 10 years ago

Hi Chris,

I've created a pull request to show you what I need. It's not super clean, but it would work for me

zcaudate commented 10 years ago

Thanks mate =)

Will have a play today with these changes

zcaudate commented 10 years ago

hmm... with the current version that I pulled from, it seems like all the files are still in the same directory when I run lein repack split. is this the intended behaviour right now?

zcaudate commented 10 years ago

Sorry! my fault.. I changed something

Can you confirm that I'm getting the same results. So right now the split namespace looks like this: im.chit/hara.b.c.hara.checkers

I'm assuming that it should be : im.chit/hara.checkers

zcaudate commented 10 years ago

Okay I've push v0.1.4 to clojars. please have a look at the :repack settings for hara. and the generated output

jeroenvandijk commented 10 years ago

I had to change my :repack configuration to:

  :repack {:root a.b.c.hara
           :exclude []
           :levels 1
           :name-fn (fn [name package] (str name "." (last (clojure.string/split package #"\."))))}

When I set :levels to 2 I get dependencies of branches that are not there with the above code. So it is a bit tricky. For one level it seems to work fine.

zcaudate commented 10 years ago

have a look at the new version on clojars (0.1.4) it turned out to be quite an easy fix =)

jeroenvandijk commented 9 years ago

Yeah it work for me too. Thanks!