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
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
Recoilを剥がしている話
kirik
5
6.6k
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
700
Zoneless Testing
rainerhahnekamp
0
120
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
110
Beyond ORM
77web
1
160
testcontainers のススメ
sgash708
1
120
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
fs2-io を試してたらバグを見つけて直した話
chencmd
0
220
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Designing for Performance
lara
604
68k
A designer walks into a library…
pauljervisheath
204
24k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Bash Introduction
62gerente
608
210k
Speed Design
sergeychernyshev
25
670
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
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 ·ͣࣾͱ͔ͰͬͯΈΔ