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
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
520
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Realtime API 入門
riofujimon
0
150
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
570
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.1k
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
860
現場で役立つモデリング 超入門
masuda220
PRO
15
3.2k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Building Applications with DynamoDB
mza
90
6.1k
Producing Creativity
orderedlist
PRO
341
39k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Speed Design
sergeychernyshev
24
610
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Why Our Code Smells
bkeepers
PRO
334
57k
Practical Orchestrator
shlominoach
186
10k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
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 ·ͣࣾͱ͔ͰͬͯΈΔ