devondragon/jira-omnifocus

block in get_issues when running

poshpaws opened this issue · 5 comments

MrEd@computer ~ $jiraomnifocus.rb
Connected successfully to website.internal.company.com
/Users/MrEd/bin/jiraomnifocus.rb:82:in block in get_issues': uninitialized constant JSON (NameError) from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:instart'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:582:in start' from /Users/MrEd/bin/jiraomnifocus.rb:75:inget_issues'
from /Users/MrEd/bin/jiraomnifocus.rb:140:in add_jira_tickets_to_omnifocus' from /Users/MrEd/bin/jiraomnifocus.rb:231:inmain'
from /Users/MrEd/bin/jiraomnifocus.rb:236:in `

'

can be closed , I had a broken json gem install :(
after removing and reinstalling the gem it works
Now I have a new issue....

ruby bin/jiraomnifocus.rb -f
Connected successfully to interal.jira.instance
Created task FO-2945: Disembark marmosets
Created task FO-2930: Count chickens , before and after they hatch
Created task FO-2180: Align atomic vector plotter

they appear briefly in omnifocus then bang! , there gone....

actually looks like JIRA was shouting my name back (all in caps) and this caused the delete task to be triggered
very new to github and ruby so apologies if i break something but here what i changed

        # Check to see if the Jira ticket has been unassigned or assigned to someone else, if so delete it.
        # It will be re-created if it is assigned back to you.
        if ! data["fields"]["assignee"]
          omnifocus_document.delete task
        else
          assignee = data["fields"]["assignee"]["name"].downcase
          if assignee != $opts[:username]
            omnifocus_document.delete task
          end

I am glad that you were able to resolve the JSON issue!

I'm not sure why you'd be getting an uppercase username back from JIRA, but I am going to downcase both username strings before comparing them there. Commit coming shortly.

This should be fixed in the latest commit. Please pull the update and test?