Farbflash projects: Imaging lingo table | 3-D scene list | Find all | Handler menu | Lingo message window

source: trunk/lingosource/castlib2/subversionVersionChecker.ls

Last change on this file was 244, checked in by alex, 2 years ago

open linked script now also opens script fouind in member comments, if not a linked scripts

File size: 3.7 KB
Line 
1-- subversionVersionChecker
2-----------------------------------
3-- CREATED:
4-- 05.04.2008
5--
6-- DESCRIPTION:
7--             this behavior just checks the URL, which it finds in its member comments field
8--             and compares it with its own content.
9--             If the new number it gets from the URL is higher, it just displays an alert.
10--
11-- REQUIRES:
12-- (Prerequisites) NONE
13--
14-- USAGE:
15--             The URL entered in the comments field should yield an integer
16--             The way I use it is, that on subversion commit (using my "HandlerMenu" tool)
17--             the field in this movie gets updated as well as the value retrieved by the online URL.
18--             I use a perl script myself, which can update the revision number on the one hand
19--             and which can be queried to return the revision number on the other hand
20--             So all I do is using my "HandlerMenu" tool to commit and automatically refresh
21--             the revision number and the URL in the comments field
22--             When working with external castlibs, each castlib can have its own version field
23--             in that case this behavior gets the highest number on beginsprite
24-----------------------------------
25
26property pNetId, pSecurityTimeout
27
28-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
29
30on beginSprite me
31  myMem = sprite(me.spritenum).member
32  myrev = mGetMyRevNumber(me, myMem)
33  if ilk(myrev) <> #integer then myrev = 0
34  repeat with n = the number of castlibs down to 1
35    themember = member("subversion_version_field", n)
36    if ilk(themember) = #member then
37      theRev = mGetMyRevNumber(me, themember)
38      if integerP(theRev) then
39        if theRev > myrev then myrev = theRev
40      end if
41    end if
42  end repeat
43  if [#field, #text].getPos(myMem) > 0 then myMem.text = "r" & myrev
44end
45
46-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
47
48on mouseEnter me
49  cursor 280
50end
51
52-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
53
54on mouseLeave me
55  cursor -1
56end
57
58-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
59
60on mouseUp me
61  mCheckSubversionRevision me
62end
63
64-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
65
66on mCheckSubversionRevision me
67  mem = sprite(me.spritenum).member
68  theUrl = string(mem.comments.line[1])
69  if length(theUrl) < 1 then exit
70  pNetID = getnettext(theUrl)
71  pSecurityTimeout = the milliseconds + 20000
72  (the actorlist).add(me)
73end
74
75-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
76
77on mGetMyRevNumber me, theMember
78  if [#field, #text].getPos(theMember.type) < 1 then return void
79  myrev = theMember.text
80  if myrev starts "r" then delete char 1 of myrev
81  return integer(myrev)
82end
83
84-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
85
86on stepframe me
87  if netdone(pNetId) then
88    (the actorlist).deleteOne(me)
89    if neterror(pNetId) = "OK" then
90      theResult = string(nettextresult(pNetId))
91      if length(theResult) then
92        theResult = integer(theResult)
93        if ilk(theResult) <> #integer then exit
94        myrev = mGetMyRevNumber(me, sprite(me.spritenum).member)
95        if ilk(myrev) <> #integer then myrev = 0
96        if myrev < theResult then
97          alert "There is a newer version available!" & RETURN & "Current version:" && theResult & RETURN & "Your version:" && myrev
98        else
99          alert "Your version" && myrev && "is up to date."
100        end if
101      end if
102    end if
103  else
104    if the milliseconds > pSecurityTimeout then (the actorlist).deleteOne(me)
105  end if
106end
Note: See TracBrowser for help on using the repository browser.