lib/sitefuel/external/GIT.rb in sitefuel-0.0.0b vs lib/sitefuel/external/GIT.rb in sitefuel-0.1.0a
- old
+ new
@@ -1,9 +1,56 @@
#
# File:: GIT.rb
# Author:: wkm
-# Copyright:: 2009
-# License:: GPL
+# Copyright:: 2009, Zanoccio LLC.
+# License:: GPL version 2.0 (see LICENSE.rb)
#
# Wrapper around the git version control system.
#
-#
+
+module SiteFuel
+ module External
+
+ require 'sitefuel/external/AbstractExternalProgram'
+
+ # defines a wrapper around the Git version control system
+ # this wrapper is designed to only handle
+ class GIT < AbstractExternalProgram
+
+ def self.program_name
+ 'git'
+ end
+
+ # this would probably work with
+ def self.compatible_versions
+ '> 1.4'
+ end
+
+ # creates a new repository from an existing git repository
+ option :clone, 'clone'
+
+ # sets the source from which to read repository data
+ option :source, '${value}'
+
+ # specify a depth for a shallow clone
+ option :depth, '--depth ${value}', 1
+
+ # specifies an output directory for git
+ option :output, '${value}'
+
+ # creates a shallow clone of an existing repository
+ def self.shallow_clone(source, directory = nil, depth=1)
+ if directory == nil
+ directory = create_tmp_directory('git')
+ end
+
+ execute :clone,
+ :depth, depth,
+ :source, source,
+ :output, directory
+
+ directory
+ end
+
+ end
+ end
+end
\ No newline at end of file