Class: Piggly::Config
- Defined in:
- lib/piggly/config.rb,
lib/piggly/config.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.mkpath(root, file = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/piggly/config.rb', line 16 def mkpath(root, file=nil) if file.nil? FileUtils.makedirs(root) root else path = path(root, file) FileUtils.makedirs(File.dirname(path)) path end end |
.path(root, file = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/piggly/config.rb', line 6 def path(root, file=nil) if file.nil? root else file[%r{^\.\.|^\/|^(?:[A-Z]:)?/}i] ? file : # ../path, /path, or D:\path that isn't relative to root File.join(root, file) end end |