#1990 Fanr - More default repositories please!

SlimerDude Sat 4 Aug 2012

I've playing with fanr quite a bit of late (as my recent posts have shown) and I find having just the one default repository quite limiting as I often wish to play with both a local repo and a remote repo. I'm sure it is not uncommon for some people to have more too.

So how about adapting the fanr config to include the following:

repo.myLocal.url       = file:///var/fanr/repo/
repo.myLocal.username	 =
repo.myLocal.password	 =

repo.myRemote.url      = http://far.wotever.com/
repo.myRemote.username = Mr.T
repo.myRemote.password = password

Then from the command line:

fanr -r myRemote publish myAwesomeGame

That way you could specify as many repo aliases as you liked.

(Oh, and I would make the repo names case insensitive too. Case sensitivity is soooooo 90's! It should be abolished, as should the CapsLock key!)

brian Mon 6 Aug 2012

My original idea there was to create a CompoundRepo that would combine multiple repos into one. But that is a sort of a big project that I'd rather not tackle short term.

SlimerDude Mon 6 Aug 2012

create a CompoundRepo that would combine multiple repos into one.

Hmm, sounds like a Nexus or an Artifactory app to me. (And both of those are next to useless!) A little overkill mefinks.

So, how about a short term solution with multiple default repo urls and credentials!? nudge nudge It might even be just good enough to prevent you from writing that CompoundRepo app! :)

brian Mon 6 Aug 2012

So are suggesting more of a way to "alias" repos with their credentials so that you don't have to type out the path for "-r"?

SlimerDude Mon 6 Aug 2012


It saves a whole lot of digging around for URLs to cut and paste. At the same time, default usernames and passwords for that repo could be saved, so they don't have to be typed out every time either!

SlimerDude Mon 6 Aug 2012

Yeah, I could write nix scripts for each, or even my own fantom wrapper around Fanr - but that all seems a little hacky.

SlimerDude Tue 7 Aug 2012

Here's my simple wrapper around Fanr for creating repo aliases in fantom/etc/fanr/config.props such as:

repo.wotever.url      = http://far.wotever.com/
repo.wotever.username = komodo
repo.wotever.password = dragon

use Fanr as normal, but you can substitute a full url with an alias:

fanr publish -r wotever myGame

the code:

class Main {
  private const static Log log := Log.get(Main#.name)

  static Int main(Str[] args) {
//  log.level = LogLevel.debug

    i := args.findIndex |arg| { arg == "-r" }
    if (i != null && args.size > (i+1)) {
      args = args.rw
      newArgs := replaceRepo(args[i+i])
      args.insertAll(i+1, newArgs)
    return fanr::Main().main(args)

  private static Str[] replaceRepo(Str repoName) {
    log.debug("Looking for repo '${repoName}'")

    urlKey := "repo.${repoName}.url"
    usrKey := "repo.${repoName}.username"
    pwdKey := "repo.${repoName}.password"

    Str:Str props := Env.cur.props(fanr::Main#.pod, `config.props`, 1min)

    if (!props.containsKey(urlKey)) {
      log.debug("Repo '${repoName} not specified")
      return [repoName]

    newArgs := [props[urlKey]]

    if (props.containsKey(usrKey)) 

    if (props.containsKey(pwdKey))

    log.debug("Replacing ['${repoName}'] with ${newArgs}")
    return newArgs

brian Fri 24 Aug 2012

Promoted to ticket #1990 and assigned to brian

Add alias to fanr configuration/command set

Login or Signup to reply.