-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support overriding pom.xml version via :exec-args and cli #21
base: master
Are you sure you want to change the base?
Conversation
We rename the deploy multi-method to deploy* and consequently there is a chance this may break any users who were extending this multimethod, so we can wrap this with a new deploy function. Also renames :clojars key to :remote to indicate the mechanism for repositories is more generic than just clojars.
coordinates (coordinates-from-pom pom) | ||
versioned-pom (spit (versioned-pom-filename coordinates) pom)] | ||
|
||
(defn- tag-val-replacer [tag->val] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to prefer creating fns which take the required amount of args, and then rather bind the args using partial
(to which I'm, ehrm, partial) or with an anon-fn #(replace-tag {version-tag [version] group-id-tag [group-id] ...} %)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Cool. I'm quite partial to doing things that way too ;-) it was even my first instinct, which I held back on because I figured it'd be bikeshedded the other way. Happy to change.
(defn- tag-val-replacer [tag->val] | ||
(fn [{:keys [tag content attrs] :as el}] | ||
(let [replacement-val (tag->val tag ::default)] | ||
(if (= ::default replacement-val) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great use-case for cond->
:
(cond-> el
(not= ::default replacement-val) (assoc :content replacement-val))
It's almost like this is an update
right?
(update el :content (fn [c] (if (= ::default replacement-val) c replacement-val)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it is. Will revise both of those. Thanks for caring.
versioned-pom (spit (versioned-pom-filename coordinates) pom)] | ||
|
||
(defn- tag-val-replacer [tag->val] | ||
(fn [{:keys [tag content attrs] :as el}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attrs
is not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comments, I'm mostly concerned with making the higher-order tag-val-replacer
into a normal fn.
FYI I'm less sure about this PR belonging in I'll see if we can put this somewhere. |
Implements #20
Extends PR #18 to support overriding a version number in a pom.xml. This allows CI systems etc to easily deploy an artifact with a generated build number, or for a version override to be supplied via the CLI when using
:exec-fn