Skip to content

Commit

Permalink
Hack jruby-rake-plugin to work on a windows machine
Browse files Browse the repository at this point in the history
classpath.erb: escape backslashes for classpath entries
dump_classpath.erb: Workaround bug in Pathname#relative_path_from

Signed-off-by: Hiro Asari <asari.ruby@gmail.com>
  • Loading branch information
Syver Enstad authored and BanzaiMan committed Feb 15, 2013
1 parent 82fccbf commit ce7c497
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion maven/jruby-rake-plugin/src/main/resources/classpath.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# mvn org.jruby.plugins:jruby-rake-plugin:<%= maven["version"] %>:classpath<%= maven["options"] ? maven["options"] : '' %>


module Maven
extend self
BASEDIR = File.expand_path(<%= basedir.inspect %>, __FILE__)
Expand All @@ -14,7 +15,7 @@ module Maven
}

CLASSPATH = [<% classpath.each do |path| %>
"<%= path %>",<% end %>
"<%= path.gsub(/\\/, "\\" * 4) %>",<% end %>
]

def classpath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Calculate relative basedir
require 'pathname'
rb_path = Pathname.new(maven["classpath_rb"]).expand_path
basedir = Pathname.new(maven["basedir"]).relative_path_from(rb_path).to_s
basedir = Pathname.new(maven["basedir"].gsub("\\", "/")).relative_path_from(rb_path).to_s

# Substitute HOME and BASEDIR in the classpath
maven["classpath"] = maven["classpath"].gsub(maven["basedir"], '#{BASEDIR}')
Expand Down

0 comments on commit ce7c497

Please sign in to comment.