Search code examples
gitpuppetboxen

How can I configure $source_dir to match /Users/${user}/src/${github-owner}/${project}?


I'm new to Boxen and I'm trying to create a project manifest that points the correct path for a given project. I organize my source code in /Users/${user}/src/${github-owner}/${repo} that matches github urls.

Is there a way to do this with boxen?

For example, here's my configuration for a basic static site:

class projects::blog {
  boxen::project { 'blog':
    server_name => 'faun.dev',
    source      => 'faun/blog',
    ruby        => '2.0.0-p353',
    nginx       => "projects/shared/nginx.middleman.conf.erb"
  }
}

When I run boxen, it places the source code in /Users/faun/src/blog, but it really should go in /Users/faun/src/faun/blog. Ideally, I'd like to all projects to work this way, since all projects live under the owner directory.

I've tried modifying $source_dir, but if I override it, I must provide a fully-qualified path. Is there a way to replace $source_dir with some version of ${boxen::config::srcdir}/${github-owner}/${name} globally?


Solution

  • The configuration that I ended up with looks like this:

    class projects::blog {
      boxen::project { 'blog':
        dir         => "${boxen::config::srcdir}/faun/blog",
        server_name => 'faun.dev',
        source      => 'faun/blog',
        ruby        => '2.0.0-p353',
        nginx       => 'projects/shared/nginx.middleman.conf.erb',
      }
    }