class Danger::DangerClubhouse

This is your plugin class. Any attributes or methods you expose here will be available from within your Dangerfile.

To be published on the Danger plugins site, you will need to have the public interface documented. Danger uses [YARD](yardoc.org/) for generating documentation from your plugin source, and you can verify by running `danger plugins lint` or `bundle exec rake spec`.

You should replace these comments with a public description of your library.

@example Ensure people are well warned about merging on Mondays

my_plugin.warn_on_mondays

@see Teng Siong Ong/danger-clubhouse @tags monday, weekends, time, rattata

This plugin will detect stories from clubhouse and link to them.

@example Customize the clubhouse organization and check for stories to link to them.

clubhouse.organization = 'organization'
clubhouse.link_stories!

@see siong1987/danger-clubhouse @tags clubhouse

Attributes

organization[RW]

The clubhouse organization name, you must set this!

@return [String]

Public Instance Methods

find_story_id(body) click to toggle source

Find clubhouse story id in the body

@return [String, nil]

# File lib/clubhouse/plugin.rb, line 58
def find_story_id(body)
  if (match = body.match(/ch(\d+)/))
    return match[1]
  end

  nil
end

Private Instance Methods

messages() click to toggle source
# File lib/clubhouse/plugin.rb, line 76
def messages
  git.commits.map(&:message)
end
post!(story_ids) click to toggle source
# File lib/clubhouse/plugin.rb, line 68
def post!(story_ids)
  message = "### Clubhouse Stories\n\n"
  story_ids.each do |id|
    message << "* [https://app.clubhouse.io/#{organization}/story/#{id}](https://app.clubhouse.io/#{organization}/story/#{id}) \n"
  end
  markdown message
end