Plagger実行中にconfigを対話的に入力するプラグイン - ヒルズで働く@robarioの技ログ
åã¨ã³ããªãé·ãã®ã§æ°è¦ã¨ã³ããªã§ãã
パスワードを対話的に聞くのはlib/Plagger/Crypt/Prompt.pmってのを作ればいいんじゃね? - otsune's SnakeOil - subtech
ãã©ãã¯ããã¯ãããã¨ããããã¾ããï¼
åæ¡ã ã¨æã£ãã®ã§ã¡ãã£ã¨æ¸ãã¦ã¿ãã®ã§ããè²ã
åé¡ãåºã¦ãã¾ãã¾ããã
decryptã¯passwordãã£ã¼ã«ãã§ããå¼ã³åºããã¾ããã
password以å¤ã®ãã£ã¼ã«ãã対話å
¥åããããã¨ãããã®ã§ã$plagger->{conf}ã®å
¨èµ°æ»ãå¿
è¦ã«ãªã£ã¦ãã¾ãã¾ãã
ã¤ã¾ãã対話å
¥åããããã£ã¼ã«ãå
¨ã¦ã«ä½ãç®å°ãä»ããå¿
è¦ãããã¾ãã
$plagger->{conf}ã¯hashrefãªã®ã§é çªãå¶å¾¡ãããã¨ãã§ãã¾ããã
è¨å®ã«orderãå ããå¿ è¦ãããã¾ãã
ãªããIO::Promptã§ã¯ãªãTerm::ReadKeyã使ã£ã¦ããã®ã¯ãTerm::ReadKeyã¯CPAN::Shellã§å©ç¨ãããã®ã§å ¥ã£ã¦ããå¯è½æ§ãé«ãã¨æã£ãããã§ãã
id:otsuneããã®æè¦ãåèã«ãPlagger::Plugin#decrypt_configã®ããä¸ã¤ä¸ã®Plagger::Plugin::do_walkãä¸æ¸ãããå½¢ã§ãã£ã¦ã¿ã¾ãããã¨ãããã以ä¸ã®ãããªconfigã§åãããã«ã¯ãªã£ã¦ãã¾ãï¼ããã§ããªãã®ã§å
¬éã¯ãã¾ãããï¼
id:miyagawaããã«æãããããªã¼ã¨æã£ã¦Plagger::Plugin::Acme::*以ä¸ã«ç§»åãã¦ãã¾ãã
plugins: - module: Acme::CustomConfig - module: Subscription::LivedoorReader config: username: Acme::CustomConfig::ReadLine: prompt: What is your LDR username? default: holidays_l order: 1 password: Acme::CustomConfig::ReadPassword: prompt: What is your LDR password? default: abc123 order: 2 mark_read: 0
åä½ã¯ããã®ã§ãããpasswordãã£ã¼ã«ããæ®ã£ãã¾ã¾ã«ãªã£ã¦ãã¾ã£ã¦Plagger [error] password: ******** not found in test.yaml ãªã©ã¨è¨ããã¦ãã¾ãã®ã§èª¿æ´ä¸ã§ããããã¡ãã£ã¨ãã·ãªconfigæ¸ããããã«ãªããªãã§ããããã¨ããç¬ãè¨ã