module Jeny::Command::Support

Public Class Methods

simplify_path(path) click to toggle source
# File lib/jeny/command/support.rb, line 12
def simplify_path(path)
  if path.to_s.start_with?(Path.pwd.to_s)
    path.relative_to(Path.pwd)
  else
    path
  end
end

Public Instance Methods

edit_changed_files(changed) click to toggle source
# File lib/jeny/command/support.rb, line 21
def edit_changed_files(changed)
  to_open = changed
    .select{|pair| config.should_be_edited?(*pair) }
    .map{|pair| simplify_path(pair.first) }
  config.open_editor(to_open) unless to_open.empty?
end
target_for(source, data = self.data) click to toggle source
# File lib/jeny/command/support.rb, line 5
def target_for(source, data = self.data)
  relative = source.relative_to(from)
  relative.each_filename.map{|f|
    Dialect.render(f.gsub(/.jeny$/, ""), data)
  }.inject(to){|t,part| t/part }
end

Private Instance Methods

simplify_path(path) click to toggle source
# File lib/jeny/command/support.rb, line 12
def simplify_path(path)
  if path.to_s.start_with?(Path.pwd.to_s)
    path.relative_to(Path.pwd)
  else
    path
  end
end