Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

working on various solutions to the install problem...

  • Loading branch information...
commit c13588986552dde337cb4200ab0acc5d09a05978 1 parent 60ac906
@ryanmt ryanmt authored
Showing with 15 additions and 6 deletions.
  1. +15 −6 lib/tasks/install.rake
View
21 lib/tasks/install.rake
@@ -18,17 +18,26 @@ end
task :install do # => :build do
# TODO get this to create modify path or provide a command to modify the path to the user with instructions
- puts "Dear User:\n\tPlease run the following command, which will add the executables to your path. This will make using the software easier."
+ # according to : http://stackoverflow.com/questions/190168/persisting-an-environment-variable-through-ruby
+ # There is no way to permanently edit the PATH from within a script, only for child processes
bin_dir = File.join(Dir.pwd, 'bin')
case RbConfig::CONFIG['host_os']
when 'linux-gnu'
system "PATH=#{bin_dir}:$PATH"
when 'mingw32'
- path_tmp = %x{echo %PATH%}
- system "setx PATH #{bin_dir};%PATH%"
- puts "PATH WAS::: "
- puts path_tmp
- end
+ require 'pry'
+ #binding.pry
+ path_tmp = %x{echo %PATH%}.sub('PATH=','').gsub("\"","")#.split(";").join('";"')
+ unless path_tmp[bin_dir]
+ puts "Dear User:\n\tPlease run the following command, which will add the executables to your path. This will make using the software possible."
+ output = %Q|setx $env:Path "#{bin_dir};#{path_tmp.chomp}"|
+ puts output
+ puts %Q|setx PATH "$env:path;#{bin_dir}" -m |
+ end
+ #system output
+ #puts "PATH DIFF::: "
+ #puts path_tmp.split(";").join('";"').split(";") - %x{echo %PATH%}.sub("PATH=","").split(";").join('";"').split(";")
+end
# This way I can still automate, but I'm not building the gem... retaining the local environment
# Rake::Task['build'].invoke
# system "gem install archiver-*"
Please sign in to comment.
Something went wrong with that request. Please try again.