Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git on WebApp with Perl
Search
hakobe (Yohei Fushii)
March 17, 2012
Programming
1
3.8k
Git on WebApp with Perl
Git リポジトリを表示したり操作したりするアプリケーションをPerlで作成する方法について開設します。
hakobe (Yohei Fushii)
March 17, 2012
Tweet
Share
More Decks by hakobe (Yohei Fushii)
See All by hakobe (Yohei Fushii)
はてなにおけるプログラミング言語の歴史とこれから
hakobe
0
640
ざっとわかるPython
hakobe
4
6.8k
はてなで一人前のエンジニアになる方法
hakobe
3
6.7k
契約による設計の紹介
hakobe
6
20k
アクターによる 並行処理アプケーション アーキテクチャ
hakobe
4
3.4k
Scala In Perl Company
hakobe
11
12k
TDDの練習 Coding Kata の実践
hakobe
0
1.4k
なめらかにGHEに移行する方法
hakobe
19
7.7k
開発フロー@はてなブックマーク
hakobe
0
150
Other Decks in Programming
See All in Programming
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
340
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
900
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
240
Quine, Polyglot, 良いコード
qnighy
4
650
React への依存を最小にするフロントエンド設計
takonda
1
230
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Jakarta EE meets AI
ivargrimstad
0
620
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
33
2.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
Site-Speed That Sticks
csswizardry
0
28
Become a Pro
speakerdeck
PRO
25
5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
What's in a price? How to price your products and services
michaelherold
243
12k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Being A Developer After 40
akosma
87
590k
Speed Design
sergeychernyshev
25
620
Music & Morning Musume
bryan
46
6.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Transcript
(JUPO8FC"QQ JEIBLPCF XJUI1FSM
ࣗݾհ ͜ JEIBLPCF!IBLPCF גࣜձࣾͯͳΤϯδχΞ IUUQIBLPCFIBUFOBCMPHDPN
Ξχϝ࠷࣮گΫϥελ wΞχϝؔ͋Δͷ͜͜·Ͱ
(JUPO8FC"QQ XJUI1FSM
HJU
(JUPO8FC"QQ (JUϦϙδτϦϒϥβ HJUIVC HJUXFC DHJU
(JU-BC (JUB-JTU (JUPSJDJPVT
(JUϒϥβJO)BUFOB ͚ࣾ(JUϦϙδτϦϒϥβ DPNNJUEJ⒎Λ63-ͰࢦఆͰ͖ΔͷͰ ίʔυϨϏϡʔਐߦ֬ೝʹॏๅ 3VCZͰॻ͔ΕͯΔ࠷ۙϝϯς͕
ίʔυʹؔ͢Δใίϛϡχέʔ γϣϯͱίʔυ͕ࢄ͕ͪ͠
)BUFOB$PEF'SJEHF ͚ࣾ(JUϦϙδτϦϒϥβ 1FSMͰ͔͔ΕͯΔʂϝϯςͰ͖Δ ϥϑʹίϛϡχέʔγϣϯͰ͖ͨΓ ߹॓Ͱ͍Ͱ࡞ͬͨ
(JUXJUI1FSM
ϓϩάϥϜ͔Βͷ(JU MJCHJU IUUQMJCHJUHJUIVCDPN $Ͱॻ͔Εͨ(JUૢ࡞ϥΠϒϥϦ lBWBJMBCMFBTCJOEJOHTGPSBMM NBKPSTDSJQUJOHMBOHVBHFTz
3VCZ0CKFDUJWF$1ZUIPO/FU1)1 -VB%FMQIJOPEFKTHP&SMBOHQBSSPU
1FSM͔Βͷ(JU HJUίϚϯυͷXSBQQFS ෦ͰHJUίϚϯυΛ࣮ߦ͢Δʂ wεέʔϧͤ͞Δͷ͍͠ wͱ͍͑ɺ͍͍ͩͨͳΜͰͰ͖Δ ͜Ε·Ͱͷࣾ(JUϦϙδτϦ ϒϥβշదʹ͑ͯΔ
1FSM͔Βͷ(JU ❖Git.pm HJUʹଐͯ͠Δ $1"/Ϟδϡʔϧ͡Όͳ͍ ❖Git::Class/Git::Wrapper JOUFSBDUJWFͳίϚϯυ͕͑ͳ͍ ❖Git::Repository
"1*͕γϯϓϧͰׂΓͬͯΔ JOUFSBDUJWFͳίϚϯυ͕͑Δ TFFIUUQTFBSDIDQBOPSHdCPPL(JU3FQPTJUPSZMJC(JU 3FQPTJUPSZQN05)&3@1&3-@(*5@83"11&34
(JU3FQPTJUPSZ 1 use Git::Repository; 2 3 # ϦϙδτϦͷࢦఆ 4 my
$git; 5 $git = Git::Repository->new( 6 git_dif => '/path/to/.git' ); 7 $git = Git::Repository->new( 8 work_tree => '/path/to/working_copy' ); 9 18
(JU3FQPTJUPSZ 10 # ίϚϯυͷ࣮ߦ 11 my $status = $git->run('status'); 12
my @diff = $git->run('diff', 'HEAD^...HEAD'); 13 14 # ίϚϯυͷ࣮ߦ࣌ʹೖग़ྗΛ੍ޚ 15 my $cmd = $git->command('add', '-p', '-u'); 16 $cmd->stdout; 17 $cmd->stdin; 18
(JU3FQPTJUPSZ ϦϙδτϦͷॴΛࢦఆ͢Δͱ HJUίϚϯυ͕࣮ߦͰ͖Δ SVODPNNBOE ࣮ߦ݁ՌࣗͰॲཧ͢Δ ݁ՌΛؾ߹Ͱύʔε
wSBXϞʔυͱ͔Λ׆༻
CSBODIS 1 use Git::Repository; 2 3 my $git; 4 $git
= Git::Repository->new( 5 git_dif => '/path/to/.git' ); 6 7 my @branches = 8 map { $_ =~ s/\s+//g; $_ } 9 $self->git->run('branch', '-r'); 10 origin/fix_bug origin/workerenchance origin/xpath_entryimage
EJ⒎ ύʔεུ 1 diff --git a/lib/Guita/Mapper/Git.pm b/lib/Guita/Mapper/Git.pm 2 index 9ee4a36..5dd6ed5
100644 3 --- a/lib/Guita/Mapper/Git.pm 4 +++ b/lib/Guita/Mapper/Git.pm 5 @@ -226,4 +226,9 @@ sub ls_tree { 6 return $results; 7 } 8 9 +sub config { 10 + my $self = shift; 11 + $self->git->run('config', @_); 12 +} 13 + 14 1; 15 diff --git a/lib/Guita/Pick.pm b/lib/Guita/Pick.pm 16 index 4c37820..29f75cb 100644 17 --- a/lib/Guita/Pick.pm 18 +++ b/lib/Guita/Pick.pm 19 @@ -37,10 +37,14 @@ sub create { 20 Guita::Git->run(init => $work_tree->stringify);
࣮ߦ݁Ռͷॲཧ (JU3FQPTJUPSZ1MVHJOΛ͏ HJUMPHͷΑ͏ͳϝιου͕Ճ ͦΜͳʹΓ্͕ͬͯͳ͍ wMPHCMBNFͷΈ ඞཁʹԠͯࣗ͡Ͱॻ͘
݁Ռͷѻ͍ΞϓϦέʔγϣϯґଘ
ࢀߟ SVCZHJU IUUQTHJUIVCDPNTDIBDPOSVCZ HJU 3VCZͷHJUίϚϯυXSBQQFSܥͷ Ϟδϡʔϧ
(VJUB ❖Guita::Mapper::Git - add/commit/tree/blob/logs/diff/ rev_parse/branch/cat_file/ls_tree (JU0CKFDUʹରԠ͢ΔΦϒδΣΫτ wCMPCUSFFDPNNJU IUUQTHJUIVCDPNIBLPCF(VJUB
(VJUB HJTUDMPOF ͚ࣾHJTU΄͍͠͠࡞ͬͨ ̋1FSMͰॻ͔ΕͯΔ ✕MJCHJUͬͯͳ͍
͍͍ͨͻͱ͓͓͔ͬͨΒؤுΓ͍ͨ σϞ IUUQTHJUIVCDPNIBLPCF(VJUB
·ͱΊ (JUΛϓϩάϥϜ͔Βૢ࡞͍ͨ͠ ࣾ(JUϦϙδτϦ࡞Δͱ͔ MJCHJU1FSMͰ͑ͳ͍ (JUܥϞδϡʔϧ(JU3FQPTJUPSZ ͓͢͢Ί
(VJUB HJTUDMPOF ·ͣࣾͱ͔ͰͬͯΈΔ