Sha256: ab0517a0a7a8dba0a2b9b8e8c7c5ee913d149758deccae4e5a5a81b297d5d866

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

module Docman
  class CleanChangedCmd < Docman::Command

    register_command :clean_changed

    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 File.directory? @context['full_build_path']
        if @context.need_rebuild?
          return false if @context['type'] == 'dir'
          return false if @context['type'] == 'root' and @context['build_type'] == :dir_builder and not GitUtil.repo?(@context['full_build_path'])
          return false if @context['type'] == 'root' and @context['build_type'] == :git_direct_builder and GitUtil.repo?(@context['full_build_path'])
          if @context['type'] == 'repo'
            if @context['build_type'] == :dir_direct_builder
              return false if GitUtil.repo?(@context['full_build_path'])
            end
          end
          log("Remove #{@context['full_build_path']}")
          FileUtils.rm_rf @context['full_build_path']
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
docman-0.0.12 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.11 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.10 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.9 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.8 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.7 lib/docman/commands/clean_changed_cmd.rb