Class: GitDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/style_pusher/utils/git_driver.rb

Class Method Summary collapse

Class Method Details

.push(url:, local_repo:, branch_name:, project_name:, stylesheets:, upload_location:, commit_message:) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/style_pusher/utils/git_driver.rb', line 3

def self.push(url:, local_repo:, branch_name:, project_name:, stylesheets:, upload_location:, commit_message:)
                  
  #Configure git
  git = create_or_pull(local_path: local_repo, url: url, project_name: project_name)

  #Crete and checkout a branch
  git.branch(branch_name).checkout

  #Commit changes
  upload_stylesheets(stylesheets, upload_location)
  git.add
  git.commit(commit_message)
  
  #Push the branch
  git.push("origin", branch_name, f: true)
  
  #Remove the local branch
  git.checkout("master")
  git.branch(branch_name).delete
end