Sha256: 5377d4d3afbd52ab69c385809950b95a2edf28e959c157c56395dd7f7964be44

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module Docman
  module Builders
    class GitStripBuilder < Builder

      register_builder :git_strip_builder


      def execute
        FileUtils.rm_r(@context['full_build_path']) if File.directory? @context['full_build_path']
        FileUtils.rm_r @context['temp_path'] if @context.need_rebuild? and File.directory? @context['temp_path']
        result = GitUtil.get(@context['repo'], @context['temp_path'], @context.version_type, @context.version)
        FileUtils.mkdir_p(@context['full_build_path'])
        FileUtils.cp_r(Dir["#{@context['temp_path']}/."], @context['full_build_path'])
        FileUtils.rm_r(File.join(@context['full_build_path'], '.git')) if File.directory?(File.join(@context['full_build_path'], '.git'))
        # GitUtil.repo_changed?(@context['full_build_path']) ? result : false
        result
      end

      def changed?
        stored_version = @context.stored_version['result']
        repo_version = GitUtil.get(@context['repo'], @context['temp_path'], @context.version_type, @context.version)
        stored_version != repo_version
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docman-0.0.6 lib/docman/builders/git_strip_builder.rb