Sha256: 4d847487b1c42966818282a0f19c0ad7ca19bd27fe3347df1d5a51bf1d520ada

Contents?: true

Size: 1.38 KB

Versions: 11

Compression:

Stored size: 1.38 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

    #TODO: Keep files feature
    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'])
          return false if @context['type'] == 'root_chain' and @context['build_type'] == :git_direct_builder and GitUtil.repo?(@context['full_build_path'])
          return false if @context['type'] == 'root_chain' and @context['build_type'] == :git_root_chain_builder and GitUtil.repo?(@context['full_build_path'])
          if @context['type'] == 'repo'
            if @context['build_type'] == :git_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

11 entries across 11 versions & 1 rubygems

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