とりあえず

当初サイト毎にyamlを作ってそれをいちいち手動で実行していたのですが、いくらなんでも効率悪すぎなので一つの設定ファイルで全部実行できるようにしました。

どうもdefine_recipes:でやりたいことを定義して、include:およびrecipes:で呼び出すのが効率が良いみたいです。あまり参考にはなりませんが、とりあえず。

設定ファイル一覧

  • config.all.yaml(実際の実行ファイル)
  • config.base.yaml(全体の設定)
  • config.mixi.yaml(みくしぃ)
  • config.golgo31.yaml(ゴルゴさん)
  • config.katoyuu.yaml(カトゆーさん)

config.all.yaml

include:
 - config.base.yaml
 - config.golgo31.yaml
 - config.katoyuu.yaml
 - config.mixi.yaml

recipes:
 - golgo31
 - katoyuu
 - mixi
 - deduped
 - publish
 

config.base.yaml

global:
 assets_path: assets/

define_recipes:
  publish:
   - module: Publish::Gmail
     config:
       mailto: xxxxxx@gmail.com
       mailfrom: xxxxxx+plagger@gmail.com
       mailroute:
        via: smtp_tls
        host: smtp.gmail.com:587
        username: xxxxxx@gmail.com
        password: base64::xxxxxxxxxxxx

  deduped:
   - module: Filter::Rule
     rule:
      module: Deduped

config.mixi.yaml

define_recipes:
 mixi: 
  - module: CustomFeed::Mixi
    config:
     email: xxxxxx@xxx.jp
     password: base64::xxxxxxxxxxxx
     fetch_body: 1
     show_icon: 1

config.golgo31.yaml

define_recipes:
 golgo31:
  - module: Subscription::Config
    config:
      feed:
       - http://www.golgo31.net/

  - module: CustomFeed::Config

config.katoyuu.yaml

define_recipes:
 katoyuu:
  - module: Subscription::Config
    config:
        feed:
          - http://www6.ocn.ne.jp/~katoyuu/

  - module: CustomFeed::Config

で、

% ./plagger -c config.all.yaml 

ただ問題が2つあって、

  • module: Filter::Ruleの使い方が良く分かってないので、更新されてなくてもメールが届く
  • なぜかカトゆーさんのメールまでタイトルが「golgo31」になってしまう

なのであまり参考にはなりませんが、ここよりも以下のサイトが参考になると思います。

YAML初心者にありがちなこと

もし実行してエラーが出ても、何枚目の書類の何行目がおかしいと指摘してくれるので、よく見れば間違いを発見できるはず。大抵は

  • 半角スペースの入れ忘れ
  • 最後の改行の入れ忘れ

だと思うので、その点注意されると良いと思います…。