パルカワ2

最近はFlutterをやっています

Malts::Setup

俺得フレームワークMaltsのMalts::Setupの話。
Maltsのskeleton generatorです。まだpushしてないけど!

$ malts init ModuleName TemplateName

という感じでDist::Makerっぽく出来ます。

Maltsは俺得フレームワークなので、Defalutテンプレートは"俺がハッピーやったらええんや!!!"と振り切り、完全に俺得仕様となっております。
Procletだったり、Config::ENVだったり、Fluent::Loggerだったり、Cache::Memcached::IronPlateだったり、MyApp::Exceptionだったりを使ったり、作ったりしております。

Defalutテンプレートが気に入らない人は、 https://github.com/hisaichi5518/malts-template のように適当に試しながらテンプレートを作って、以下のコマンドを打てばテンプレートが良い感じに作られます。画像にも対応しております。

$ malts new_temaplte --dir=./template_dir --module=Malts::Setup::Template::TemplateName

Dist::Makerのnewが非常に便利なのでそれをパクりたかったのと複数に対応したかったのでmalts newもあります。
malts init Hogeして、cd Hogeしたあとにmalts new --tag=controller Userでlib/Hoge/Web/Controller/User.pmとかテストとかを元のテンプレを見て一気に作るようにしますた。

$ malts init MyApp
create the MyApp/t/Util.pm.
create the MyApp/lib/MyApp/Web/Controller/Root.pm.
...(略)

$ cd MyApp

$ malts new --tag=controller User
create the lib/MyApp/Web/Controller/User.pm.
create the t/controller/user.t
...(略)

tagはmodelにも対応しているし、自分でtagを増やす事もプロジェクト毎に出来る。
ただしかし、ちょっと無理矢理感ある実装な気がしております。

ほとんど一緒でいいような部分はMaltsでやり、それ以外はskeleton generatorに任せると互換性気にしないでいいので、結構良い感じになるのではと思う。

この記事、とりあえず書いてみた感ある!!!!!!!