Picture of Kevin Jones
Private themes repositories?
by Kevin Jones - Monday, 15 September 2014, 8:58 AM
 

This is probably me not knowing fully how npm systems link repo's but..

I have a theme which has branding in it i'm not sure i can throw onto a public repos. How would i like that into my adapt.json using a private (local) git server? Has anyone done this?

K

Picture of Chris Jones
Re: Private themes repositories?
by Chris Jones - Monday, 15 September 2014, 10:27 AM
 

Hiya Kevin,

Currently all plugins need to be registered in a registry in order to be used, however bower-registry is an open source project and can be hosted as a private instance.

First, take a look at bower/registry there are instructions on setting up a private instance in the README.

Second, once the registry is running on your network, modify the .bowerrc file and add a url to your private instance. .bowerrc can be found in the adapt framework folder.

An example .bowerrc, assuming that your registry app is on http://my-private-bower-server port 8080:

{
    "directory": "src/plugins",
    "registry": {
         "search": [
              "http://adapt-bower-repository.herokuapp.com/",
              "http://my-private-bower-server:8080/"
         ],
         "register": "http://my-private-bower-server:8080/",
         "publish": "http://my-private-bower-server:8080/"
    }
}

Now when you search or install adapt plugins the framework will search in the public repository and also in your custom private repository. 

Running this set up you can publish branded themes as reusable plugins to your private repo and still access all of the community plugins.

 

 

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Monday, 15 September 2014, 1:55 PM
 

Eugh i replied and it was long and then the post failed...

 

Short version :

THANKYOU!  I now :

  • have a private bower server
  • have tested it via 'bower' and its working lovely.

 

New problems (maybe)

  • bower will install the theme to src/plugins not src/theme
  • project expects it in theme folder
  • not sure how to tell it otherwise? (unless i put .bowerrc and bower.json files into theme on there own)
  • i've forgot how to tell my project which theme to use? I did this manually last time.. didn't make a note. DOH!

 

Any help appreciated!

 

Cheers

 

Kev

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Monday, 15 September 2014, 2:00 PM
 

Re-reading your post makes me think that 'adapt' should be also responding to the edits i made to the bowerrc file. But its not.

bower search adapt-nucleus-novo
Search results:

adapt-nucleus-novo http://Kevin.Jones@gitman-server:7990/scm/elf/adapt-nucleus-novo.git

BUT

adapt search adapt-nucleus-novo

no plugins found adapt-nucleus-novo

 

K

Picture of Chris Jones
Re: Private themes repositories?
by Chris Jones - Monday, 15 September 2014, 4:17 PM
 

Hi,

Set the environment variable ADAPT_REGISTRY to the private server URL. After looking through the source, adapt-cli v0.0.10 introduced a change to phase out support for multiple servers in order to simplify the configuration. I'll see if we can reintroduce this feature as a non-breaking change.

Also make sure the theme is marked with the keyword "adapt-theme" in the plugins bower.json, this will make it install to \src\theme, if the keyword is missing it will default to \src\plugins.

 

 Chris

 

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Tuesday, 16 September 2014, 12:26 AM
 

Ah yes, now i remember the variables and you reminded me i had my own branch of the CLI THANKS

Just having a play at modifying my own and this is what i came up with to keep it stable (after i merged with your 0.0.16 version)

https://github.com/KevCJones/adapt-cli/tree/0.0.161

I've not managed to test this yet though, my registry is behind a firewall until i get to work. I might need to tweak the install command code but the principle is simple enough, i've offered a secondary (alternative) REGISTRY in constants.js which will perform a search or install check. 

Registry: process.env.ADAPT_REGISTRY || 'http://adapt-bower-repository.herokuapp.com/',  //A
RegistryAlt: process.env.ADAPT_REGISTRY_ALT || 'http://adapt-bower-repository.herokuapp.com/',  //B

Search - search A and then B unless B==A

Install - try A then try B unless A resolves or A==B

I guess i'm just trying to keep it simple and assme the likely requirement is chances are i'll only have one private registry [?], if i was being flexible i could of added an array of 'alternatives' which it would traverse and perform search and installs... the same way as this.

I didn't see any point in extending the other commands, the use case for alternative repos are not adapts responsibility to create and add content to [only search and install from]? 

What do you recon? Elegant or Hacky ;)

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Tuesday, 16 September 2014, 8:21 AM
 

In fact its a little like  having a primary and secondary DNS when i think about it... the registries are nothing more than sign posting directories.

Testing turned up a few bugs so i'll fix before presenting anything as 'a way'... this is half as much for me to learn the inner workings for the CLI anyway.

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Tuesday, 16 September 2014, 9:56 AM
 

So there we go - fixed. A bit of rejigging, i'm not an expert with the Q library, it did throw me a little for a while.

If you care to have a test

https://github.com/KevCJones/adapt-cli/tree/0.0.162

You can add a new REGISTRY_ALT if you care to, i also reverted the default ADAPT_FRAMWORK back to default and is now something i do in env properly.

Searching and installing works well.

K

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Tuesday, 16 September 2014, 10:21 AM
 

Except when you do adapt install and its going through multple :) gah! its my lack of promises experience. I'm getting my scope wrong. 

Ah well it does half the job for the moment i'll fix the rest later or wait for your official edit.

Picture of Kevin Jones
Re: Private themes repositories?
by Kevin Jones - Tuesday, 16 September 2014, 11:31 AM
 

For you're own amusement, i must of been on crack last night and this morning, out of practice...

Spotted what i think was the old way of pushing the Registry in parameter 1. I've modified the promises file instead for adapt dependencies... so much simpler :)

Hand slapping forhead moment.

adapt install - works

adapt install private-theme - works

adapt search works across both repos

 

 

I can leave it alone now - it was bugging me.. a lot :)

Picture of Chuck Lorenz
Re: Private themes repositories?
by Chuck Lorenz - Tuesday, 16 September 2014, 3:07 PM
 

[Thank you folks for discussing these kinds of issues in the forum rather than by email or phone. It's really helpful to those of us who are trying to get up to speed and make use of the framework.]