Sha256: 13ed6d6da19d3378fdd3a40633e7cb4f56a91e3965b57ebdccb5326aeb6961c4
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'blazing/shell' class Blazing::Target attr_accessor :name, :location, :options def initialize(name, location, config, options = {}) @name = name @location = location @config = config @options = options @shell = Blazing::Shell.new end def setup @shell.run "ssh #{user}@#{host} '#{init_repository} && #{setup_repository}'" end def apply_hook hook = ERB.new(File.read("#{Blazing::TEMPLATE_ROOT}/hook.erb")).result(binding) File.open(Blazing::TMP_HOOK, "wb") do |f| f.puts hook end copy_hook @shell.run "ssh #{user}@#{host} #{make_hook_executable}" end def path @location.match(/:(.*)$/)[1] end def host host = @location.match(/@(.*):/) host[1] unless host.nil? end def user user = @location.match(/(.*)@/) user[1] unless user.nil? end def init_repository "git init #{path}" end def copy_hook @shell.run "scp #{Blazing::TMP_HOOK} #{user}@#{host}:#{path}/.git/hooks/post-receive" end def make_hook_executable "chmod +x #{path}/.git/hooks/post-receive" end def setup_repository "cd #{path} && git config receive.denyCurrentBranch ignore" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blazing-0.2.0 | lib/blazing/target.rb |
blazing-0.1.3 | lib/blazing/target.rb |
blazing-0.1.2 | lib/blazing/target.rb |