Sha256: 35d6ac38631563264c2ea823a5d69ae327096d73d7b936eb60be1e5d249967b1

Contents?: true

Size: 1.52 KB

Versions: 26

Compression:

Stored size: 1.52 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'] == 'single' and @context['build_type'] == :copy_builder and not GitUtil.repo?(@context['full_build_path'])
          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'] == :direct_builder and GitUtil.repo?(@context['full_build_path'])
          return false if @context['type'] == 'root_chain' and @context['build_type'] == :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'] == :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

26 entries across 26 versions & 1 rubygems

Version Path
docman-0.0.107 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.106 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.105 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.104 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.103 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.102 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.101 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.100 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.99 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.98 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.97 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.96 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.95 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.94 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.93 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.92 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.91 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.90 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.89 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.88 lib/docman/commands/clean_changed_cmd.rb