-
-
Save cheald/310096d07e6ee7118fbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem 'capistrano-jbundler', github: "cheald/capistrano-jbundler" | |
# bundle install --binstubs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Amended Pathname#chop_basename | |
def chop_basename(path) # :nodoc: | |
puts "Chopping basename from #{path.inspect}" | |
base = File.basename(path) | |
puts "Base for #{path.inspect} is #{base.inspect}" | |
if /\A#{SEPARATOR_PAT}?\z/o =~ base | |
return nil | |
else | |
puts "Path is #{path}, path.rindex(base) is #{path.rindex(base).inspect} for base #{base}" | |
return path[0, path.rindex(base)], base | |
end | |
end | |
# Bundler | |
Chopping basename from "lib/capistrano/jbundler.rb" | |
Base for "lib/capistrano/jbundler.rb" is "jbundler.rb" | |
Path is lib/capistrano/jbundler.rb, path.rindex(base) is nil for base jbundler.rb | |
TypeError: no implicit conversion from nil to integer | |
org/jruby/RubyString.java:2932:in `[]' | |
/usr/local/rvm/rubies/jruby-head/lib/ruby/stdlib/pathname.rb:49:in `chop_basename' | |
/usr/local/rvm/rubies/jruby-head/lib/ruby/stdlib/pathname.rb:106:in `cleanpath_aggressive' | |
/usr/local/rvm/rubies/jruby-head/lib/ruby/stdlib/pathname.rb:92:in `cleanpath' | |
/usr/local/rvm/rubies/jruby-head/lib/ruby/stdlib/pathname.rb:498:in `relative_path_from' | |
/usr/local/rvm/gems/jruby-head@global/gems/bundler-1.9.1/lib/bundler/source/path.rb:184:in `block in generate_bin' | |
org/jruby/RubyArray.java:2307:in `map' | |
# IRB | |
jruby-head :001 > require 'pathname' | |
=> true | |
jruby-head :002 > Pathname.new("").send :chop_basename, "lib/capistrano/jbundler.rb" | |
Chopping basename from "lib/capistrano/jbundler.rb" | |
Base for "lib/capistrano/jbundler.rb" is "jbundler.rb" | |
Path is lib/capistrano/jbundler.rb, path.rindex(base) is 15 for base jbundler.rb | |
=> ["lib/capistrano/", "jbundler.rb"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment