Git Product home page Git Product logo

Comments (18)

msabramo avatar msabramo commented on August 26, 2024

Ah yes, I noticed this too while trying to write a test for --debug. I don't know enough about HTTParty to know how to resolve.

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

I'll take a look and see if there is a straightforward solution.

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

https://gist.github.com/natritmeyer/6495044

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

http://stackoverflow.com/questions/22414803/httparty-how-to-log-request

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

Would be nice if I didn't have to litter the classes with debug_output $stdout checks, and just have it part of class AptlyCommand

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

Hmm maybe have AptlyCommand extend HTTParty instead of include it?

http://stackoverflow.com/a/14212020/638434

If you extend a class with a module, that means you're "bringing in" the module's methods as class methods. If you include a class with a module, that means you're "bringing in" the module's methods as instance methods.

Though the docs say to use include so I don't know.

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

Hmmmm.

jnunemaker/httparty#26

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

Ok, it might not a problem with the class inheritance.

When I swap out that L66 in aptly_command.rb for

      if self.class.respond_to?(:debug_output)
        puts @config[:debug]
        puts options.debug
        #self.class.debug_output $stdout if @config[:debug]
        self.class.debug_output $stdout
      end

it works. So, it appears to be an issue with the if @config[:debug] check failing. I see that this hash entry is empty at this point, even when I have --debug in the command.

options.debug is true

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

I think I have boiled it down to

if options.respond_to?(:debug) to passing

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

Interesting. Is https://github.com/sepulworld/aptly_cli/blob/master/bin/aptly-cli#L54 getting executed?

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

It is... when I do some 'puts' debugging I see it come through.

When I inspect the 'options' object

puts options.inspect
<Commander::Command::Options debug=true, no_config=false>

puts options.respond_to?(:debug)

returns empty line

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

I wonder if the commander Options class might have its own debug method that we're clashing with?

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

If I were at a keyboard, I think I'd put a require 'pry'; binding.pry where $debug gets set.

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

Maybe, but I also see similar behavior with other options.

if options.respond_to?(:server)

Looks like they are all missed upon respond_to? check. Using Ruby 2.3.0...

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

Ok, Ill checkout with pry, good call.

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

So, I think why the tests passed originally is because we create the options object with Options.new and get an object that looks like this.

responds_to? works for this object...
#<Options:0x007f964662d688 @username="me", @password="secret", @server="my-server", @port=9000, @debug=false>

versus in aptly_command.rb the options object comes from Commander and inspect (seen in pry) shows it as:

responds_to? doesn't work for us here....
<Commander::Command::Options debug=true, no_config=false, server="127.0.0.1">

from aptly_cli.

msabramo avatar msabramo commented on August 26, 2024

Fixed by #137 ?

from aptly_cli.

sepulworld avatar sepulworld commented on August 26, 2024

Yes, looks good. I'll close this and work on some functional test using serverspec.

from aptly_cli.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.