LoginSignup
0
0

More than 5 years have passed since last update.

Ruboty | Ruboty Handler Plugin 作成時の README テンプレートジェネレータ ruboty-megen を作成した #ruboty

Last updated at Posted at 2014-11-09

Ruboty | Ruboty Handler Plugin 作成時の README テンプレートジェネレータ ruboty-megen を作成した #ruboty

概要

Ruboty Handler Plugin 作成時の README テンプレートジェネレータ ruboty-megen を作成した

用途

Ruboty の Handler Plugin を作成する際、大抵の方は bundle gem を利用しておられると思います。
しかし、 bundle gem がデフォルトで出力する README に含まれるのは

  • Installation
  • Usage
  • Contribution

のみです。

Ruboty の Handler Plugin を作成時、例えば下記のような内容はテンプレートとして出力したほうが良い気がします。

  • Commands
    • 利用可能なコマンドの一覧。 patterns, description, name を記載
  • ENV
    • 利用する環境変数の説明を記載
  • Dependency
    • 外部 API 利用時など、依存先の情報(APIのドキュメントへのリンクなど)を記載

これによって、毎回記述する項目を手で記述する手間がなくなり、 このジェネレータが普及するほど
Handler Plugin 開発者の README のフォーマットが統一されます。

設定

内部DSL ( Rubotymegen ) によって設定を行います。

key value example
user_name github user 名 tbpgr
gem_class_name gem 名 Ume
gem_name gem 名 ume
title タイトル文字列 An Ruboty Handler + Actions to output N line messages.
env/name 環境変数 DEFAULT_UME_TEXT
env/description 環境変数の説明 default ume text
dependencies/name 依存先名称 Ume API
dependencies/description 依存先説明 ttp://ume.text.jp
commands/command name Ruboty::Handler.on の name に設定する内容 ※件数分 ume
commands/command pattern Ruboty::Handler.on の pattern に設定する内容 ※件数分 /ume (?.*?)\z/
commands/command description Ruboty::Handler.on の description に設定する内容 ※件数分 output empty message N lines ( times)

設定例

# encoding: utf-8
user_name "tbpgr"

gem_class_name "Ume"
gem_name "ume"

title "An Ruboty Handler + Actions to output N line messages."

env do |e|
  e.name "ENV1"
  e.description "ENV1 desc"
end

env do |e|
  e.name "ENV2"
  e.description "ENV2 desc"
end

dependency do |d|
  d.name "dependency2"
  d.description "dependency2 description"
end

command do |c|
  c.name "ume"
  c.pattern "/ume (?<count>.*?)\z/"
  c.description "output empty message N lines (<count> times)"
end

command do |c|
  c.name "umec"
  c.pattern "/umec (?<text>.+?) (?<count>.*?)\z/"
  c.description "output <text> message N lines (<count> times)"
end

出力例

sample output README

参照

ruboty-megen GitHub
ruboty-megen RubyGems
Ruboty関連記事

0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0