class PMLCode::FullUpdater

Private Instance Methods

generate_update_id(match) click to toggle source
# File lib/pmlcode/updaters/full_updater.rb, line 26
def generate_update_id(match)
  "#{match[:chapter]}.#{match[:snapshot]}"
end
update(match, already_wrote) click to toggle source
# File lib/pmlcode/updaters/full_updater.rb, line 9
def update(match, already_wrote)
  full_path = directory(match)
  FileUtils.mkdir_p(full_path)
  success = false
  content = nil
  Dir.chdir(@options.app) do
    content = `git show origin/#{match[:chapter]}.#{match[:snapshot]}:#{match[:path]}`
    if already_wrote || @options.dry_run
      success = true
    else
      system "git archive '#{match[:chapter]}.#{match[:snapshot]}' | tar -x -C '#{full_path}'"
      success = $?
    end
  end
  success ? content : nil
end