aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sorbot.cabal1
-rw-r--r--src/Plugin.hs9
-rw-r--r--src/Plugin/GitHubCommit.hs13
3 files changed, 15 insertions, 8 deletions
diff --git a/sorbot.cabal b/sorbot.cabal
index a581bea..26e2db9 100644
--- a/sorbot.cabal
+++ b/sorbot.cabal
@@ -18,6 +18,7 @@ library
exposed-modules: Lib
, Plugin
, Plugin.Base
+ , Plugin.GitHubCommit
build-depends: base >= 4.7 && < 5
, regex-tdfa
default-language: Haskell2010
diff --git a/src/Plugin.hs b/src/Plugin.hs
index 41b0296..da38943 100644
--- a/src/Plugin.hs
+++ b/src/Plugin.hs
@@ -7,6 +7,7 @@ module Plugin
import Text.Regex.TDFA
import Plugin.Base
+import Plugin.GitHubCommit
matchPlugin :: String -> Maybe Plugin
matchPlugin message = firstPlugin $ matchPlugins message plugins
@@ -20,14 +21,6 @@ matchPlugins message plugins = [p | p <- plugins, message =~ matchRegex p]
performPlugin :: Plugin -> String -> String
performPlugin p message = perform p $ message =~ matchRegex p
-gitHubCommit = Plugin
- { matchRegex = "^[0-9a-f]{40}$"
- , perform = gitHubCommitAction
- }
-
-gitHubCommitAction :: PluginAction
-gitHubCommitAction match = "https://github.com/" ++ match
-
plugins :: [Plugin]
plugins =
[ gitHubCommit
diff --git a/src/Plugin/GitHubCommit.hs b/src/Plugin/GitHubCommit.hs
new file mode 100644
index 0000000..24c4831
--- /dev/null
+++ b/src/Plugin/GitHubCommit.hs
@@ -0,0 +1,13 @@
+module Plugin.GitHubCommit
+ ( gitHubCommit
+ ) where
+
+import Plugin.Base
+
+gitHubCommit = Plugin
+ { matchRegex = "^[0-9a-f]{40}$"
+ , perform = gitHubCommitAction
+ }
+
+gitHubCommitAction :: PluginAction
+gitHubCommitAction match = "https://github.com/" ++ match