class Relish::Command::Push

def files

def files
  Dir["#{path}/**/*.{feature,md,markdown}"] +
  Dir["#{path}/**/.nav"]
end

def files_as_tar_gz

def files_as_tar_gz
  stream = StringIO.new
  begin
    tgz = Zlib::GzipWriter.new(stream)
    tar = Archive::Tar::Minitar::Output.new(tgz)
    files.each do |entry|
      Archive::Tar::Minitar.pack_file(entry, tar)
    end
  ensure
    tar.close if tar # Closes both tar and tgz.
  end
  stream.string
end

def post(tar_gz_data, params)

def post(tar_gz_data, params)
  resource["pushes?#{params}"].post(tar_gz_data,
    :content_type => 'application/x-gzip')
  puts "sent:\n#{files.join("\n")}"
end

def project

def project
  (@param.without_option if @param) || super()
end

def project_params

def project_params
  "".tap do |str|
    str << "project_id=#{project}"
    str << "&version_id=#{version}" if version
  end
end

def publisher_params

def publisher_params
  "publisher_id=#{@param}"
end

def version

def version
  return unless @param
  @param.extract_option if @param.has_option?
end