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
650
ざっとわかるPython
hakobe
4
6.8k
はてなで一人前のエンジニアになる方法
hakobe
3
6.8k
契約による設計の紹介
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
160
Other Decks in Programming
See All in Programming
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
350
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
180
103 Early Hints
sugi_0000
1
220
Refactor your code - refactor yourself
xosofox
1
260
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
命名をリントする
chiroruxx
1
380
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
630
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
fs2-io を試してたらバグを見つけて直した話
chencmd
0
220
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
Facilitating Awesome Meetings
lara
50
6.1k
Automating Front-end Workflow
addyosmani
1366
200k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The Language of Interfaces
destraynor
154
24k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
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 ·ͣࣾͱ͔ͰͬͯΈΔ