: row-action ( table -- )
dup selected-row
- [ swap [ action>> call( value -- ) ] [ dup hook>> call( table -- ) ] bi ]
+ [ swap [ dup hook>> call( table -- ) ] [ action>> call( value -- ) ] bi ]
[ 2drop ]
if ;
HELP: filter-moved
{ $values { "assoc1" assoc } { "assoc2" assoc } { "seq" "an sequence of definitions" } }
-{ $description "Removes all definitions from " { $snippet "assoc2" } " which are in " { $snippet "assoc1" } " or are are no longer present in the current " { $link file } "." } ;
+{ $description "Removes all definitions from " { $snippet "assoc2" } " which are in " { $snippet "assoc1" } " or are no longer present in the current " { $link file } "." } ;
HELP: forget-smudged
{ $description "Forgets removed definitions." } ;
--- /dev/null
+Maximilian Lupke
\ No newline at end of file
--- /dev/null
+! Copyright (C) 2010 Maximilian Lupke.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays help.markup help.syntax kernel strings ;
+IN: semantic-versioning
+
+HELP: split-version
+{ $values
+ { "string" string }
+ { "array" array }
+}
+{ $description "Splits the version string into a sequnece of major version, minor version, patch level and an alphanumeric identifier if given. See " { $url "http://semver.org/" } " for a detailed description." } ;
+
+HELP: version<
+{ $values
+ { "version1" string } { "version2" string }
+ { "?" boolean }
+} ;
+
+HELP: version<=
+{ $values
+ { "version1" string } { "version2" string }
+ { "?" boolean }
+} ;
+
+HELP: version<=>
+{ $values
+ { "version1" string } { "version2" string }
+ { "<=>" string }
+} ;
+
+HELP: version=
+{ $values
+ { "version1" string } { "version2" string }
+ { "?" boolean }
+} ;
+
+HELP: version>
+{ $values
+ { "version1" string } { "version2" string }
+ { "?" boolean }
+} ;
+
+HELP: version>=
+{ $values
+ { "version1" string } { "version2" string }
+ { "?" boolean }
+} ;
+
+ARTICLE: { "Versioning" "Semantic Versioning" } "Semantic Versioning"
+{ $vocab-link "semantic-versioning" }
+$nl
+{ "See " { $url "http://semver.org/" } " for a detailed description of semantic versioning." }
+;
+
+ABOUT: { "Versioning" "Semantic Versioning" }
--- /dev/null
+USING: math.order semantic-versioning tools.test ;
+IN: semantic-versioning.tests
+
+[ { 1 0 0 "dev1" } ] [ "1.0.0dev1" split-version ] unit-test
+[ { 1 2 3 } ] [ "1.2.3" split-version ] unit-test
+
+[ +gt+ ] [ "1.2.0dev1" "0.12.1dev2" version<=> ] unit-test
+[ +eq+ ] [ "2.0.0rc1" "2.0.0rc1" version<=> ] unit-test
+[ +lt+ ] [ "1.0.0rc1" "1.0.0" version<=> ] unit-test
+[ +lt+ ] [ "1.0.0rc1" "1.0.0rc2" version<=> ] unit-test
\ No newline at end of file
--- /dev/null
+! Copyright (C) 2010 Maximilian Lupke.
+! See http://factorcode.org/license.txt for BSD license.
+USING: arrays ascii kernel math.order math.parser sequences splitting
+;
+IN: semantic-versioning
+
+: split-version ( string -- array )
+ "." split first3 dup [ digit? not ] find
+ [ cut [ [ string>number ] tri@ ] dip 4array ]
+ [ drop [ string>number ] tri@ 3array ]
+ if ;
+
+: version<=> ( version1 version2 -- <=> )
+ [ split-version ] bi@ drop-prefix
+ 2dup [ length 0 = ] either?
+ [ [ length ] bi@ >=< ] [ [ first ] bi@ <=> ] if ;
+
+: version< ( version1 version2 -- ? )
+ version<=> +lt+ = ;
+
+: version<= ( version1 version2 -- ? )
+ version<=> [ +lt+ = ] [ +eq+ = ] either? ;
+
+: version= ( version1 version2 -- ? )
+ version<=> +eq+ = ;
+
+: version>= ( version1 version2 -- ? )
+ version<=> [ +gt+ = ] [ +eq+ = ] either? ;
+
+: version> ( version1 version2 -- ? )
+ version<=> +gt+ = ;