summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua-wshop2013.pin62
1 files changed, 41 insertions, 21 deletions
diff --git a/lua-wshop2013.pin b/lua-wshop2013.pin
index 11cf886..6f52908 100644
--- a/lua-wshop2013.pin
+++ b/lua-wshop2013.pin
@@ -4,6 +4,7 @@
[center]
[font=Sans 50px]
[stretch]
+[duration=20]
-- [backing-cat-flop.png]
@@ -37,19 +38,14 @@ Technology choices
# although Gitano *can* operate without them
# cgit rather than gitweb - much faster, caches, prettier
-# 6. Future - explain how background task stuff looks plausible using the
-# nanomsg stuff recently talked about on list. Explain how currently I'm
-# testing Gitano using a testing tool written in Python, but want to write
-# a Lua equivalent of it.
-
-- [backing-cat-sunbathing.png]
Gall - Git Abstraction Layer (in) Lua
# Git abstraction - obviously necessary. Uses Luxio's
# subprocess to run git commandline and luagit2/libgit2 via
-# LuaNativeObjects to work in process. Show a simple
-# example
+# LuaNativeObjects by Robert G. Jakabosky to work in
+# process.
-- [backing-cat-sunbathing.png] [font=Monospace 50px]
@@ -201,7 +197,7 @@ Proxying values (incl. functions and tables)
local repo, ref, oldsha, newsha = ...
local branch = ref:match("^refs/heads/(.+)$")
-if branch then
+if branch == "master" then
log.state("Looking at commit history on: " .. branch)
local commit = repo:get(newsha)
@@ -220,12 +216,15 @@ else
log.state("Skipping commit history check on: " .. ref)
end
+# Non-trivial example which shows an update hook for Gitano
+# to prevent non-merge commits when pushing to master
+
-- [font=Monospace 50px]
local <span foreground="green" font_weight="heavy">repo, ref, oldsha, newsha = ...</span>
local branch = ref:match("^refs/heads/(.+)$")
-if branch then
+if branch == "master" then
<span foreground="red" font_weight="heavy">log</span>.state("Looking at commit history on: " .. branch)
local commit = repo:get(newsha)
@@ -244,23 +243,27 @@ else
<span foreground="red" font_weight="heavy">log</span>.state("Skipping commit history check on: " .. ref)
end
+# Green is input arguments for the hook, passed in by the host app
+#
+# Red is an example of a module table passed over from the host
+
-- [font=Monospace 50px]
local repo, ref, oldsha, newsha = ...
local branch = ref:match("^refs/heads/(.+)$")
-if branch then
+if branch == "master" then
<span foreground="yellow" font_weight="heavy">log.state(</span>"Looking at commit history on: " .. branch)
local commit = <span foreground="yellow" font_weight="heavy">repo:get(</span>newsha)
- while <span foreground="red" font_weight="heavy">commit.sha</span> ~= oldsha do
- commit = <span foreground="red" font_weight="heavy">commit.content</span>
- local parents = <span foreground="red" font_weight="heavy">commit.parents</span>
+ while <span foreground="#4040ff" font_weight="heavy">commit.sha</span> ~= oldsha do
+ commit = <span foreground="#4040ff" font_weight="heavy">commit.content</span>
+ local parents = <span foreground="#4040ff" font_weight="heavy">commit.parents</span>
if #parents &#60; 2 then
- error("Detected non-merge-commit during parent walk, at " .. <span foreground="red" font_weight="heavy">commit.sha</span>)
+ error("Detected non-merge-commit during parent walk, at " .. <span foreground="#4040ff" font_weight="heavy">commit.sha</span>)
end
- commit = <span foreground="red" font_weight="heavy">parents[1]</span>
+ commit = <span foreground="#4040ff" font_weight="heavy">parents[1]</span>
end
<span foreground="yellow" font_weight="heavy">log.state(</span>"Commits between old and new sha seem to all be merge commits")
@@ -268,12 +271,18 @@ else
<span foreground="yellow" font_weight="heavy">log.state(</span>"Skipping commit history check on: " .. ref)
end
+# Here, blue are simple table lookups which propagate
+# across the link to the host
+#
+# And yellow are function invocations which call functions
+# in the host
+
-- [font=Monospace 50px]
local repo, ref, oldsha, newsha = ...
local branch = ref:match("^refs/heads/(.+)$")
-if branch then
+if branch == "master" then
log.state("Looking at commit history on: " .. branch)
local commit = repo:get(newsha)
@@ -292,6 +301,13 @@ else
log.state("Skipping commit history check on: " .. ref)
end
+# Purple is a call to error
+
+# Explain how errors propagate back and forth across the
+# link, obeying pcalls and trying to gather stack info for
+# both sides. Also note that the host can extract extra
+# debugging about the entire supple transaction.
+
-- [backing-cat-shocked.png]
Real users of Gitano
@@ -308,14 +324,18 @@ Real users of Gitano
Future plans
-Lots of ideas for future content, see the Trello
+Lots of ideas for future content, see the Trello for
+some of the things I have planned.
- - https://trello.com/b/l4Id6iiC/gitanow
+ - https://trello.com/b/l4Id6iiC/gitano
- (Link is on www.gitano.org.uk)
-# I would welcome contributions to Gitano or the libraries
-# behind it. I would especially welcome contributions which
-# increase the scenario test suite coverage.
+# Future - explain how background task stuff looks plausible
+# using the nanomsg stuff recently talked about on list.
+# Explain how currently I'm testing Gitano using a testing
+# tool written in Python, but want to write a Lua equivalent
+# of it.
+
-- [backing-cat-sat.png]