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
C++でシェーダを書く
fadis
6
4.1k
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
600
Jakarta EE meets AI
ivargrimstad
0
510
Jakarta EE meets AI
ivargrimstad
0
580
最新TCAキャッチアップ
0si43
0
140
RubyLSPのマルチバイト文字対応
notfounds
0
120
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
530
Jakarta Concurrencyによる並行処理プログラミングの始め方 (JJUG CCC 2024 Fall)
tnagao7
1
290
Featured
See All Featured
Building Applications with DynamoDB
mza
90
6.1k
A better future with KSS
kneath
238
17k
The Pragmatic Product Professional
lauravandoore
31
6.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
730
The Language of Interfaces
destraynor
154
24k
Happy Clients
brianwarren
98
6.7k
Being A Developer After 40
akosma
86
590k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
We Have a Design System, Now What?
morganepeng
50
7.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
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 ·ͣࣾͱ͔ͰͬͯΈΔ