test-kitchen / busser

Kitchen Busser - Runs tests for projects in test-kitchen
Other
45 stars 17 forks source link

suite_cleanup does not work on windows #22

Closed jmccann closed 9 years ago

jmccann commented 9 years ago

It seems suitepath will return the path using \ on windows, but this does not work for globbing (see: http://ruby-doc.org/core-2.1.1/Dir.html#method-c-glob which notes "Note that this means you cannot use backslash on windows as part of a glob, i.e. Dir["c:\foo"] will not work, use Dir["c:/foo_"] instead.").

Example:

From: C:/Users/vagrant/AppData/Local/Temp/verifier/gems/gems/busser-0.7.0/lib/busser/command/suite_cleanup.rb @ li
Busser::Command::SuiteCleanup#cleanup:

    31:       def cleanup
    32:         if suite_path.directory?
    33:
    34:                 require 'pry'
 => 35:                 binding.pry
    36:
    37:           Pathname.glob(suite_path + "*").each do |dir|
    38:             info "Removing #{dir}"
    39:             dir.rmtree
    40:           end
    41:         else
    42:           info "Suite path directory #{suite_path} does not exist, skipping."
    43:         end
    44:       end
[1] pry(#<Busser::Command::SuiteCleanup>)> suite_pathpath
=> #<Pathname:C:\Users\vagrant\AppData\Local\Temp\verifier/suites>
[2] pry(#<Busser::Command::SuiteCleanup>)> Pathname.glob(suite_path + "*")
=> []
[3] pry(#<Busser::Command::SuiteCleanup>)> p = Pathname.new('c:/Users/vagrant/AppData/Local/Temp/verifier/suites')
=> #<Pathname:c:/Users/vagrant/AppData/Local/Temp/verifier/suites>
[4] pry(#<Busser::Command::SuiteCleanup>)> Pathname.glob(p + "*")
=> [#<Pathname:c:/Users/vagrant/AppData/Local/Temp/verifier/suites/serverspec>]
[5] pry(#<Busser::Command::SuiteCleanup>)>
jmccann commented 9 years ago

Fixed from #23