Sha256: 11561c34b77b00b4eba1a4d1ee1d78f0677b395d306da1e025bafde0e8ccaf28

Contents?: true

Size: 1.11 KB

Versions: 15

Compression:

Stored size: 1.11 KB

Contents

namespace :ci do
  namespace :rugged do
    desc 'Setup Rugged, get the current commit and friendly version of the revision name'
    task :setup do
      require 'ndr_dev_support/daemon/ci_server'

      @repo = Rugged::Repository.new('.')
      @commit = @repo.lookup(@repo.head.target_id)
      @friendly_revision_name = NdrDevSupport::Daemon::CIServer.friendly_revision_name(@commit)
    end

    desc 'Show details of the commit and make it the first attachment'
    task commit_details: :setup do
      fields = [
        { title: 'Author', value: @commit.author[:name], short: true },
        { title: 'Revision', value: @friendly_revision_name, short: true }
      ]

      if File.exist?('.ruby-version')
        fields << {
          title: 'Target Ruby Version',
          value: File.read('.ruby-version').chomp,
          short: true
        }
      end

      attachment = {
        fallback: @commit.message,
        text: @commit.message,
        fields: fields,
        ts: @commit.author[:time].to_i
      }

      @attachments ||= []
      @attachments.unshift(attachment)
      puts attachment.inspect
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ndr_dev_support-5.1.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.0.1 lib/tasks/ci/rugged.rake
ndr_dev_support-5.0.0 lib/tasks/ci/rugged.rake
ndr_dev_support-4.2.1 lib/tasks/ci/rugged.rake
ndr_dev_support-4.2.0 lib/tasks/ci/rugged.rake
ndr_dev_support-4.1.3 lib/tasks/ci/rugged.rake
ndr_dev_support-4.1.2 lib/tasks/ci/rugged.rake
ndr_dev_support-4.1.1 lib/tasks/ci/rugged.rake
ndr_dev_support-4.1.0 lib/tasks/ci/rugged.rake
ndr_dev_support-4.0.0 lib/tasks/ci/rugged.rake
ndr_dev_support-3.1.3 lib/tasks/ci/rugged.rake
ndr_dev_support-3.1.2 lib/tasks/ci/rugged.rake
ndr_dev_support-3.1.1 lib/tasks/ci/rugged.rake
ndr_dev_support-3.1.0 lib/tasks/ci/rugged.rake
ndr_dev_support-3.0.0 lib/tasks/ci/rugged.rake