Sha256: 6084a75190b269fac9976b4beb7072cb9f19de49addbb67885f5f3e1ce3ba8b7

Contents?: true

Size: 1.16 KB

Versions: 49

Compression:

Stored size: 1.16 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

      text = @commit.message.lines.grep_v(/\Agit-svn-id: /).join.strip

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

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

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
ndr_dev_support-6.1.0 lib/tasks/ci/rugged.rake
ndr_dev_support-6.0.4 lib/tasks/ci/rugged.rake
ndr_dev_support-6.0.3 lib/tasks/ci/rugged.rake
ndr_dev_support-6.0.2 lib/tasks/ci/rugged.rake
ndr_dev_support-6.0.1 lib/tasks/ci/rugged.rake
ndr_dev_support-6.0.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.10.2 lib/tasks/ci/rugged.rake
ndr_dev_support-5.10.1 lib/tasks/ci/rugged.rake
ndr_dev_support-5.10.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.9.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.8.2 lib/tasks/ci/rugged.rake
ndr_dev_support-5.8.1 lib/tasks/ci/rugged.rake
ndr_dev_support-5.8.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.7.1 lib/tasks/ci/rugged.rake
ndr_dev_support-5.7.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.6.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.5.0 lib/tasks/ci/rugged.rake
ndr_dev_support-5.4.8 lib/tasks/ci/rugged.rake
ndr_dev_support-5.4.7 lib/tasks/ci/rugged.rake
ndr_dev_support-5.4.6 lib/tasks/ci/rugged.rake