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.29 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.28 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.27 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.26 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.25 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.24 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.23 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.22 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.21 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.20 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.19 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.18 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.17 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.16 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.15 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.14 lib/docman/commands/clean_changed_cmd.rb
docman-0.0.13 lib/docman/commands/clean_changed_cmd.rb