Closed joelwilson closed 7 years ago
/cc @wallymathieu
We should change path_to
to only expand relative paths.
Perhaps something like
require 'pathname'
...
def path_to path, cwd
if (Pathname.new path).absolute?
return path
else
File.expand_path( File.join(@opts.get(:original_path), path), cwd )
end
?
Sounds like a good solution! @joelwilson – do you want to do the honours?
I can try out the fix but not until I get back to a Windows machine on Monday. On Sep 12, 2015 2:21 AM, "Henrik Feldt" notifications@github.com wrote:
Sounds like a good solution! @joelwilson https://github.com/joelwilson – do you want to do the honours?
— Reply to this email directly or view it on GitHub https://github.com/Albacore/albacore/issues/186#issuecomment-139742433.
No rush :). Try it out Monday and send a PR then.
Sounds good!
@joelwilson Any progress on this :)?
@haf sorry I haven't been working with ruby or albacore in a while. Does someone else want to make this change?
I think you were onto something with the specific gems for paket and/or nuget.
This is still pretty annoying if you just want to run nuget.exe as found in the path.
nugets_restore works as expected
nugets_restore :nuget_restore => [:check_nuget] do |p|
p.out = 'packages'
p.exe = 'nuget.exe'
end
But nugets_pack does not. It concats the executable name to the working directory causing it to fail
nugets_pack :pack do |p|
p.files = 'project.csproj'
p.out = 'build'
p.exe = 'nuget.exe'
end
Albacore::CommandNotFoundError: Command failed with status (127) - number 127 in particular means that the operating system could not find the executable: C:\dev\project\nuget.exe
So it would be nice to normalise the behaviour.
On Tue, 26 Jan 2016 19:52 Ian Hills notifications@github.com wrote:
This is still pretty annoying if you just want to run nuget.exe as found in the path.
This works as expected nugets_restore :nuget_restore => [:check_nuget] do |p| p.out = 'packages' p.exe = 'nuget.exe' end
This concats the executable name to the working directory causing it to fail
nugets_pack :pack do |p| p.files = 'project.csproj' p.out = 'build' p.exe = 'nuget.exe' end
Albacore::CommandNotFoundError: Command failed with status (127) - number 127 in particular means that the operating system could not find the executable: C:\dev\project\nuget.exe
— Reply to this email directly or view it on GitHub https://github.com/Albacore/albacore/issues/186#issuecomment-175175354.
@haf what's the status on this one? The path_to logic should perhaps be moved to "paths.rb" and amended with http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby ?
It should use the PATH. Good catch.
Ping; what's the consensus? We should default to PATH and then go towards folder-local files?
Timed out.
I tried to use the nuget gem today when creating a
nugets_pack
task. It turns out that albacore improperly constructs the path tonuget.exe
:The problem appears to be that the path_to method is written to handle relative paths only. However, the find_nuget_gem_exe method returns the absolute path to the executable.
At least, this is my experience on Windows.