Shopify / doggy

MIT License
38 stars 19 forks source link

Doggy should not destroy an object when it only gets moved to another folder #35

Closed ElvinEfendi closed 7 years ago

ElvinEfendi commented 7 years ago

Bug discovered while deploying https://github.com/Shopify/dog/pull/1127

@marc-barry

tylermercier commented 7 years ago

I pulled the monitor, which defaulted to the objects folder.

In a followup PR, I moved the existing monitor to merchant-analytics. Which worked for pulling changes. After the PR merged, the monitor was deleted.

Tried doing doggy push myself:

$doggy push 1364371
Pushing /Users/tyler/Documents/github/shopify/dog/objects/merchant-analytics/monitor-1364371.json
/Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/models/monitor.rb:25:in `to_h': undefined method `options' for nil:NilClass (NoMethodError)
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/models/monitor.rb:107:in `to_h'
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/model.rb:196:in `save'
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/cli/push.rb:28:in `block in run'
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/cli/push.rb:24:in `each'
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/cli/push.rb:24:in `run'
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/lib/doggy/cli.rb:35:in `push'
    from /Users/tyler/.gem/ruby/2.2.3/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    from /Users/tyler/.gem/ruby/2.2.3/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/tyler/.gem/ruby/2.2.3/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    from /Users/tyler/.gem/ruby/2.2.3/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
    from /Users/tyler/.gem/ruby/2.2.3/gems/doggy-2.0.30/exe/doggy:4:in `<top (required)>'
    from /Users/tyler/.gem/ruby/2.2.3/bin/doggy:23:in `load'
    from /Users/tyler/.gem/ruby/2.2.3/bin/doggy:23:in `<main>'
ElvinEfendi commented 7 years ago

@tylermercier I noticed you have an older version of doggy. Please use doggy from bin folder. bin/doggy. That will make sure you have up to date doggy version - the error you saw is because of this but the bug is unrelated.