-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The usage of "ptools" seems to break the "build" function of middleman on Windows #62
Comments
I talked to the author of |
If you can tell me what that if-clause is trying to do generally, maybe I can help you with a better solution. |
@djberg96 Thanks for your help! But I haven't started to look into those logics. Instead, I'm looking at what from |
I guess I've found the problem... The final moment before crash in (@source_dir + @app.images_dir).relative_path_from(@app.root_path) Here, the def source_dir
File.join(root, config[:source])
end which is parsed by While the def self.root
ENV['MM_ROOT'] || Dir.pwd
end
delegate :root, :to => :"self.class"
# Pathname-addressed root
def self.root_path
Pathname(root)
end which is un-parsed. Both variables are When executed without This is tricky... Because |
I tried to override # middleman-core-3.3.2/lib/middleman-core/cli/build.rb:206
if @build_dir.expand_path.relative_path_from(@source_dir).to_s =~ /\A[.\/]+\Z/ The Some methods like More important, I'll try these possible solutions tomorrow if I have time, but I don't believe any of them will be a good solution, at best a workaround:
Is there any expert can help? 😿 |
What happens if you install and require the pathname2 gem? |
It crashed because pathname2 let |
There are too many codes in # e.g.
base_path = path.sub("#{load_path}/", '')
# or
if load_path.end_with?('/images') |
This is something I wouldn't do:
Instead:
Using String#sub to mangle paths is a bad idea in general. With respect, I think maybe some refactoring is in order. |
Hm, maybe I need to updated the pathname2 gem then. Arguably a bug. |
I updated the pathname2 gem at least so that Pathname#join and Pathname#expand_path now return Pathname objects. |
@djberg96 Tried def root
default_gemfile.dirname.expand_path
end Cause is require 'pathname'
puts Pathname.new('D:/asdf/qwert').dirname.expand_path
# => D:/asdf
require 'pathname2'
puts Pathname.new('D:/asdf/qwert').dirname.expand_path
# => undefined method `expand_path' for "D:\\asdf":String (NoMethodError) |
Ok, both basename and dirname have been updated to return Pathname objects in 1.7.3. |
Does anything need to happen to middleman deploy so that it picks up these updates? |
I am currently facing the same issue, darn. Did @whitetrefoil solve this somehow eventually? or resolved to use some other gem? Hence, if the problem is all the way inside middleman-core - I believe that we can't get this solved here, or can we? My setup is: middleman-deploy (0.2.4), middleman (3.3.3) and ptools (1.2.4 universal-mingw32) |
Is this still a problem since I've update pathname2? |
@whitetrefoil Any luck? |
@djberg96 oops... Sorry, I didn't see your previous message. I haven't written ruby for years, and I can't remember details of this issue. I need some time to catch up. I guess we can close this issue. If there's still problem we can just reopen it.😄 |
My ruby skill is not good enough so I came here to look for help.
I'm now using
middleman-deploy (0.2.3)
withmiddleman (3.3.2)
&ptools (1.2.4-x86-mingw32)
.When trying to build the console throws:
I traced to
E:/usr/local/Ruby/lib/ruby/2.0.0/pathname.rb:43
:And at the final moment between crach, the result of
File.basename
became wired.Before required
ptools
,File.basename 'E:/'
returns"/"
and everything was good.After required
ptools
,File.basename 'E:/'
returns"E:\\"
, then cause the cause the following codes crashed:I know nor whether this is a bug or a 'by design' for
ptools
, nor whether this is expected formiddleman-deploy
, nor whether there will be another solution to get it work. Is there anybody can help?Thanks
The text was updated successfully, but these errors were encountered: