Skip to content

Commit

Permalink
• use "┋" to separate different comments
Browse files Browse the repository at this point in the history
• fixed: the source will be reset automatically if a bundle was relocated (e.g. from Review to Official or vice versa)
• minor message typos were fixed

git-svn-id: http://svn.textmate.org/trunk/Review/Bundles/GetBundles.tmbundle@11074 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
  • Loading branch information
bibiko committed Jan 5, 2009
1 parent 524ad57 commit cf0b05f
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions Support/getBundles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,24 @@ def getRepoAbbrev(aBundleDict)
def checkSources
# check the sources for each installed bundle if bundle is listed in the bundle cache
mustBeResolved = [ ]

# reset source if only one source available to get rid of relocating bundles (e.g. from Review to Official)
$localBundles.each do |uuid, bundle|
if $numberOfBundleSources[uuid] == 1
if bundle['scm'] =~ /git/ # under git control
$bundleSources[uuid].each do |g|
g['sources'].each { |t| $gbPlist['bundleSources'][uuid] = t['url'] if t['method'] == "git" }
end
elsif $bundleSources[uuid].first['sources'].size > 1 # not under git control but from github.com
$bundleSources[uuid].each do |g|
g['sources'].each { |t| $gbPlist['bundleSources'][uuid] = t['url'] if t['method'] == "tar" }
end
else
$gbPlist['bundleSources'][uuid] = $bundleSources[uuid].first['sources'].first['url']
end
end
end

$localBundles.each do |uuid, bundle|
if !$gbPlist['bundleSources'].has_key?(uuid) && $bundleSources.has_key?(uuid)

Expand All @@ -242,7 +260,6 @@ def checkSources
$bundleSources[uuid].each do |b|
if b['infoMD5'] == bundle['infoMD5']
if b['sources'].size == 1

if bundle['scm'] =~ /git/ # under git control
$bundleSources[uuid].each do |g|
g['sources'].each { |t| $gbPlist['bundleSources'][uuid] = t['url'] if t['method'] == "git" }
Expand Down Expand Up @@ -448,7 +465,7 @@ def getBundleLists

updatedStr,status,deleteButton,deleteButtonEnabled,locCom,canBeOpened,deleteButtonLabel,nameBold = getLocalStatus(bundle)
if nameColor != '#000000'
locCom += " date: " + Time.parse(bundle['revision']).getutc.strftime("%y-%m-%d %H:%M")
locCom += " date: " + Time.parse(bundle['revision']).getutc.strftime("%y-%m-%d %H:%M")
end
# set searchpattern
updatedStr = (status.empty?) ? "" : (status =~ /^O/) ? "=i" : "=i=u"
Expand All @@ -461,7 +478,7 @@ def getBundleLists
'source' => repo,
'uuid' => bundle['uuid'],
'status' => status,
'locCom' => locCom.strip,
'locCom' => locCom.strip.gsub(/ {2,}/,' ┋ '),
'deleteButtonEnabled' => deleteButtonEnabled,
'deleteButtonLabel' => deleteButtonLabel,
'deleteButton' => deleteButton,
Expand Down Expand Up @@ -713,7 +730,7 @@ def refreshUpdatedStatus
updatedStr,status,deleteButton,deleteButtonEnabled,locCom,canBeOpened,deleteButtonLabel,nameBold = getLocalStatus(bundle)

if r['nameColor'] != '#000000'
locCom += " date: " + Time.parse(bundle['revision']).getutc.strftime("%y-%m-%d %H:%M")
locCom += " date: " + Time.parse(bundle['revision']).getutc.strftime("%y-%m-%d %H:%M")
end


Expand All @@ -723,7 +740,7 @@ def refreshUpdatedStatus
r['status'] = status
r['deleteButtonEnabled'] = deleteButtonEnabled
r['deleteButton'] = deleteButton
r['locCom'] = locCom.strip
r['locCom'] = locCom.strip.gsub(/ {2,}/,' ┋ ')
r['canBeOpened'] = canBeOpened
r['deleteButtonLabel'] = deleteButtonLabel
r['deleteButtonTooltip'] = "#{deleteButtonLabel}#{r['name']}”"
Expand Down Expand Up @@ -1035,14 +1052,15 @@ def enableBundle(aBundle,path)
begin
%x{open -a Finder '#{aBundle['path']}'}
rescue
writeToLogFile("Error while enabling bundles.\n#{$!}")
writeToLogFile("Error while enabling bundle.\n#{$!}")
end
#TM refreshes its plist not immediately
b = $dataarray[path.to_i]
b['deleteButtonEnabled'] = ($localBundles[b['uuid']]['scm'].empty? && $localBundles[b['uuid']]['location'] =~ /Pristine/) ? "1" : "0"
b['deleteButton'] = "1"
b['deleteButtonLabel'] = "Delete" if b['deleteButtonEnabled']
b['locCom'].gsub!($localBundles[b['uuid']]['disabled'],"")
b['locCom'].gsub!(/ ┋ *$/,'')
$localBundles[b['uuid']]['disabled'] = ""
$params['dataarray'] = $dataarray
updateDIALOG
Expand All @@ -1053,14 +1071,15 @@ def unDeleteBundle(aBundle,path)
begin
%x{open -a Finder '#{aBundle['path']}'}
rescue
writeToLogFile("Error while enabling bundles.\n#{$!}")
writeToLogFile("Error while undeleting bundle.\n#{$!}")
end
#TM refreshes its plist not immediately
b = $dataarray[path.to_i]
b['deleteButtonEnabled'] = ($localBundles[b['uuid']]['scm'].empty? && $localBundles[b['uuid']]['location'] =~ /Pristine/) ? "1" : "0"
b['deleteButton'] = "1"
b['deleteButtonLabel'] = "Delete" if b['deleteButtonEnabled']
b['locCom'].gsub!($localBundles[b['uuid']]['deleted'],"")
b['locCom'].gsub!(/ ┋ *$/,'')
$localBundles[b['uuid']]['deleted'] = ""
$params['dataarray'] = $dataarray
updateDIALOG
Expand Down

0 comments on commit cf0b05f

Please sign in to comment.