Skip to content

Commit

Permalink
why are my tests suddenly failing?!
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Oct 30, 2015
1 parent b01e2f5 commit d67436b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ GEM
specs:
addressable (2.3.8)
backports (3.6.6)
bibtex-ruby (4.0.15)
bibtex-ruby (4.0.16)
latex-decode (~> 0.0)
builder (3.2.2)
childprocess (0.5.6)
childprocess (0.5.7)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0)
cucumber (2.1.0)
Expand Down Expand Up @@ -39,7 +39,7 @@ GEM
net-http-persistent (>= 2.7)
net-http-pipeline
gherkin3 (3.1.2)
ghi (0.9.3)
ghi (1.0.3)
github_api (0.12.4)
addressable (~> 2.3)
descendants_tracker (~> 0.0.4)
Expand All @@ -48,7 +48,7 @@ GEM
multi_json (>= 1.7.5, < 2.0)
nokogiri (~> 1.6.6)
oauth2
hashie (3.4.2)
hashie (3.4.3)
headless (2.2.0)
highline (1.7.8)
http-cookie (1.0.2)
Expand All @@ -57,7 +57,7 @@ GEM
json (~> 1.8)
multi_xml (>= 0.5.2)
json (1.8.3)
jwt (1.5.1)
jwt (1.5.2)
latex-decode (0.2.2)
unicode (~> 0.4)
launchy (2.4.3)
Expand Down
23 changes: 13 additions & 10 deletions chrome/content/zotero-better-bibtex/autoexport.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ Zotero.BetterBibTeX.auto = new class
path = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile)
path.initWithPath(ae.path)

if !(path.exists() && path.isFile() && path.isWritable())
@mark(ae, 'error')
msg = "auto.prepare: candidate path '#{path.path}' exists but is not writable"
if path.exists() && !(path.isFile() && path.isWritable())
msg = "auto.prepare: candidate path '#{ae.path}' exists but is not writable"
Zotero.BetterBibTeX.debug(msg)
@mark(ae, 'error')
throw new Error(msg)

if !(path.parent.exists() && path.parent.isDirectory() && path.isWritable())
@mark(ae, 'error')
msg = "auto.prepare: parent of candidate path '#{path.path}' exists but is not writable"
if !(path.parent.exists() && path.parent.isDirectory() && path.parent.isWritable())
msg = "auto.prepare: parent of candidate path '#{ae.path}' exists but is not writable"
Zotero.BetterBibTeX.debug(msg)
@mark(ae, 'error')
throw new Error(msg)

switch
Expand All @@ -102,7 +102,9 @@ Zotero.BetterBibTeX.auto = new class
Zotero.BetterBibTeX.debug('auto.process: unexpected collection id ', ae.collection)
return null

return null if items.items && items.items.length == 0
if items.items && items.items.length == 0
Zotero.BetterBibTeX.debug('auto.prepare: candidate ', ae.path, ' has no items')
return null

translation = new Zotero.Translate.Export()

Expand Down Expand Up @@ -149,7 +151,6 @@ Zotero.BetterBibTeX.auto = new class
translation = null

for ae in @db.autoexport.findObjects({status: 'pending'})
break if translation
try
translation = @prepare(ae)
catch err
Expand All @@ -158,9 +159,11 @@ Zotero.BetterBibTeX.auto = new class

if !translation
@mark(ae, 'done')
else
break

if translation
@running = '' + ae.id
@running = '' + ae.$loki
else
Zotero.BetterBibTeX.debug('auto.process: no pending jobs')
return
Expand All @@ -169,7 +172,7 @@ Zotero.BetterBibTeX.auto = new class
@refresh()

translation.setHandler('done', (obj, worked) =>
status = Zotero.BetterBibTeX.auto.status((if worked then 'done' else 'error'))
status = (if worked then 'done' else 'error')
Zotero.BetterBibTeX.debug("auto.process: finished #{Zotero.BetterBibTeX.auto.running}: #{status}")
@mark(ae, status)
Zotero.BetterBibTeX.auto.running = null
Expand Down
13 changes: 9 additions & 4 deletions chrome/content/zotero-better-bibtex/preferences.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,17 @@ BetterBibTeXAutoExportPref =
selected = exportlist.currentIndex
return if selected < 0

id = exportlist.contentView.getItemAtIndex(selected).getAttribute('autoexport')
id = parseInt(exportlist.contentView.getItemAtIndex(selected).getAttribute('autoexport'))

ae = Zotero.BetterBibTeX.DB.autoexport.get(id)
return unless ae
if !ae
Zotero.BetterBibTeX.debug('No autoexport', id)
return

try
translation = Zotero.BetterBibTeX.auto.prepare(ae)
catch
catch err
Zotero.BetterBibTeX.debug('failed to prepare', ae, err.message)
return

if !translation
Expand Down Expand Up @@ -176,7 +180,8 @@ BetterBibTeXAutoExportPref =
tree = new BetterBibTeXAutoExport('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', exportlist, document)

for ae in Zotero.BetterBibTeX.DB.autoexport.chain().simplesort('path').data()
status = if Zotero.BetterBibTeX.auto.running == ae.id then 'running' else "#{ae.status} (#{ae.updated})"
Zotero.BetterBibTeX.debug('refresh:', {id: ae.$loki, status: ae.status, running: Zotero.BetterBibTeX.auto.running})
status = if Zotero.BetterBibTeX.auto.running == ae.$loki then 'running' else "#{ae.status} (#{ae.updated})"
tree.treeitem({autoexport: "#{ae['$loki']}", '': ->
@treerow(->
@treecell({editable: 'false', label: "#{BetterBibTeXAutoExportPref.exportType(ae.collection)}: #{BetterBibTeXAutoExportPref.exportName(ae.collection)}"})
Expand Down

0 comments on commit d67436b

Please sign in to comment.