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

Incorporate release date with ensmallen version #226

Merged
merged 8 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
### ensmallen ?.??.?: "???"
###### ????-??-??

* Add release date to version information. ([#226](https://github.com/mlpack/ensmallen/pull/226))

### ensmallen 2.14.2: "No Direction Home"
###### 2020-08-31
* Fix implementation of fonesca fleming problem function f1 and f2
Expand Down
21 changes: 19 additions & 2 deletions include/ensmallen_bits/ens_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
// (i.e. the version name will be "RC1", "RC2", etc.). Otherwise the version
// name will typically be a seemingly arbitrary set of words that does not
// contain the capitalized string "RC".
#define ENS_VERSION_NAME "No Direction Home"
#define ENS_VERSION_NAME "No Direction Home"
// Incorporate the date the version was released
coatless marked this conversation as resolved.
Show resolved Hide resolved
#define ENS_VERSION_YEAR "2020"
#define ENS_VERSION_MONTH "09"
#define ENS_VERSION_DAY "05"

namespace ens {

Expand All @@ -37,10 +41,23 @@ struct version

std::stringstream ss;
ss << version::major << '.' << version::minor << '.' << version::patch
<< " (" << nickname << ')';
<< " (" << nickname << ")";

return ss.str();
}

static inline std::string date()
{
const char* year = ENS_VERSION_YEAR;
const char* month = ENS_VERSION_MONTH;
const char* day = ENS_VERSION_DAY;

std::stringstream ss;
ss << year << '-' << month << '-' << day;
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason to not pass the date into the stream directly:

ss << ENS_VERSION_YEAR << '-' << ENS_VERSION_MONTH << '-' << ENS_VERSION_DAY;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zoq No reason not to. I opted to mirror the styling of nickname if memory serves correctly.


return ss.str();
}
};


coatless marked this conversation as resolved.
Show resolved Hide resolved
} // namespace ens
8 changes: 8 additions & 0 deletions scripts/ensmallen-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ new_line="ensmallen $MAJOR.$MINOR.$PATCH: \"$version_name\"";
sed -i "s/### ensmallen ?.??.?: \"???\"/### $new_line/" HISTORY.md;
sed -i "s/###### ????-??-??/###### $year-$month-$day/" HISTORY.md;

# Update date in ens_version.hpp
sed -i 's/ENS_VERSION_YEAR[ ]*\".*\"$/ENS_VERSION_YEAR \"'"$year"'\"/' \
include/ensmallen_bits/ens_version.hpp;
sed -i 's/ENS_VERSION_MONTH[ ]*\".*\"$/ENS_VERSION_MONTH \"'"$month"'\"/' \
include/ensmallen_bits/ens_version.hpp;
sed -i 's/ENS_VERSION_DAY[ ]*\".*\"$/ENS_VERSION_DAY \"'"$day"'\"/' \
include/ensmallen_bits/ens_version.hpp;

# Now, we'll do all this on a new release branch.
git checkout -b release-$MAJOR.$MINOR.$PATCH;

Expand Down