Skip to content

Releases: wyhaines/defined.cr

Fix Environment Variable Checks

09 Jun 23:51
Compare
Choose a tag to compare

Some ill-conceived specs led to a false sense of security about the correct implementation of the environment variable checks. This release hopefully fixes them, so that none of the checks result in a positive result if the environment variable is not defined at all. i.e. if_disabled? should not be true if the environment variable is not defined. It should only be true if the variable is defined, and the value is a falsey value.

This may be a breaking change.

Internals Refactor & BugFix

10 May 06:12
Compare
Choose a tag to compare

I discovered that the internals had flaws and didn't do the right things in some cases. This refactor should be much more correct.

It Handles (Mostly) MacroExpressions

23 Apr 15:04
800f437
Compare
Choose a tag to compare

This release works around a challenge that is posed by version specifications that use a macro which is not itself in a {% begin %} ... {% end %} block:

class Foo
  VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
end

Please read the docs about some caveats around this, however.

Environment Variable Checks & Better Documentation

08 Apr 15:52
Compare
Choose a tag to compare

All of the recent changes are documented, and the ability to check based on environment variables has been implemented.

Version Checks

06 Apr 22:52
Compare
Choose a tag to compare

This release adds the ability to check versions and conditionally compile based on the result of those checks.

Breaking change -- improve the if/unless macros

05 Apr 22:49
Compare
Choose a tag to compare

Originally, the macros took code as text. I don't know why I did that. One can take code via block syntax, and I don't think there should be any problems with that since the evaluation is in the context of the macro, so even blocks that reference things that they can't know about, out of context, will be fine because the code doesn't actually get compiled or interpreted out of context.

So:

if_defined("Foo") do
  puts "#{Foo} is defined"
end

Will work.

Add (if|unless)_defined? to make conditionals easier

21 Jun 17:59
Compare
Choose a tag to compare

This release adds a little more documentation, and it adds `#if_defined?" and "#unless_defined?" which can be used to do things conditionally that are not normally possible conditionally. i.e. conditional class definitions or conditional requires.

Initial Release

17 Jun 17:59
ff48404
Compare
Choose a tag to compare

This is the simplest thing that can possibly work, for defining a defined? function.