1
0
Fork 0
mirror of https://github.com/Luzifer/password.git synced 2024-11-14 04:02:46 +00:00

Include workflow building into build process

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-09-22 16:22:05 +02:00
parent ed1cc33f91
commit f54a262ded
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
10 changed files with 209 additions and 1 deletions

View file

@ -4,7 +4,8 @@ image: "quay.io/luzifer/repo-runner-image"
checkout_dir: /go/src/github.com/Luzifer/password checkout_dir: /go/src/github.com/Luzifer/password
commands: commands:
- make publish - apk --update add zip
- make publish workflow
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0

View file

@ -14,3 +14,8 @@ pack: compile_coffee
publish: publish:
curl -sSLo golang.sh https://raw.githubusercontent.com/Luzifer/github-publish/master/golang.sh curl -sSLo golang.sh https://raw.githubusercontent.com/Luzifer/github-publish/master/golang.sh
bash golang.sh bash golang.sh
workflow:
cp password_darwin_amd64 password
zip -9 -j PasswordGenerator.alfredworkflow alfred-workflow/* password
github-release upload --user luzifer --repo password --tag $(shell git describe --tags --exact-match) --name PasswordGenerator.alfredworkflow --file PasswordGenerator.alfredworkflow

1
alfred-workflow/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.pyc

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,9 @@
# 1.2.0 / 2017-09-22
* Update password utility from github
* Stripping newlines from the password
* Updated password to v.1.2.2
* Updated password tool
* Prevent generation of passwords with long duration
* Migrated to Luzifer/password backed password generation
* Added README

5
alfred-workflow/Makefile Normal file
View file

@ -0,0 +1,5 @@
compress:
curl -sSLfo ./password https://github.com/Luzifer/password/releases/download/v1.4.0/password_darwin_amd64
chmod +x ./password
rm -rf *.pyc PasswordGenerator.alfredworkflow /tmp/password_master_darwin-amd64.zip /tmp/password
zip -9 PasswordGenerator.alfredworkflow * -x PasswordGenerator.alfredworkflow Makefile

View file

@ -0,0 +1,11 @@
# Alfred2 Password Generator
## Installation
* Ensure your Alfred 2 have the Powerpack enabled
* Download [PasswordGenerator.alfredworkflow](https://github.com/Luzifer/alfred-pwdgen/blob/master/PasswordGenerator.alfredworkflow?raw=true)
* Open downloaded file - the workflow will install itself
## Patches
Please don't republish this workflow but fork it and send me a pull request for your changes. I'll republish the workflow at it's current locations.

47
alfred-workflow/feedback.py Executable file
View file

@ -0,0 +1,47 @@
#author: Peter Okma
import xml.etree.ElementTree as et
class Feedback():
"""Feeback used by Alfred Script Filter
Usage:
fb = Feedback()
fb.add_item('Hello', 'World')
fb.add_item('Foo', 'Bar')
print fb
"""
def __init__(self):
self.feedback = et.Element('items')
def __repr__(self):
"""XML representation used by Alfred
Returns:
XML string
"""
return et.tostring(self.feedback)
def add_item(self, title, subtitle="", arg="", valid="yes", autocomplete="", icon="icon.png"):
"""
Add item to alfred Feedback
Args:
title(str): the title displayed by Alfred
Keyword Args:
subtitle(str): the subtitle displayed by Alfred
arg(str): the value returned by alfred when item is selected
valid(str): whether or not the entry can be selected in Alfred to trigger an action
autcomplete(str): the text to be inserted if an invalid item is selected. This is only used if 'valid' is 'no'
icon(str): filename of icon that Alfred will display
"""
item = et.SubElement(self.feedback, 'item', uid=str(len(self.feedback)),
arg=arg, valid=valid, autocomplete=autocomplete)
_title = et.SubElement(item, 'title')
_title.text = title
_sub = et.SubElement(item, 'subtitle')
_sub.text = subtitle
_icon = et.SubElement(item, 'icon')
_icon.text = icon

BIN
alfred-workflow/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

129
alfred-workflow/info.plist Normal file
View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>me.knut.pwd</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>F8CBCF9B-3B33-400E-B6AD-6B8500938BA4</key>
<array>
<dict>
<key>destinationuid</key>
<string>F417810A-4CC7-4844-9B6E-DA2D6B40543C</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Knut Ahlers</string>
<key>description</key>
<string>Generate secure passwords using Luzifer/password tool</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Password Generator</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>autopaste</key>
<false/>
<key>clipboardtext</key>
<string>{query}</string>
</dict>
<key>type</key>
<string>alfred.workflow.output.clipboard</string>
<key>uid</key>
<string>F417810A-4CC7-4844-9B6E-DA2D6B40543C</string>
<key>version</key>
<integer>0</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>1</integer>
<key>escaping</key>
<integer>0</integer>
<key>keyword</key>
<string>pwd</string>
<key>queuedelaycustom</key>
<integer>1</integer>
<key>queuedelayimmediatelyinitially</key>
<false/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>Generating password...</string>
<key>script</key>
<string>import subprocess, sys
from feedback import Feedback
password_length = 20
use_special = False
for arg in '{query}'.split():
if arg.isdigit():
password_length = int(arg)
elif arg == 's':
use_special = True
if password_length &lt; 5 or password_length &gt; 128:
fb = Feedback()
fb.add_item(title="Password length out of bounds", subtitle="Please use a reasonable password length between 5 and 128")
print fb
sys.exit(1)
command = ["./password", "get", "-l", str(password_length)]
if use_special:
command.append("-s")
result = subprocess.check_output(command).strip()
fb = Feedback()
fb.add_item(title=result, arg=result)
print fb</string>
<key>subtext</key>
<string>Generates a secure password with &lt;n&gt; length</string>
<key>title</key>
<string>Password Generator</string>
<key>type</key>
<integer>3</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>F8CBCF9B-3B33-400E-B6AD-6B8500938BA4</string>
<key>version</key>
<integer>0</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>F417810A-4CC7-4844-9B6E-DA2D6B40543C</key>
<dict>
<key>ypos</key>
<real>170</real>
</dict>
<key>F8CBCF9B-3B33-400E-B6AD-6B8500938BA4</key>
<dict>
<key>ypos</key>
<real>170</real>
</dict>
</dict>
<key>webaddress</key>
<string>https://github.com/Luzifer/password</string>
</dict>
</plist>