Class: Gitcloudcli::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/gitcloudcli/command/git/git.rb

Direct Known Subclasses

Gitee, Github

Instance Method Summary collapse

Instance Method Details

#delete(remote_path, message = nil) ⇒ Object



12
# File 'lib/gitcloudcli/command/git/git.rb', line 12

def delete(remote_path, message=nil) end

#info(remote_path, infos = []) ⇒ Object



8
# File 'lib/gitcloudcli/command/git/git.rb', line 8

def info(remote_path, infos=[]) end

#list(dir = nil, infos = []) ⇒ Object



6
# File 'lib/gitcloudcli/command/git/git.rb', line 6

def list(dir=nil, infos=[]) end

#request(method, urlStr, header, formdata, body) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/gitcloudcli/command/git/git.rb', line 14

def request(method, urlStr, header, formdata, body)
  if urlStr
    uri = URI.parse(URI.encode(urlStr))
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
  else
    raise "urlStr not give"
  end

  if !header
    header={}
  end

  if method==:GET
    request = Net::HTTP::Get.new(uri.request_uri, header)
  elsif method==:POST
    request = Net::HTTP::Post.new(uri.request_uri, header)
  elsif method==:PUT
    request = Net::HTTP::Put.new(uri.request_uri, header)
  elsif method==:DELETE
    request = Net::HTTP::Delete.new(uri.request_uri, header)
  else
    raise "unsuppose method #{method}"
  end

  if body
    request.body = body
  end
  if formdata
    request.form_data = formdata
  end
  response = http.request(request)
end

#upload(local_path, filename = nil, message = nil, infos = []) ⇒ Object



10
# File 'lib/gitcloudcli/command/git/git.rb', line 10

def upload(local_path, filename=nil, message=nil, infos=[]) end