View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
62 | WADF | Core | public | 17 Jun 2008 13:59 | 12 Dec 2008 09:48 |
Reporter | mrosenquist | Assigned To | timj | ||
Priority | normal | Severity | feature | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Target Version | 0.10.1 | Fixed in Version | 0.10.1 | ||
Summary | 62: Ability to deploy the latest release/tag without knowing the specific release number | ||||
Description | Ability to deploy the latest tag without knowing the specific release, wadf-deploy tag | ||||
Tags | No tags attached. | ||||
|
This is a nice idea, although it does mean bringing in site-specific semantics like "our tags are named tags/release-x.y.z" or "our tags are named tags/PACKAGENAME-x_y_z". OK, WADF already assumes that tags are in "tags/" but still... |
|
There could be a definition for the expected format ie //Check the format (regex), only the captures are used to calculate weighting release-(\d+)\.(\d+)\.(\d+)([ab])? If any directories don't match the format: Fail Function to find highest tag by adding 0 to the front of numbers to do a string cmp. Example tags. 'release-1.1.10' 'release-1.1.2' 'release-1.1.1' 'release-1.1.1a' Would become '1110' '1102' '1101' '1101a' $tag_format = '/^release-(\d+)\.(\d+)\.(\d+)([ab])?$/' $tags = array('release-1.1.10','release-1.1.2'); //Example, content for the tags function highestTag($tag_format, $tags) { $max_lengths = array();// count for each part //Check the format of the tags and the max length of the numeric values foreach ($tags as $tag) { //Test the format if (preg_match($tag_format, $tag, $matches)) { unset($matches[0]);//Dont want the first match foreach ($matches as $i=>$n) { if (is_numeric($n)) { $max_lengths[$i] = max($max_lengths[$i], strlen($n)); } } } else { return false; } } //Create the weighted strings $weighted_tags = array(); foreach ($tags as $tag) { preg_match($tag_format, $tag, $matches); unset($matchs[0]);//Dont want the first match $weight_str = ''; foreach ($match as $i=>$n) { if (isset($max_lengths[$i])) { $n = str_pad($tag,$max_lengths[$i],'0',STR_PAD_LEFT); } $weight_str .= $n; } $weighted_tags[$weight_str] = $tags; } //Sort the weights ksort($weighted_tags,SORT_STRING); return array_pop($weighted_tags); } |
|
Your code is nice and works with a slight tweak. However this code does the same thing: natsort($tags); :-) The only minor problem (with both your code and natsort()) is that alpha/beta versions get sorted after the "main" release e.g. 1.1.0 1.1.0a 1.1.0b However I have written some code to hack them into the right order. |
|
is comment 129 in reference to the code I emailed you? |
|
It's a reference to the code in comment 50 |
|
Fixed in SVN r1361 You can now do "wadf-deploy foosite tag/LATEST" |
Date Modified | Username | Field | Change |
---|---|---|---|
17 Jun 2008 13:59 | guest | New Issue | |
17 Jun 2008 22:18 | timj | Reporter | guest => mrosenquist |
17 Jun 2008 22:46 | timj | Target Version | => 0.8.2 |
17 Jun 2008 22:46 | timj | Status | new => assigned |
17 Jun 2008 22:46 | timj | Assigned To | => timj |
17 Jun 2008 23:06 | timj | Note Added: 48 | |
17 Jun 2008 23:06 | timj | Target Version | 0.8.2 => 0.9.0 |
19 Jun 2008 17:25 | mrosenquist | Note Added: 50 | |
20 Jun 2008 20:36 | timj | Severity | minor => feature |
5 Sep 2008 10:50 | timj | Target Version | 0.9.0 => |
26 Nov 2008 21:31 | timj | Note Added: 129 | |
27 Nov 2008 01:24 | mrosenquist | Note Added: 130 | |
27 Nov 2008 01:39 | timj | Note Added: 131 | |
27 Nov 2008 21:16 | timj | Target Version | => 0.10.1 |
29 Nov 2008 15:55 | timj | Status | assigned => resolved |
29 Nov 2008 15:55 | timj | Fixed in Version | => 0.10.1 |
29 Nov 2008 15:55 | timj | Resolution | open => fixed |
29 Nov 2008 15:55 | timj | Note Added: 136 | |
29 Nov 2008 15:56 | timj | Summary | Ability to deploy the latest release/tag without knowing the specific release number, wadf-deploy tag => Ability to deploy the latest release/tag without knowing the specific release number |
29 Nov 2008 15:56 | timj | Note Edited: 136 | |
12 Dec 2008 09:48 | timj | Status | resolved => closed |