class Docman::GitRepoProvider

Attributes

version[R]

Public Instance Methods

changed?() click to toggle source
# File lib/docman/commands/git_repo_provider_cmd.rb, line 19
def changed?
  stored_version = @context.stored_version['result']
  @last_version = GitUtil.last_revision(self['target_path'])
  # TODO: diff with remote instead of get
  v = version(true)
  stored_version != v
end
changed_from_last_version?() click to toggle source
# File lib/docman/commands/git_repo_provider_cmd.rb, line 33
def changed_from_last_version?
  @last_version != @version
end
execute() click to toggle source
# File lib/docman/commands/git_repo_provider_cmd.rb, line 13
def execute
  @execute_result = get_content
  # No commit hash for 'root' as it will be changed later
  @version = @context['type'] == 'root' ? @context['build_path'] : @execute_result
end
get_content() click to toggle source
# File lib/docman/commands/git_repo_provider_cmd.rb, line 27
def get_content
  single_branch = @context.has_key?("single_branch") ? @context["single_branch"] : true
  depth = @context.has_key?("depth") ? @context["depth"] : 1
  GitUtil.get(@context['repo'], self['target_path'], @context.version_type, @context.version, single_branch, depth)
end
validate_command() click to toggle source
# File lib/docman/commands/git_repo_provider_cmd.rb, line 8
def validate_command
  raise "Please provide 'context'" if @context.nil?
  raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
end