Sha256: 7f258f632a02d515441fdfff21a6f6a82371b311921ab16a659ccee13334a14b

Contents?: true

Size: 940 Bytes

Versions: 4

Compression:

Stored size: 940 Bytes

Contents

module Docman
  module Builders
    class GitProviderBuilder < ProviderBuilder

      register_builder :git_provider_builder

      def prepare_build_dir
        FileUtils.mkdir_p(@context['full_build_path'])
      end

      def build_with_provider
        `find #{@context['full_build_path']} -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} \\;` if File.directory? @context['full_build_path']
        FileUtils.rm_r self['target_path'] if @context.need_rebuild? and File.directory? self['target_path']
        result = @provider.perform
        `rsync -a --exclude '.git' #{self['target_path']}/. #{@context['full_build_path']}`
        result
      end

      def changed_from_last_version?
        @provider.changed_from_last_version?
      end

      def execute
        prepare_build_dir
        @execute_result = build_with_provider
        changed_from_last_version? ? @execute_result : false
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
docman-0.0.106 lib/docman/builders/git_provider_builder.rb
docman-0.0.105 lib/docman/builders/git_provider_builder.rb
docman-0.0.104 lib/docman/builders/git_provider_builder.rb
docman-0.0.103 lib/docman/builders/git_provider_builder.rb