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.49 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.48 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.47 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.46 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.45 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.44 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.43 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.42 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.41 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.40 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.39 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.38 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.37 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.36 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.35 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.34 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.33 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.32 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.31 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.30 lib/docman/commands/clean_changed_cmd.rb