Sha256: d5aecd2eb65d08c3e5ac5f6173d81af3ef927ba7ab42ef9884e2869d5f832f1d

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

module PoolParty    
  class Git
        
    virtual_resource(:git) do
      
      def loaded(opts={})
        install_git
        has_git_repos
      end
      
      def install_git
        has_package(:name => "git-core")
      end
      
      def has_git_repos
        with_options(:requires => 'Package["git-core"]') do
          has_directory(:name => "#{path}")

          exec({:name => "git-#{name}"}) do
            command @parent.user ? "git clone #{@parent.user}@#{@parent.source} #{@parent.path}" : "git clone #{@parent.source} #{@parent.path}"
            cwd "#{::File.dirname(@parent.path) if @parent.path}"
            creates "#{@parent.path}"
          end

          exec(:name => "git-update-#{name}", :cwd => "#{path}") do
            command "git pull"
            requires "Exec['git-#{@parent.name}']"
          end

          if symlink
            has_file(:name => "#{symlink}") do
              ensures @parent.path
            end
          end
        end
      end
      
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auser-poolparty-0.2.6 lib/poolparty/plugins/git.rb