Sha256: 3d31d0b4747b175540204149a297463a958fde16718b74adba3467c1651cf7d7

Contents?: true

Size: 723 Bytes

Versions: 1

Compression:

Stored size: 723 Bytes

Contents

module Docman
  class GitCommitCmd < Docman::Command

    register_command :git_commit

    def validate_command
      raise "Please provide 'context'" if @context.nil?
      raise "Context should be of type 'Info'" unless @context.is_a? Docman::Info
    end

    before_execute do
      unless GitUtil.repo_changed? @context['root']['full_build_path']
        raise NoChangesError, "Repo not changed, commit not needed" unless @context.need_rebuild?
      end
    end

    def execute
      message = "name: #{@context['name']} updated, state: #{@context['state']}"
      with_logging(message) do
        GitUtil.commit(@context['root']['full_build_path'], @context['full_build_path'], message)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docman-0.0.14 lib/docman/commands/git_commit_cmd.rb