samvera-labs / huborg

Script interactions with repositories within an organization (or organizations).
Apache License 2.0
2 stars 0 forks source link

Enable template string substitution #16

Closed jeremyf closed 3 years ago

jeremyf commented 4 years ago

The Huborg::Client#push_template! should be able to replace strings in the template with mapped values.

I'm envisioning something like this:

client = Huborg::Client.new(
  github_access_token: ENV.fetch("GITHUB_ACCESS_TOKEN"),
  org_names: ENV.fetch("GITHUB_ORG_NAME")
)
client.push_template!(
  template: "/path/to/file/on/your/system",
  filename: "relative/path/in/repository"
) do |pusher|
  pusher.template.gsub!("{{ library }}", pusher.repo.name)
end

I'm not sold on the interface, but am trying to say that we should expose a copy of the template that we are going to push up to the given repository. That copy, we should be able to run string-like commands against.

See https://github.com/samvera/iiif_manifest/pull/51