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

Update version in README #20

Closed
sheerlox opened this issue Nov 21, 2023 Discussed in #17 · 4 comments · Fixed by #22
Closed

Update version in README #20

sheerlox opened this issue Nov 21, 2023 Discussed in #17 · 4 comments · Fixed by #22
Labels
enhancement New feature or request released on @next

Comments

@sheerlox
Copy link
Member

sheerlox commented Nov 21, 2023

Discussed in #17

Originally posted by sheerlox November 20, 2023

Description

As proposed by @Eiji7 in its response to the Elixir Forum announcement, automatically updating the version number in the project's README during release is a must, because projects need to specify the dependency tuple to add to mix.exs in their "Installation" section.

Feature specification

Step: prepare

Requirements

  • Support the various dependencies specification format (regular / git tag)
  • Support the various version requirements operators

Behavior

  • Does not update complex version requirements (and or or)
  • Replaces MAJOR.MINOR with MAJOR.MINOR.PATCH

Depends on

  • Ability to parse the project's app field from mix.exs

Resources

Elixir atoms format

Source: hexdocs.pm/elixir/Atom

Atoms must be composed of Unicode characters such as letters, numbers, underscore, and @.

The doc also mentions:

If the keyword has a character that does not belong to the category above, such as spaces, you can wrap it in quotes:

:"this is an atom with spaces"
:"this is an atom with spaces"

But I don't think this is relevant, as this is probably not good practice, at least in a library's name.

Mix deps format

Source: hexdocs.pm/mix/Mix.Tasks.Deps

Dependencies must be specified in the mix.exs file in one of the following formats:

{app, requirement}
{app, opts}
{app, requirement, opts}

Where:

  • app is an atom
  • requirement is a Version requirement or a regular expression
  • opts is a keyword list of options

Version Requirements

Source: hexdocs.pm/elixir/Version

Requirements allow you to specify which versions of a given dependency you are willing to work against. Requirements support the common comparison operators such as >, >=, <, <=, ==, != that work as one would expect, and additionally the special operator ~> described in detail further below.

Requirements also support and and or for complex conditions.

The requirement operand after the ~> is allowed to omit the patch version, allowing us to express ~> 2.1 or ~> 2.1-dev, something that wouldn't be allowed when using the common comparison operators.

Example READMEs

@sheerlox sheerlox added the enhancement New feature or request label Nov 21, 2023
@sheerlox sheerlox changed the title [DRAFT] Update version in README Update version in README Nov 21, 2023
@Eiji7
Copy link

Eiji7 commented Nov 21, 2023

While Installation is auto-generated part of README and therefore the most common I think that there may be more things to cover, for example usage within Elixir's script file:

# normal call
Mix.install([:my_lib])

# without optional parentheses
Mix.install [:my_lib]

# using a sigil
Mix.install ~w[my_lib]a

By default mix takes the latest version, but it's also possible to select specific one …

# tuple notation
Mix.install [{my_lib, "~> 1.0"}]

# shorter keyword notation
Mix.install my_lib: "~> 1.0"

Note: In Elixir a Keyword notation is allowed at the end of List, as a last function/macro call argument or as a nth argument as long as it's wrapped in square brackets.

For more information please take a look at Mix.install/2 documentation and Keywords section in Elixir's syntax reference documentation.

@sheerlox
Copy link
Member Author

Let's track this here: #21

@sheerlox
Copy link
Member Author

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sheerlox
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released on @next
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants