Last active
August 29, 2015 14:20
-
-
Save drewdeponte/7154119d76734fe4e01b to your computer and use it in GitHub Desktop.
Script to output the Bi-Weekly Iteration Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby --disable-gems | |
# Installation Instructions: | |
# Create a file ~/bin/iternum with this content in it and chmod u+x | |
# ~/bin/iternum. Then make sure that ~/bin is in your PATH environment | |
# variable and you should be good to go. | |
WEEKS_IN_ITERATION=2 | |
def week_number | |
# Note: Please see 'man 3 strftime' for details on the custom formatting used | |
# with the 'date' command. The option I used gets the week number of the | |
# year assuming weeks start on Monday and that it returns a decimal between | |
# 01-53. | |
`date "+%V"`.to_i | |
end | |
def iteration_number(week_number) | |
week_number / WEEKS_IN_ITERATION | |
end | |
puts iteration_number(week_number) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment