-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
29,621 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/bower_components/ | ||
node_modules/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{spawn} = require 'child_process' | ||
{ncp} = require 'ncp' | ||
mkdirp = require 'mkdirp' | ||
fs = require 'fs' | ||
|
||
file = 'WsseDynamicValue.coffee' | ||
identifier = 'net.xelaris.PawExtensions.WsseDynamicValue' | ||
|
||
extensions_dir = "#{ process.env.HOME }/Library/Containers/com.luckymarmot.Paw/Data/Library/Application Support/com.luckymarmot.Paw/Extensions/" | ||
build_root_dir = "build" | ||
build_dir = "#{ build_root_dir }/#{ identifier }" | ||
|
||
# compile CoffeeScript | ||
build_coffee = (callback) -> | ||
coffee = spawn 'coffee', ['-c', '-o', build_dir, file] | ||
coffee.stderr.on 'data', (data) -> | ||
process.stderr.write data.toString() | ||
coffee.stdout.on 'data', (data) -> | ||
process.stdout.write data.toString() | ||
coffee.on 'exit', (code) -> | ||
if code is 0 | ||
callback?() | ||
else | ||
console.error "Build failed with error: #{ code }" | ||
|
||
# copy files to build directory | ||
build_copy = () -> | ||
fs.writeFileSync "#{ build_dir }/README.md", fs.readFileSync("./README.md") | ||
fs.writeFileSync "#{ build_dir }/LICENSE", fs.readFileSync("./LICENSE") | ||
fs.writeFileSync "#{ build_dir }/forge.bundle.js", fs.readFileSync("./forge.bundle.js") | ||
|
||
# build: build CoffeeScript and copy files to build directory | ||
build = (callback) -> | ||
# mkdir build dir | ||
mkdirp build_dir, (err) -> | ||
if err | ||
console.error err | ||
else | ||
build_coffee () -> | ||
build_copy() | ||
callback?() | ||
|
||
# install: copy files to Extensions directory | ||
install = (callback) -> | ||
ncp build_dir, "#{ extensions_dir }/#{ identifier }", (err) -> | ||
if err | ||
console.error err | ||
else | ||
callback?() | ||
|
||
# archive: create a zip archive from the build | ||
archive = (callback) -> | ||
zip_file = "#{ identifier.split('.').pop() }.zip" | ||
|
||
# go to build dir | ||
process.chdir "#{ build_root_dir }/" | ||
|
||
# delete any previous zip | ||
if fs.existsSync zip_file | ||
fs.unlinkSync zip_file | ||
|
||
# zip | ||
zip = spawn 'zip', ["-r", zip_file, "#{ identifier }/"] | ||
zip.stderr.on 'data', (data) -> | ||
process.stderr.write data.toString() | ||
zip.stdout.on 'data', (data) -> | ||
process.stdout.write data.toString() | ||
zip.on 'exit', (code) -> | ||
if code is 0 | ||
callback?() | ||
else | ||
console.error "zip returned with error code: #{ code }" | ||
|
||
task 'build', -> | ||
build() | ||
|
||
task 'test', -> | ||
build () -> | ||
# no test to run | ||
|
||
task 'install', -> | ||
build () -> | ||
install() | ||
|
||
task 'archive', -> | ||
build () -> | ||
archive() | ||
|
||
task 'watch', -> | ||
# find all files in directory | ||
for filename in fs.readdirSync '.' | ||
# only watch non-hidden files | ||
if not filename.match(/^\./) and fs.lstatSync("./#{ filename }").isFile() | ||
fs.watchFile "./#{ filename }", {persistent:true, interval:500}, (_event, _filename) -> | ||
# when a file is changed, build and install | ||
build () -> | ||
install() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require "forge.bundle.js" | ||
|
||
WsseDynamicValue = -> | ||
this.username = "" | ||
|
||
this.password = "" | ||
|
||
this.evaluate = -> | ||
time = (new Date()).toISOString() | ||
|
||
nonce = forge.util.bytesToHex forge.random.getBytesSync 10 | ||
nonce64 = forge.util.encode64 nonce | ||
|
||
md = forge.md.sha1.create() | ||
md.update nonce + time + this.password | ||
digest = forge.util.encode64 md.digest().getBytes() | ||
|
||
"UsernameToken " + | ||
"Username=\"#{@username}\", " + | ||
"PasswordDigest=\"#{digest}\", " + | ||
"Nonce=\"#{nonce64}\", " + | ||
"Created=\"#{time}\""; | ||
|
||
@title = -> | ||
"WSSE" | ||
|
||
@text = -> | ||
@username | ||
|
||
return | ||
|
||
WsseDynamicValue.identifier = "net.xelaris.PawExtensions.WsseDynamicValue" | ||
|
||
WsseDynamicValue.title = "WSSE Dynamic Value" | ||
|
||
WsseDynamicValue.inputs = [ | ||
DynamicValueInput("username", "Username", "String"), | ||
DynamicValueInput("password", "Password", "String") | ||
] | ||
|
||
registerDynamicValueClass WsseDynamicValue |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.