From 6048293876be38c8dd08c5a76e168f06d57ceaf7 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 19 Oct 2020 09:04:28 -0700 Subject: [PATCH] Add jenkinsfile-mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both ‘Jenkinsfile’ files and ‘*.pipeline’ files should be using ‘jenkinsfile-mode’. --- oni-groovy.el | 7 ++++-- test/integration/oni-groovy.bats | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 test/integration/oni-groovy.bats diff --git a/oni-groovy.el b/oni-groovy.el index cb6be5e..69036a8 100644 --- a/oni-groovy.el +++ b/oni-groovy.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2019.1210.230729 -;; Package-Requires: (groovy-mode groovy-imports rainbow-delimiters) +;; Version: 2020.1019.090337 +;; Package-Requires: (groovy-mode groovy-imports rainbow-delimiters jenkinsfile-mode) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -42,6 +42,9 @@ (add-hook 'groovy-mode-hook 'rainbow-delimiters-mode) (add-hook 'groovy-mode-hook 'oni-groovy--auto-fill-mode) +;;;###autoload +(add-to-list 'auto-mode-alist `(,(rx ".pipeline" string-end) . jenkinsfile-mode)) + ;;;###autoload(with-eval-after-load 'groovy-mode (require 'oni-groovy)) (provide 'oni-groovy) diff --git a/test/integration/oni-groovy.bats b/test/integration/oni-groovy.bats new file mode 100755 index 0000000..5a768a3 --- /dev/null +++ b/test/integration/oni-groovy.bats @@ -0,0 +1,41 @@ +#!/usr/bin/env bats + +@test "Opening a .groovy file loads oni-groovy" { + run emacs -batch -l package -f package-initialize \ + -visit test.groovy \ + -eval "(prin1 (featurep 'oni-groovy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening a Jenkinsfile loads oni-groovy" { + run emacs -batch -l package -f package-initialize \ + -visit Jenkinsfile \ + -eval "(prin1 (featurep 'oni-groovy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening a .pipeline file loads oni-groovy" { + run emacs -batch -l package -f package-initialize \ + -visit test.pipeline \ + -eval "(prin1 (featurep 'oni-groovy))" + + echo "$output" + + [[ "$output" == *"t" ]] +} + +@test "Opening a .pipeline file loads jenkinsfile-mode" { + run emacs -batch -l package -f package-initialize \ + -visit "test.pipeline" \ + -eval "(prin1 major-mode)" + + echo "$output" + + [[ "$output" == *"jenkinsfile-mode" ]] +}