Class: Give::Project

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/give.rb

Overview

Give::Project

Wraps a remote repository

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commands

#git, #sh

Constructor Details

#initialize(owner, title, target_branch = 'master') ⇒ Project

Returns a new instance of Project.



54
55
56
57
58
59
# File 'lib/give.rb', line 54

def initialize(owner, title, target_branch='master')
  @owner, @title = owner, title
  @target_branch = target_branch
  @user = User.new
  @client = Octokit::Client.new
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



53
54
55
# File 'lib/give.rb', line 53

def client
  @client
end

#ownerObject

Returns the value of attribute owner.



53
54
55
# File 'lib/give.rb', line 53

def owner
  @owner
end

#referenceObject

Returns the value of attribute reference.



53
54
55
# File 'lib/give.rb', line 53

def reference
  @reference
end

#target_branchObject

Returns the value of attribute target_branch.



53
54
55
# File 'lib/give.rb', line 53

def target_branch
  @target_branch
end

#titleObject

Returns the value of attribute title.



53
54
55
# File 'lib/give.rb', line 53

def title
  @title
end

#userObject

Returns the value of attribute user.



53
54
55
# File 'lib/give.rb', line 53

def user
  @user
end

Instance Method Details

#forkObject



65
66
67
68
69
# File 'lib/give.rb', line 65

def fork
  client.fork!(reference)
  git("clone #{master}")
  sh("cd #{title};git remote add upstream #{upstream}")
end

#send_pull_request(repo) ⇒ Object



71
72
73
74
# File 'lib/give.rb', line 71

def send_pull_request(repo)
  client.create_pull_request(reference, target_branch, head(repo),
                             request_title, request_body)
end