Skip to content
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

Context cleaning - Better specs - Better speration of concerns - Pom generation #12

Merged
merged 45 commits into from
Nov 11, 2019

Conversation

JeremS
Copy link
Collaborator

@JeremS JeremS commented Nov 1, 2019

Hey Jérémie,

I changed some things that I found I had not done as well as I could and that go along with the conversation we're having here.

Context cleaning

Right now metav, automatically adds to the execution context default values for every operations inside the metav.api/make-context function. It's a shortcut I had taken that doesn't satisfy me. If we want to keep the different aspects of metav separated, having spit or release default values in the context when we just want to do:

(into (sorted-map) (api/display))
=>
{:metav/artefact-name "metav",
 ;; ...
 :metav/tag "v1.6.1-0x882f6.DIRTY",
 :metav/version #object[metav.domain.version.semver.SemVer 0x2acd69d6 "1.6.1-0x882f6.DIRTY"],
 :metav.display/output-format :tab,
;; ...
 :metav.release/level :patch,
;;...
 :metav.spit/formats #{:edn},
;; ...
}

is not ideal.

The changes I am proposing take care of that by putting the responsibility of merging default values on the operations themselves.

This way metav.api/make-context adds to its options only the keys it cares about.

More specs

I created specs to verify that a context is well formed. It's used in the operations themselves. With these changes, operations will check that the context passed to them not only satisfies specs specific to their own options but also satisfies a common context spec.

Also I revised the way the context validation is made in the operations. Right now spec/assert is used and isn't turned on by default. However the way these assertions are used in metav feel mandatory to me. I changed these assertions to use a check function mimicking spec's assert but being always turned on.

Separation of concerns

Also with idea of metav doing 3 main things, versionning, spitting metadata and git synchronization I have tried to separate each of of these concerns in the code into function that compose cleanly. There still are the 3 operations display, spit! and release! but in the case of release the code has been rework to be a succession of more mono-purpose functions. The parts that now constitute the release function have been pulled into the api.

Pom.xml generation

I have added the option to generate a pom.xml file based on what is already available from clojure.tools.deps. It actually uses the sync-pom function from tools deps then goes to the generated/updated pom and adds the group-id, artefact-name and version based on what metav already establishes.

I'd like to know what you think of these changes.

Cheers,

Jeremy.

JeremS added 30 commits November 1, 2019 15:50
This way the api has a way to generate a context based on git state and have a bumped context in one place.
Before this commit, the api would merge default values for every operation in the `metav.api/make-context`. In an effort to separate the context generation based on git state from the different operations metav implements, the merging of default values for each operation is done in the operations themselves.
The way metav operations worked before was expecting the base context to be well formed and verify only the specific option for the given operation. Now each operation also checks keys of the base context using the new specs defined in `metav.domain.context`.
- We no longer use a global spec to check the options used in the cli since each operation checks what concerns it.
- Added error handling using the checks in the CLI by catching exception and using exception msg as CLI exit msg.
- Added a test verifying the proper handling of an error while reading a config file.
It makes for a more readable context.
Following the idea of « de-complecting » the different parts of metav.
Since the release operation as been exploded internaly into sub-operations, it made sense to move the default tag signing behaviour into `metav.domain.git-operations` and rename the config key :metav.release/without-sign to :metav.git/without-sign.
JeremS added 15 commits November 8, 2019 15:32
More coherent using check instead of assert since the check is mandatory.
…ration.

- Also added some docs to the `metav.domain.context` functions
- changed the « dummy-deps.edn » to be readable by the tools.deps reader.
- changing the « dummy-deps.edn » file warranted a change in the tests in how this file is copied into the generated test repos.
- removed the `metav.domain/check-committed?` from the `:metav.domain.git-operations/tag-repo!-param` spec and put the check directly inside
  the function `metav.domain.git-operations/tag-repo!`. Having the check in the spec created a bug.
@JeremS JeremS changed the title Context cleaning & more specs Context cleaning - Better specs - Better speration of concerns - Pom generation Nov 10, 2019
@jgrodziski jgrodziski merged commit e0bfe47 into jgrodziski:master Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants