def ensure_dry_running(state, project)
      dry_running = project.dry_running?
      has_finished = !project.version.nil?

      if (state == :is_in_progress && dry_running) ||
         (state == :is_not_in_progress && !dry_running) ||
         (state == :has_finished && !dry_running && has_finished)
        yield
      else
        if (state == :is_in_progress) ||
           (state == :has_finished && !dry_running && !has_finished)
          puts "Please start a dry-run first, use \"tetra dry-run\""
        elsif (state == :is_not_in_progress) ||
              (state == :has_finished && dry_running)
          puts "There is a dry-run in progress, please finish it (^D) or abort it (^C^D)"
        end
      end
    end
def ensure_dry_running(state, project)
      dry_running = project.dry_running?
      has_finished = !project.version.nil?

      if (state == :is_in_progress && dry_running) ||
         (state == :is_not_in_progress && !dry_running) ||
         (state == :has_finished && !dry_running && has_finished)
        yield
      else
        if (state == :is_in_progress) ||
           (state == :has_finished && !dry_running && !has_finished)
          puts "Please start a dry-run first, use \"tetra dry-run\""
        elsif (state == :is_not_in_progress) ||
              (state == :has_finished && dry_running)
          puts "There is a dry-run in progress, please finish it (^D) or abort it (^C^D)"
        end
      end
    end
prints an error message and exits unless a dry-running
 condition is met. Conditions can be: :is_in_progress, :is_not_in_progress
 or :has_finished