diff --git a/.github/workflows/validate_build.yml b/.github/workflows/validate_build.yml new file mode 100644 index 0000000..98b0634 --- /dev/null +++ b/.github/workflows/validate_build.yml @@ -0,0 +1,12 @@ +name: Validate and Build the Extension +on: + push + +jobs: + validate_and_build: + runs-on: ubuntu-latest + steps: + - name: Validate and Build + uses: typemytype/roboFont-Extension-action@v0.1.0 + with: + autotagging: true \ No newline at end of file diff --git a/README.md b/README.md index 9a8d809..3c5c0b2 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Minimum required version: [RoboFont 4.1] Includes a boilerplate [.mechanic] file for extensions hosted on [GitHub] +The extension is set for automated release handling with GitHub Action using the [RoboFont-Extension-action](https://github.com/typemytype/roboFont-Extension-action). + [Extension Folder Structure]: https://robofont.com/documentation/reference/extensions/extension-file-spec/#extension-folder-structure [.mechanic]: https://robofont.com/documentation/reference/extensions/extension-item-format/ [RoboFont 4.1]: https://forum.robofont.com/topic/998/robofont-4-1 diff --git a/build.py b/build.py deleted file mode 100644 index 34df68e..0000000 --- a/build.py +++ /dev/null @@ -1,91 +0,0 @@ -'''build RoboFont Extension''' - -import os -from AppKit import NSCommandKeyMask, NSShiftKeyMask -from mojo.extensions import ExtensionBundle - -# get current folder -basePath = os.path.dirname(__file__) - -# source folder for all extension files -sourcePath = os.path.join(basePath, 'source') - -# folder with python files -libPath = os.path.join(sourcePath, 'code') - -# folder with html files -htmlPath = os.path.join(sourcePath, 'documentation') - -# folder with resources (icons etc) -resourcesPath = os.path.join(sourcePath, 'resources') - -# load license text from file -# see choosealicense.com for more open-source licenses -licensePath = os.path.join(basePath, 'license.txt') - -# required extensions -requirementsPath = os.path.join(basePath, 'requirements.txt') - -# name of the compiled extension file -extensionFile = 'myExtension.roboFontExt' - -# path of the compiled extension -buildPath = os.path.join(basePath, 'build') -extensionPath = os.path.join(buildPath, extensionFile) - -# initiate the extension builder -B = ExtensionBundle() - -# name of the extension -B.name = "myExtension" - -# name of the developer -B.developer = 'RoboDocs' - -# URL of the developer -B.developerURL = 'http://github.com/roboDocs' - -# extension icon (file path or NSImage) -imagePath = os.path.join(resourcesPath, 'icon.png') -B.icon = imagePath - -# version of the extension -B.version = '0.1' - -# should the extension be launched at start-up? -B.launchAtStartUp = True - -# script to be executed when RF starts -B.mainScript = 'events.py' - -# does the extension contain html help files? -B.html = True - -# minimum RoboFont version required for this extension -B.requiresVersionMajor = '4' -B.requiresVersionMinor = '1' - -# scripts which should appear in Extensions menu -B.addToMenu = [ - { - 'path': 'tool.py', - 'preferredName': 'Tool', - 'shortKey': (NSCommandKeyMask | NSShiftKeyMask, 't'), - }, -] - -# license for the extension -with open(licensePath) as license: - B.license = license.read() - -# expiration date for trial extensions -B.expireDate = '2021-12-31' - -# compile and save the extension bundle -print('building extension...', end=' ') -B.save(extensionPath, libPath=libPath, htmlPath=htmlPath, resourcesPath=resourcesPath) -print('done!') - -# check for problems in the compiled extension -print() -print(B.validationErrors()) diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..c73d92b --- /dev/null +++ b/build.yaml @@ -0,0 +1,25 @@ +libFolder: source/lib +resourcesFolder: source/resources +htmlFolder: source/html +license: | + MIT License + + Copyright (c) [year] [fullname] + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/build/myExtension.roboFontExt/.hash b/build/myExtension.roboFontExt/.hash deleted file mode 100644 index 2e012f6..0000000 --- a/build/myExtension.roboFontExt/.hash +++ /dev/null @@ -1 +0,0 @@ -d6d5785d298d151f1b76c3de8014d2e7a697f559 \ No newline at end of file diff --git "a/build/myExtension.roboFontExt/Icon\r" "b/build/myExtension.roboFontExt/Icon\r" deleted file mode 100644 index e69de29..0000000 diff --git a/build/myExtension.roboFontExt/info.plist b/build/myExtension.roboFontExt/info.plist deleted file mode 100644 index c961f80..0000000 --- a/build/myExtension.roboFontExt/info.plist +++ /dev/null @@ -1,42 +0,0 @@ - - - - - addToMenu - - - path - tool.py - preferredName - Tool - shortKey - - 1179648 - t - - - - developer - RoboDocs - developerURL - http://github.com/roboDocs - expireDate - 2021-12-31 - html - - launchAtStartUp - - mainScript - events.py - name - myExtension - requiresVersionMajor - 4 - requiresVersionMinor - 1 - timeStamp - 1639052601.2896709 - version - 0.1 - - diff --git a/build/myExtension.roboFontExt/license b/build/myExtension.roboFontExt/license deleted file mode 100644 index 8aa2645..0000000 --- a/build/myExtension.roboFontExt/license +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) [year] [fullname] - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/build/myExtension.roboFontExt/resources/icon.png b/build/myExtension.roboFontExt/resources/icon.png deleted file mode 100644 index b8d645d..0000000 Binary files a/build/myExtension.roboFontExt/resources/icon.png and /dev/null differ diff --git a/info.yaml b/info.yaml new file mode 100644 index 0000000..7d5c697 --- /dev/null +++ b/info.yaml @@ -0,0 +1,14 @@ +name: myExtension +developer: RoboDocs +developerURL: http://github.com/roboDocs +launchAtStartUp: true +mainScript: events.py +version: '0.1' +addToMenu: +- path: tool.py + preferredName: Tool + shortKey: [1179648, t] +html: true +requiresVersionMajor: '4' +requiresVersionMinor: '1' +expireDate: '2021-12-31' diff --git a/license.txt b/license.txt deleted file mode 100644 index 8aa2645..0000000 --- a/license.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) [year] [fullname] - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/myExtension-github.mechanic b/myExtension-github.mechanic deleted file mode 100644 index c155e74..0000000 --- a/myExtension-github.mechanic +++ /dev/null @@ -1,10 +0,0 @@ -extensionName: myExtension (GitHub) -repository: http://github.com/robodocs/rf-extension-boilerplate -extensionPath: build/myExtension.roboFontExt -description: A boilerplate extension which serves as starting point for creating your own extensions. -developer: RoboDocs -developerURL: https://github.com/roboDocs -tags: [ demo ] -infoPath: http://github.com/roboDocs/rf-extension-boilerplate/blob/master/build/myExtension.roboFontExt/info.plist -zipPath: http://github.com/roboDocs/rf-extension-boilerplate/archive/master.zip -icon: https://github.com/roboDocs/rf-extension-boilerplate/raw/master/myExtensionMechanicIcon.png \ No newline at end of file diff --git a/myExtension-github.mechanic.yml b/myExtension-github.mechanic.yml new file mode 100644 index 0000000..a1f2b9b --- /dev/null +++ b/myExtension-github.mechanic.yml @@ -0,0 +1,10 @@ +extensionName: myExtension (GitHub) +description: A boilerplate extension which serves as starting point for creating your own extensions. +developer: RoboDocs +developerURL: https://github.com/roboDocs +repository: http://github.com/robodocs/single-windowcontroller-with-multiple-subscribers +extensionPath: myExtension.roboFontExt +icon: https://raw.githubusercontent.com/roboDocs/single-windowcontroller-with-multiple-subscribers/master/myExtensionMechanicIcon.png +infoPath: https://raw.githubusercontent.com/robodocs/single-windowcontroller-with-multiple-subscribers/HEAD/info.yaml +zipPath: https://github.com/robodocs/single-windowcontroller-with-multiple-subscribers/releases/latest/download/myExtension.roboFontExt.zip +tags: [ demo ] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e69de29..0000000 diff --git a/source/code/events.py b/source/code/events.py deleted file mode 100644 index 304fbdf..0000000 --- a/source/code/events.py +++ /dev/null @@ -1,14 +0,0 @@ -from mojo.subscriber import registerSubscriberEvent - -DEFAULT_KEY = 'com.developerName.SomeTool' - -if __name__ == '__main__': - registerSubscriberEvent( - subscriberEventName=f"{DEFAULT_KEY}.changed", - methodName="paletteDidChange", - lowLevelEventNames=[f"{DEFAULT_KEY}.changed"], - dispatcher="roboFont", - documentation="Send when the tool palette did change parameters.", - delay=0, - # debug=True - ) diff --git a/source/code/tool.py b/source/code/tool.py deleted file mode 100644 index ca9a0d2..0000000 --- a/source/code/tool.py +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env python3 - -# -------------------- # -# Palette + Subscriber # -# -------------------- # - -# -- Modules -- # -from mojo.subscriber import Subscriber, WindowController -from mojo.subscriber import registerGlyphEditorSubscriber, unregisterGlyphEditorSubscriber -from mojo.roboFont import OpenWindow -from mojo.events import postEvent - -from vanilla import FloatingWindow, Slider, TextBox - -from events import DEFAULT_KEY - - -# -- Objects, Functions, Procedures -- # -class ToolPalette(WindowController): - - # debug = True - thickness = 5 - - def build(self): - self.w = FloatingWindow((200, 40), "Tool") - self.w.slider = Slider((10, 10, -30, 23), - minValue=0, - value=self.thickness, - maxValue=25, - stopOnTickMarks=True, - tickMarkCount=6, - continuous=False, - callback=self.sliderCallback) - self.w.textBox = TextBox((-25, 10, 30, 17), f"{self.thickness:.0f}") - self.w.open() - - def started(self): - Tool.controller = self - registerGlyphEditorSubscriber(Tool) - - def destroy(self): - unregisterGlyphEditorSubscriber(Tool) - Tool.controller = None - - def sliderCallback(self, sender): - self.thickness = sender.get() - self.w.textBox.set(f"{self.thickness:.0f}") - postEvent(f"{DEFAULT_KEY}.changed") - - -class Tool(Subscriber): - """ - Tool can only ask for information to the palette - """ - # debug = True - controller = None - - def build(self): - glyphEditor = self.getGlyphEditor() - container = glyphEditor.extensionContainer(identifier=DEFAULT_KEY, - location='background', - clear=True) - self.path = container.appendPathSublayer( - fillColor=(0, 0, 0, 0), - strokeColor=(1, 0, 0, 1), - strokeWidth=self.controller.thickness if self.controller else 0, - ) - glyph = self.getGlyphEditor().getGlyph() - self.path.setPath(glyph.getRepresentation("merz.CGPath")) - - def destroy(self): - glyphEditor = self.getGlyphEditor() - container = glyphEditor.extensionContainer(DEFAULT_KEY, location='background') - container.clearSublayers() - - def glyphEditorGlyphDidChangeOutline(self, info): - self.path.setPath(info['glyph'].getRepresentation("merz.CGPath")) - - def paletteDidChange(self, info): - self.path.setStrokeWidth(self.controller.thickness) - - -# -- Instructions -- # -if __name__ == '__main__': - OpenWindow(ToolPalette) diff --git a/source/documentation/_style.css b/source/documentation/_style.css deleted file mode 100644 index 5bad82f..0000000 --- a/source/documentation/_style.css +++ /dev/null @@ -1,2 +0,0 @@ -body { background-color: yellow; } -img { max-width: 100%; } \ No newline at end of file diff --git a/source/documentation/index.md b/source/documentation/index.md deleted file mode 100644 index f604836..0000000 --- a/source/documentation/index.md +++ /dev/null @@ -1,50 +0,0 @@ -Boilerplate Extension -===================== - -A RoboFont extension which doesn’t do anything useful. - -[TOC] - -- - - - -## Introduction - -**Monty Python** (also known as **The Pythons**) were a British surreal comedy group who created their sketch comedy show *Monty Python's Flying Circus*, which first aired on the BBC in 1969. A self-contained comedy team responsible for both writing and performing their work, the Pythons had creative control which allowed them to experiment with form and content, discarding rules of television comedy. - -![this is a caption](pythons.jpg) - -The film opens with a [credit sequence](http://youtu.be/djKPvXDwXcs) that becomes increasingly ridiculous, first becoming laden with strange `pseudo-Swedish commentary` about moose, and eventually being replaced with flashy titles in which everyone's name has been changed to something involving llamas. - -## And Now for Something Completely Different - -### Code blocks - -```python -import comMyDomainMyExtensionMyModule -print(comMyDomainMyExtensionMyModule) - -from comMyDomainMyExtensionMyModule.test import hello -hello() -``` - -### Lists - -Here is an unordered list: - -- Vivamus vehicula aliquet augue. -- Fusce et ligula imperdiet, imperdiet massa viverra, cursus magna. -- Cras sagittis sodales mi, sit amet aliquet nisl lacinia nec. - -Here is an ordered list: - -1. Vivamus vehicula aliquet augue. -2. Fusce et ligula imperdiet, imperdiet massa viverra, cursus magna. -3. Cras sagittis sodales mi, sit amet aliquet nisl lacinia nec. - -### Tables - -| Default aligned |Left aligned| Center aligned | Right aligned | -|-----------------|:-----------|:---------------:|---------------:| -| First body part |Second cell | Third cell | fourth cell | -| Second line |foo | **strong** | baz | -| Third line |quux | *baz* | bar | diff --git a/source/documentation/pythons.jpg b/source/documentation/pythons.jpg deleted file mode 100644 index e2c8be5..0000000 Binary files a/source/documentation/pythons.jpg and /dev/null differ diff --git a/build/myExtension.roboFontExt/html/_style.css b/source/html/_style.css similarity index 100% rename from build/myExtension.roboFontExt/html/_style.css rename to source/html/_style.css diff --git a/build/myExtension.roboFontExt/html/index.html b/source/html/index.html similarity index 100% rename from build/myExtension.roboFontExt/html/index.html rename to source/html/index.html diff --git a/build/myExtension.roboFontExt/html/index.md b/source/html/index.md similarity index 100% rename from build/myExtension.roboFontExt/html/index.md rename to source/html/index.md diff --git a/build/myExtension.roboFontExt/html/pythons.jpg b/source/html/pythons.jpg similarity index 100% rename from build/myExtension.roboFontExt/html/pythons.jpg rename to source/html/pythons.jpg diff --git a/build/myExtension.roboFontExt/lib/events.py b/source/lib/events.py similarity index 100% rename from build/myExtension.roboFontExt/lib/events.py rename to source/lib/events.py diff --git a/build/myExtension.roboFontExt/lib/tool.py b/source/lib/tool.py similarity index 100% rename from build/myExtension.roboFontExt/lib/tool.py rename to source/lib/tool.py