Sha256: 8d7f61c3aeb254435ec5d93b1461ed2de52813e57f67858a459fe3c83874d6a3

Contents?: true

Size: 982 Bytes

Versions: 11

Compression:

Stored size: 982 Bytes

Contents

module Docman
  class GitCopyRepoContent < Docman::Command

    register_command :git_copy_repo_content

    def validate_command
      raise "Please provide 'context'" if @context.nil?
      raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
    end

    def execute
      if (self['remove_target'])
        FileUtils.rm_r(Dir["#{@context['full_build_path']}/*"]) if File.directory? @context['full_build_path']
      end
      FileUtils.rm_r @context['temp_path'] if @context.need_rebuild? and File.directory? @context['temp_path']
      @version = GitUtil.get(@context['repo'], @context['temp_path'], @context.version_type, @context.version, nil, nil)
      # FileUtils.rm_r(File.join(@context['temp_path'], '.git')) if File.directory?(File.join(@context['temp_path'], '.git'))
      FileUtils.mkdir_p(@context['full_build_path'])
      `rsync -a --exclude '.git' #{@context['temp_path']}/. #{@context['full_build_path']}`
      @version
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
docman-0.0.80 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.79 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.78 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.77 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.76 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.75 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.74 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.73 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.72 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.71 lib/docman/commands/git_copy_repo_content_cmd.rb
docman-0.0.70 lib/docman/commands/git_copy_repo_content_cmd.rb