How to add a function to the library?

I added a funtion in ex_crypto libaray and I want to use this function in my project. How can i?

Where have you added it in, exactly? In your fork? If so, you can use your fork in your mixfile.

# somewhere in your mix.ex
defp deps() do
  [
     # ...
     # can be something like this
     {:ex_crypto, github: "hoseinisalim/ex_crypto", branch: "my-function"}
     # ...
  ]
end

If you added your function in the original repo, then your update would be available once a new version of it is released on hex.pm

# somewhere in your mix.ex
defp deps() do
  [
     # ...
     # can be something like this (replace <some_new_version> with the actual version)
     {:ex_crypto, "~> <some_new_version>"}
     # ...
  ]
end

or maybe you can point mix to the repo’s master branch to use it now

# somewhere in your mix.ex
defp deps() do
  [
     # ...
     # can be something like this
     {:ex_crypto, github: "ntrepid8/ex_crypto"}
     # ...
  ]
end
4 Likes