Sha256: ed21c90431a49ab994d4a16e7572928b745dbed576af1a9fdc25bda7388b0dbd

Contents?: true

Size: 1.08 KB

Versions: 57

Compression:

Stored size: 1.08 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'])
          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

57 entries across 57 versions & 1 rubygems

Version Path
docman-0.0.69 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.68 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.67 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.66 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.65 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.64 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.63 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.62 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.61 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.60 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.59 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.58 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.57 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.56 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.55 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.54 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.53 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.52 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.51 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.50 lib/docman/commands/clean_changed_cmd.rb