class T1k::Commands::Ship

Public Class Methods

commands_if_branch(branch) click to toggle source
# File lib/t1k/commands/ship.rb, line 31
def self.commands_if_branch(branch)
  [ "git checkout #{branch}",
    "git pull --rebase #{branch}",
    "git commit -v",
    "git push origin #{branch}"
  ].each do |cmd|
    system cmd
  end
end
commands_if_master(branch) click to toggle source
# File lib/t1k/commands/ship.rb, line 20
def self.commands_if_master(branch)
  [ "git checkout master",
    "git pull --rebase master",
    "git merge #{branch}",
    "git commit -v",
    "git push origin master"
  ].each do |cmd|
    system cmd
  end
end
run() click to toggle source
# File lib/t1k/commands/ship.rb, line 5
def self.run
  T1k.setup_credentials

  default_remote_branch = T1k::Repository.default_remote_branch
  branch                = T1k::Commands::Branch.actual_branch.strip

  if default_remote_branch == :master
    commands_if_master(branch)
  elsif default_remote_branch == :branch
    commands_if_branch(branch)
  else
    puts "Invalid default_remote_branch"
  end
end