Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elixir 1.10.3-otp-21
erlang 21.0
elixir 1.14.0-otp-25

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm...not sure if older apps that use bless all can safely use elixir 1.14 🤔 could it not have stayed on 1.10 for these changes?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would we even check? Yikes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed 1.10 was way out of date b/c I didnt have it on my galacticon's asdf listing. Its possible that is still the best version to use though; I didn't spend that much time sussing this out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah what's funny @electricshaman is that this is controlled somewhere in harness or maybe another dependency. I was editing the mix.exs directly and bypassing harness in agora to test my change. I haven't gotten far enough to see where I would bump the version to take advantage of this but this is not a huge advantageous change that would be urgent for consumers to adopt so maybe its OK to bump elixir version a bit? I'm not sure how to reason about it.

Copy link

@electricshaman electricshaman Mar 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnmandal First thing that popped into my head was to search for Elixir 1.9 versions (or lower) either in mix.exs directly or harness.exs across NFIBrokerage and see what that list looks like.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we can check on invoice_emailing_pm that is harnessed on an older harness pm version (cause of wkhtml2pdf) and runs on elixir 1.11

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

harness itself is on elixir 1.11.0-otp-22
erlang 22.3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can yeet an RC for bless with this updated elixir and see if harness complains ¯_(ツ)_/¯

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I am fine with rolling it back to 1.10. The only reason I chose 1.14 was because I didn't want to download another version into my asdf and in hindsight that seems like a poor reason to bump versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, works in harness on 1.11 with RC from this branch. I just have PR that makes sure that we can publish a hex package with RC in the name

erlang 25.0.3
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Mix.Config
import Config

config :chaps,
terminal_options: [
Expand Down
14 changes: 14 additions & 0 deletions lib/bless.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ defmodule Bless do
|> Enum.filter(&available?/1)
end

@option_definitions [seed: :string]
@option_mappings [seed: [:test, :"chaps.html", :"coveralls.html"]]
def combine_args({task, subargs} = _bless_component, archargs) do
{parsed_args, _other_args, _invalid_args} =
OptionParser.parse(archargs, strict: @option_definitions)

parsed_args
|> Enum.filter(fn {switch, _val} ->
task in Keyword.get(@option_mappings, switch)
end)
|> OptionParser.to_argv()
|> Kernel.++(subargs)
end

# chaps-ignore-start
defp available?({:chaps, _args}),
do: Code.ensure_loaded?(Mix.Tasks.Chaps)
Expand Down
19 changes: 16 additions & 3 deletions lib/mix/tasks/bless.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,27 @@ defmodule Mix.Tasks.Bless do
"""

@shortdoc "Runs a testing suite"
def run(_) do
def run(archargs) do
IO.ANSI.format([
:cyan,
:bright,
"Running bless w/ args #{inspect(archargs)}"
])
|> IO.puts()

Mix.Project.config()
|> Keyword.get(:bless_suite, Bless.default())
|> Enum.each(fn {task, args} ->
|> Enum.each(fn {task, _subargs} = bless_component ->
args =
bless_component
|> Bless.combine_args(archargs)

IO.ANSI.format([:cyan, "Running #{task} with args #{inspect(args)}"])
|> IO.puts()

Mix.Task.run(task |> to_string(), args)
task
|> to_string()
|> Mix.Task.run(args)
end)
end
end
Expand Down
6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Bless.MixProject do

@version_file Path.join(__DIR__, ".version")
@external_resource @version_file
@version (case Regex.run(~r/^v([\d\.]+)/, File.read!(@version_file),
@version (case Regex.run(~r/^v([\d\.\w-]+)/, File.read!(@version_file),
capture: :all_but_first
) do
[version] -> version
Expand Down Expand Up @@ -52,8 +52,8 @@ defmodule Bless.MixProject do
# docs
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false, optional: true},
# test
{:chaps, ">= 0.15.0", only: :test, optional: true},
{:credo, ">= 0.0.0", only: :test, runtime: false, optional: true}
{:chaps, ">= 1.0.0", only: :test, optional: true},
{:credo, ">= 1.7.0", only: :test, runtime: false, optional: true}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the most recent. I'm not clear if this could be really painful in consumer applications... If so, may need to lower these to more reasonable versions? I didn't notice any problems in agora, which I tested against this.

]
end

Expand Down
11 changes: 6 additions & 5 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
%{
"bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"},
"chaps": {:hex, :chaps, "0.15.2", "c7819ecb7fc3cec3efce00bf56bd53154e2e7863b2893051b5780dfe229d1055", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_options, "~> 0.3 and >= 0.3.7", [hex: :nimble_options, repo: "hexpm", optional: false]}], "hexpm", "f1111b4d5795bdca5e0374bbdbc3e806a9141b85737cbdc5ba063d6c9874de56"},
"credo": {:hex, :credo, "1.4.0", "92339d4cbadd1e88b5ee43d427b639b68a11071b6f73854e33638e30a0ea11f5", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1fd3b70dce216574ce3c18bdf510b57e7c4c85c2ec9cad4bff854abaf7e58658"},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"chaps": {:hex, :chaps, "1.0.1", "38ab5bff3c3d5949c43a549660b324c0423abc650e3f88917499d1fa5450bcf3", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_options, "~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}], "hexpm", "da5f38874e36d62d0b5b39fb13420bbf881ca883c7a08c497e34a102e53b182b"},
"credo": {:hex, :credo, "1.7.11", "d3e805f7ddf6c9c854fd36f089649d7cf6ba74c42bc3795d587814e3c9847102", [:mix], [{:bunt, "~> 0.2.1 or ~> 1.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "56826b4306843253a66e47ae45e98e7d284ee1f95d53d1612bb483f88a8cf219"},
"earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"},
"ex_doc": {:hex, :ex_doc, "0.22.2", "03a2a58bdd2ba0d83d004507c4ee113b9c521956938298eba16e55cc4aba4a6c", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "cf60e1b3e2efe317095b6bb79651f83a2c1b3edcb4d319c421d7fcda8b3aff26"},
"jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"},
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"},
"nimble_options": {:hex, :nimble_options, "0.3.7", "1e52dd7673d36138b1a5dede183b5d86dff175dc46d104a8e98e396b85b04670", [:mix], [], "hexpm", "2086907e6665c6b6579be54ef5001928df5231f355f71ed258f80a55e9f63633"},
"nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
"nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"},
}
42 changes: 42 additions & 0 deletions test/bless_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,46 @@ defmodule BlessTest do
check |> Atom.to_string() |> String.contains?("coveralls")
end)
end

describe "Bless.combine_args" do
test "parent \"--seed\" argument is passed through to relevant tasks" do
assert ["--seed", _val] =
Bless.combine_args({:test, []}, [
"--seed",
"#{Enum.random(0..5000)}"
])

assert ["--seed", _val] =
Bless.combine_args({:"coveralls.html", []}, [
"--seed",
"#{Enum.random(0..5000)}"
])

assert ["--seed", _val] =
Bless.combine_args({:"chaps.html", []}, [
"--seed",
"#{Enum.random(0..5000)}"
])
end

test "parent \"--seed\" argument is not passed through to unrelated tasks" do
assert [] =
Bless.combine_args({:credo, []}, [
"--seed",
"#{Enum.random(0..5000)}"
])

assert [] =
Bless.combine_args({:"deps.unlock", []}, [
"--seed",
"#{Enum.random(0..5000)}"
])

assert [] =
Bless.combine_args({:compile, []}, [
"--seed",
"#{Enum.random(0..5000)}"
])
end
end
end
Loading