Class: HerokuDeployment::Git

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

Class Method Summary collapse

Class Method Details

.commitObject



25
26
27
# File 'lib/heroku_deployment/git.rb', line 25

def commit
  system %(git commit -m "Heroku deployment" -o #{HerokuDeployment::Config.commit_files.join(" ")} >/dev/null 2>&1)
end

.create_heroku_remoteObject



29
30
31
32
33
34
35
36
# File 'lib/heroku_deployment/git.rb', line 29

def create_heroku_remote
  remote = HerokuDeployment::Config.remote
  app = HerokuDeployment::Config.app
  if `git remote | grep #{remote}`.to_s == ""
    puts "Couldn't find '#{remote}' remote, added one now"
    system %(git remote add #{remote} [email protected]:#{app}.git)
  end
end

.current_versionObject



4
5
6
# File 'lib/heroku_deployment/git.rb', line 4

def current_version
  `git show HEAD | head -n 1`.split(" ").last.strip
end

.pullObject



12
13
14
# File 'lib/heroku_deployment/git.rb', line 12

def pull
  system %(git pull >/dev/null 2>&1)
end

.pull_remoteObject



21
22
23
# File 'lib/heroku_deployment/git.rb', line 21

def pull_remote
  system %(git pull #{HerokuDeployment::Config.remote} master >/dev/null 2>&1)
end

.pushObject



8
9
10
# File 'lib/heroku_deployment/git.rb', line 8

def push
  system %(git push >/dev/null 2>&1)
end

.push_remoteObject



16
17
18
19
# File 'lib/heroku_deployment/git.rb', line 16

def push_remote
  create_heroku_remote
  system %(git push #{HerokuDeployment::Config.remote} master)
end