Class: Aerial::Git
Overview
Provides a few methods for interacting with that Aerial repository
Class Method Summary collapse
-
.commit(path, message) ⇒ Object
Added the file in the path and commit the changs to the repo
pathto the new file to commitmessagedescription of the commit. -
.commit_all(path = ".", message = "Commited all changes at: #{DateTime.now}") ⇒ Object
Adds all untracked files and commits them to the repo.
-
.commit_and_push(path, message) ⇒ Object
Commit the new file and push it to the remote repository.
-
.push ⇒ Object
Upload all new commits to the remote repo (if exists).
Class Method Details
.commit(path, message) ⇒ Object
Added the file in the path and commit the changs to the repo
+path+ to the new file to commit
++ description of the commit
129 130 131 132 133 134 |
# File 'lib/aerial/base.rb', line 129 def self.commit(path, ) Dir.chdir(File.(Aerial.repo.working_dir)) do Aerial.repo.add(path) end Aerial.repo.commit_index() end |
.commit_all(path = ".", message = "Commited all changes at: #{DateTime.now}") ⇒ Object
Adds all untracked files and commits them to the repo
137 138 139 140 141 142 |
# File 'lib/aerial/base.rb', line 137 def self.commit_all(path = ".", = "Commited all changes at: #{DateTime.now}") unless Aerial.repo.status.untracked.empty? self.commit(path, ) end true end |
.commit_and_push(path, message) ⇒ Object
Commit the new file and push it to the remote repository
121 122 123 124 |
# File 'lib/aerial/base.rb', line 121 def self.commit_and_push(path, ) self.commit(path, ) self.push end |
.push ⇒ Object
Upload all new commits to the remote repo (if exists)
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/aerial/base.rb', line 145 def self.push return unless Aerial.config.git.name && Aerial.config.git.branch begin cmd = "push #{Aerial.config.git.name} #{Aerial.config.git.branch} " Aerial.repo.git.run('', cmd, '', {}, "") rescue Exception => e Aerial.log(e.) end end |