dpm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Bold.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldCondensed.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldItalic.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldItalicCondensed.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Italic.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-ItalicCondensed.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Regular.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-RegularCondensed.ttf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/SIL Open Font License.txt +41 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/f66c3b2c25d2e040bdc211d96fad2b9c.pdf +0 -0
- data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/junicode +0 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/master.zip +0 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/dockpreview.coscript +111 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/manifest.json +32 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/sandbox.js +193 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/source.coscript +4 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/LICENSE +21 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/README.md +45 -0
- data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/sketchpack.json +5 -0
- data/.palette/cd425a1f5df660fb52ce8c7ab0b20a56/Inconsolata +0 -0
- data/.palette/cd425a1f5df660fb52ce8c7ab0b20a56/Inconsolata.otf +0 -0
- data/.palette/cd425a1f5df660fb52ce8c7ab0b20a56/SIL Open Font License.txt +41 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +70 -0
- data/Palette.json +12 -0
- data/README.rdoc +6 -0
- data/Rakefile +44 -0
- data/bin/dpm +185 -0
- data/dpm.gemspec +22 -0
- data/features/palette.feature +8 -0
- data/features/step_definitions/palette_steps.rb +6 -0
- data/features/support/env.rb +15 -0
- data/lib/dpm.rb +4 -0
- data/lib/dpm/version.rb +3 -0
- data/palette.rdoc +5 -0
- data/test/default_test.rb +14 -0
- data/test/test_helper.rb +9 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 452c8025abdf8622a9b679601dd8ff95d9bdc56c
|
4
|
+
data.tar.gz: a3d6691ac0443446141b5e32ac077be9437c40ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 600f700ef9d584e20df1e48ee895f30ed521b5db00ccd725795f6100bd5633c5fd08ab1f1e952dc0e0387d8075c5f535343021b972c466d448870772f45a5b89
|
7
|
+
data.tar.gz: 57f4c2fac8428e19b71fcf03bd17f403e82d089ac56f40be1cd83f46a7be8f0baec16095132090bf1787912b0538f5a2ec8862c86ef091c43b1ad41b05d76056
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,41 @@
|
|
1
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
2
|
+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
3
|
+
|
4
|
+
-----------------------------------------------------------
|
5
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
6
|
+
-----------------------------------------------------------
|
7
|
+
|
8
|
+
PREAMBLE
|
9
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
|
10
|
+
|
11
|
+
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
|
12
|
+
|
13
|
+
DEFINITIONS
|
14
|
+
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
|
15
|
+
|
16
|
+
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
|
17
|
+
|
18
|
+
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
|
19
|
+
|
20
|
+
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
|
21
|
+
|
22
|
+
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
|
23
|
+
|
24
|
+
PERMISSION & CONDITIONS
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
|
26
|
+
|
27
|
+
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
|
28
|
+
|
29
|
+
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
|
30
|
+
|
31
|
+
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
|
32
|
+
|
33
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
|
34
|
+
|
35
|
+
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
|
36
|
+
|
37
|
+
TERMINATION
|
38
|
+
This license becomes null and void if any of the above conditions are not met.
|
39
|
+
|
40
|
+
DISCLAIMER
|
41
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,111 @@
|
|
1
|
+
@import 'sandbox.js'
|
2
|
+
|
3
|
+
var app = NSApplication.sharedApplication();
|
4
|
+
var temp = {};
|
5
|
+
|
6
|
+
var Dockpreview = {};
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Creates a folder at given path. If the application runs in
|
10
|
+
* sandboxed mode, it will prompt the user for permission.
|
11
|
+
* @param {String} path The path to create the folder
|
12
|
+
*/
|
13
|
+
Dockpreview.createFolder = function (path) {
|
14
|
+
var file_manager = NSFileManager.defaultManager();
|
15
|
+
|
16
|
+
Dockpreview.runMethodSandbox(path, function () {
|
17
|
+
[file_manager createDirectoryAtPath:path
|
18
|
+
withIntermediateDirectories: true
|
19
|
+
attributes:nil
|
20
|
+
error:nil];
|
21
|
+
});
|
22
|
+
};
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Creates a temporary folder at a auto-generated temporary path.
|
26
|
+
*/
|
27
|
+
Dockpreview.createTempFolder = function() {
|
28
|
+
var guid = NSProcessInfo.processInfo().globallyUniqueString();
|
29
|
+
var tmpPath = NSTemporaryDirectory().stringByAppendingPathComponent(guid);
|
30
|
+
|
31
|
+
temp.path = tmpPath;
|
32
|
+
Dockpreview.createFolder(temp.path);
|
33
|
+
};
|
34
|
+
|
35
|
+
Dockpreview.runMethodSandbox = function(path, method) {
|
36
|
+
if(in_sandbox()) {
|
37
|
+
sandboxAccess.accessFilePath_withBlock_persistPermission(path, method, true);
|
38
|
+
} else {
|
39
|
+
method();
|
40
|
+
}
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Gets the current artboard in document.
|
45
|
+
* This is a hacky solution, since the `currentArtboard` method
|
46
|
+
* is deprecated as of Sketch 3.3.
|
47
|
+
* @param {Object} context The context of the application.
|
48
|
+
* @return {MSArtboardGroup} Returns the current artboard group.
|
49
|
+
*/
|
50
|
+
Dockpreview.getCurrentArtboard = function(context) {
|
51
|
+
return context.document.currentPage().currentArtboard();
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Exports artboard to an image file and sets the application icon
|
56
|
+
* to the exported image file.
|
57
|
+
* @param {Object} context The context of the application
|
58
|
+
*/
|
59
|
+
Dockpreview.setAppIconImage = function(context) {
|
60
|
+
var doc = context.document;
|
61
|
+
var artboard = Dockpreview.getCurrentArtboard(context);
|
62
|
+
var imgFile = temp.path + '/dockpreview-preview.tmp.png';
|
63
|
+
|
64
|
+
Dockpreview.runMethodSandbox(imgFile, function () {
|
65
|
+
doc.saveArtboardOrSlice_toFile(artboard, imgFile);
|
66
|
+
});
|
67
|
+
|
68
|
+
var img = NSImage.alloc().initByReferencingFile(imgFile);
|
69
|
+
app.setApplicationIconImage(img);
|
70
|
+
};
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Restores the application icon to the application's icon.
|
74
|
+
* @param {Object} context The context of the application
|
75
|
+
*/
|
76
|
+
Dockpreview.restoreAppIconImage = function (context) {
|
77
|
+
var bundle = NSBundle.mainBundle();
|
78
|
+
var icon;
|
79
|
+
|
80
|
+
if (app.applicationName() == 'Sketch Beta') {
|
81
|
+
icon = [bundle pathForResource:@"beta" ofType:@"icns"];
|
82
|
+
} else {
|
83
|
+
icon = [bundle pathForResource:@"app" ofType:@"icns"];
|
84
|
+
}
|
85
|
+
|
86
|
+
img = NSImage.alloc().initByReferencingFile(icon);
|
87
|
+
app.setApplicationIconImage(img);
|
88
|
+
};
|
89
|
+
|
90
|
+
// @TODO: Implement status item previewing
|
91
|
+
Dockpreview.setStatusItemImage = function(statusItem, context) {
|
92
|
+
var artboard = Dockpreview.getCurrentArtboard(context);
|
93
|
+
var imgFile = temp.path + '/dockpreview-preview.tmp.png';
|
94
|
+
|
95
|
+
Dockpreview.runMethodSandbox(imgFile, function () {
|
96
|
+
[doc saveArtboardOrSlice:artboard toFile:imgFile];
|
97
|
+
});
|
98
|
+
|
99
|
+
var img = NSImage.alloc().initByReferencingFile(imgFile);
|
100
|
+
var barHeight = app.mainMenu.menuBarHeight;
|
101
|
+
var width = 16;
|
102
|
+
|
103
|
+
[img setTemplate:true];
|
104
|
+
log(img);
|
105
|
+
|
106
|
+
[statusItem setImage:img];
|
107
|
+
log(statusItem);
|
108
|
+
};
|
109
|
+
|
110
|
+
// Create a temp folder
|
111
|
+
Dockpreview.createTempFolder();
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"name": "Dockpreview",
|
3
|
+
"description": "Preview your current artboard in the Dock.",
|
4
|
+
"author": "Christian Petersen",
|
5
|
+
"homepage": "http://github.com/fnky/sketch-dockpreview",
|
6
|
+
"version": 1.0,
|
7
|
+
"identifier": "io.cbp.sketch.dockpreview",
|
8
|
+
"updateURL": "https://github.com/downloads/fnky/sketch-dockpreview/sketch-dockpreview.json",
|
9
|
+
"compatibleVersion": 3,
|
10
|
+
"bundleVersion": 1,
|
11
|
+
"commands": [
|
12
|
+
{
|
13
|
+
"name": "Preview In Dock",
|
14
|
+
"identifier": "previewInDock",
|
15
|
+
"handler": "setAppIcon",
|
16
|
+
"shortcut": "shift command d",
|
17
|
+
"script": "source.coscript"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"name": "Restore Sketch Icon",
|
21
|
+
"identifier": "restoreIcon",
|
22
|
+
"handler": "restoreAppIcon",
|
23
|
+
"script": "source.coscript"
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"menu": {
|
27
|
+
"items": [
|
28
|
+
"previewInDock",
|
29
|
+
"restoreIcon"
|
30
|
+
]
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,193 @@
|
|
1
|
+
/*
|
2
|
+
This is a port to JSTalk of <https://github.com/leighmcculloch/AppSandboxFileAccess>
|
3
|
+
|
4
|
+
Here's the original license for AppSandboxFileAccess:
|
5
|
+
|
6
|
+
## License
|
7
|
+
|
8
|
+
Copyright (c) 2013, Leigh McCulloch All rights reserved.
|
9
|
+
|
10
|
+
BSD-2-Clause License: http://opensource.org/licenses/BSD-2-Clause
|
11
|
+
|
12
|
+
Redistribution and use in source and binary forms, with or without modification,
|
13
|
+
are permitted provided that the following conditions are met:
|
14
|
+
|
15
|
+
- Redistributions of source code must retain the above copyright notice,
|
16
|
+
this list of conditions and the following disclaimer.
|
17
|
+
|
18
|
+
- Redistributions in binary form must reproduce the above copyright notice,
|
19
|
+
this list of conditions and the following disclaimer in the documentation
|
20
|
+
and/or other materials provided with the distribution.
|
21
|
+
|
22
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
25
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
26
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
27
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
28
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
29
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
30
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
31
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
32
|
+
*/
|
33
|
+
|
34
|
+
var AppSandboxFileAccessPersist = {
|
35
|
+
keyForBookmarkDataForURL: function(url) {
|
36
|
+
//log("AppSandboxFileAccessPersist.keyForBookmarkDataForURL("+url+")")
|
37
|
+
var urlStr = [url absoluteString];
|
38
|
+
//log("> " + [NSString stringWithFormat:@"bd_%1$@", urlStr])
|
39
|
+
return [NSString stringWithFormat:@"bd_%1$@", urlStr];
|
40
|
+
},
|
41
|
+
bookmarkDataForURL: function(url) {
|
42
|
+
//log("AppSandboxFileAccessPersist.bookmarkDataForURL('"+ url +"')")
|
43
|
+
var defaults = [NSUserDefaults standardUserDefaults];
|
44
|
+
|
45
|
+
// loop through the bookmarks one path at a time down the URL
|
46
|
+
var subUrl = url;
|
47
|
+
while ([subUrl path].length() > 1) { // give up when only '/' is left in the path
|
48
|
+
var key = AppSandboxFileAccessPersist.keyForBookmarkDataForURL(subUrl);
|
49
|
+
var bookmark = [defaults dataForKey:key];
|
50
|
+
if (bookmark) { // if a bookmark is found, return it
|
51
|
+
return bookmark;
|
52
|
+
}
|
53
|
+
subUrl = [subUrl URLByDeletingLastPathComponent];
|
54
|
+
}
|
55
|
+
// no bookmarks for the URL, or parent to the URL were found
|
56
|
+
return nil;
|
57
|
+
},
|
58
|
+
setBookmarkData: function(data, url) {
|
59
|
+
//log("AppSandboxFileAccessPersist.setBookmarkData")
|
60
|
+
//log("data: " + data)
|
61
|
+
//log("URL: " + url)
|
62
|
+
var defaults = [NSUserDefaults standardUserDefaults];
|
63
|
+
var key = AppSandboxFileAccessPersist.keyForBookmarkDataForURL(url);
|
64
|
+
[defaults setObject:data forKey:key];
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
var AppSandboxFileAccess = {
|
69
|
+
init: function(opts){
|
70
|
+
this.message = opts.message || "Please authorize Sketch to write to this folder. You will only need to do this once."
|
71
|
+
this.prompt = opts.prompt || "Authorize",
|
72
|
+
this.title = opts.title || "Sketch Authorization"
|
73
|
+
return this;
|
74
|
+
},
|
75
|
+
askPermissionForUrl: function(url) {
|
76
|
+
//log("AppSandboxFileAccess.askPermissionForUrl("+url+")")
|
77
|
+
// this url will be the url allowed, it might be a parent url of the url passed in
|
78
|
+
var allowedUrl;
|
79
|
+
|
80
|
+
// create delegate that will limit which files in the open panel can be selected, to ensure only a folder
|
81
|
+
// or file giving permission to the file requested can be selected
|
82
|
+
// AppSandboxFileAccessOpenSavePanelDelegate *openPanelDelegate = [[AppSandboxFileAccessOpenSavePanelDelegate alloc] initWithFileURL:url];
|
83
|
+
|
84
|
+
// check that the url exists, if it doesn't, find the parent path of the url that does exist and ask permission for that
|
85
|
+
var fileManager = [NSFileManager defaultManager];
|
86
|
+
var path = [url path];
|
87
|
+
while (path.length() > 1) { // give up when only '/' is left in the path or if we get to a path that exists
|
88
|
+
if ([fileManager fileExistsAtPath:path]) {
|
89
|
+
break;
|
90
|
+
}
|
91
|
+
path = [path stringByDeletingLastPathComponent];
|
92
|
+
}
|
93
|
+
//log("Looks like we have a winner: " + path)
|
94
|
+
url = [NSURL fileURLWithPath:path];
|
95
|
+
|
96
|
+
// display the open panel
|
97
|
+
var openPanel = [NSOpenPanel openPanel];
|
98
|
+
[openPanel setMessage:this.message];
|
99
|
+
[openPanel setPrompt:this.prompt];
|
100
|
+
[openPanel setTitle:this.title];
|
101
|
+
// [openPanel setDelegate:openPanelDelegate];
|
102
|
+
[openPanel setCanCreateDirectories:false];
|
103
|
+
[openPanel setCanChooseFiles:true];
|
104
|
+
[openPanel setCanChooseDirectories:true];
|
105
|
+
[openPanel setAllowsMultipleSelection:false];
|
106
|
+
[openPanel setShowsHiddenFiles:false];
|
107
|
+
[openPanel setExtensionHidden:false];
|
108
|
+
[openPanel setDirectoryURL:url];
|
109
|
+
[[NSApplication sharedApplication] activateIgnoringOtherApps:true];
|
110
|
+
var openPanelButtonPressed = [openPanel runModal];
|
111
|
+
if (openPanelButtonPressed == NSFileHandlingPanelOKButton) {
|
112
|
+
allowedUrl = [openPanel URL];
|
113
|
+
}
|
114
|
+
return allowedUrl;
|
115
|
+
},
|
116
|
+
persistPermissionPath: function(path) {
|
117
|
+
this.persistPermissionURL([NSURL fileURLWithPath:path]);
|
118
|
+
},
|
119
|
+
persistPermissionURL: function(url) {
|
120
|
+
//log("AppSandboxFileAccess.persistPermissionURL("+url+")")
|
121
|
+
// store the sandbox permissions
|
122
|
+
url = [[url URLByStandardizingPath] URLByResolvingSymlinksInPath]
|
123
|
+
var bookmarkData = [url bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
|
124
|
+
includingResourceValuesForKeys:nil
|
125
|
+
relativeToURL:nil
|
126
|
+
error:null];
|
127
|
+
if (bookmarkData) {
|
128
|
+
AppSandboxFileAccessPersist.setBookmarkData(bookmarkData, url);
|
129
|
+
}
|
130
|
+
},
|
131
|
+
accessFilePath_withBlock_persistPermission: function(path, block, persist) {
|
132
|
+
//log("AppSandboxFileAccess.accessFilePath_withBlock_persistPermission")
|
133
|
+
//log("path: " + path)
|
134
|
+
return AppSandboxFileAccess.accessFileURL_withBlock_persistPermission([NSURL fileURLWithPath:path], block, persist);
|
135
|
+
},
|
136
|
+
accessFileURL_withBlock_persistPermission: function(fileUrl, block, persist) {
|
137
|
+
//log("AppSandboxFileAccess.accessFileURL_withBlock_persistPermission")
|
138
|
+
//log("fileUrl: " + fileUrl)
|
139
|
+
//log("block: " + block)
|
140
|
+
//log("persist: " + persist)
|
141
|
+
var allowedUrl = false;
|
142
|
+
// standardize the file url and remove any symlinks so that the url we lookup in bookmark data would match a url given by the askPermissionForUrl method
|
143
|
+
var fileUrl = [[fileUrl URLByStandardizingPath] URLByResolvingSymlinksInPath];
|
144
|
+
// lookup bookmark data for this url, this will automatically load bookmark data for a parent path if we have it
|
145
|
+
var bookmarkData = AppSandboxFileAccessPersist.bookmarkDataForURL(fileUrl);
|
146
|
+
|
147
|
+
if (bookmarkData) {
|
148
|
+
//log("Bookmark data found")
|
149
|
+
// resolve the bookmark data into an NSURL object that will allow us to use the file
|
150
|
+
var bookmarkDataIsStalePtr = MOPointer.alloc().init();
|
151
|
+
allowedUrl = [NSURL URLByResolvingBookmarkData:bookmarkData options:NSURLBookmarkResolutionWithSecurityScope|NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:bookmarkDataIsStalePtr error:null];
|
152
|
+
// if the bookmark data is stale, we'll create new bookmark data further down
|
153
|
+
if (bookmarkDataIsStalePtr.value()) {
|
154
|
+
bookmarkData = nil;
|
155
|
+
}
|
156
|
+
} else {
|
157
|
+
//log("No bookmark data found")
|
158
|
+
}
|
159
|
+
|
160
|
+
// if allowed url is nil, we need to ask the user for permission
|
161
|
+
if (!allowedUrl) {
|
162
|
+
allowedUrl = AppSandboxFileAccess.askPermissionForUrl(fileUrl);
|
163
|
+
if (!allowedUrl) {
|
164
|
+
// if the user did not give permission, exit out here
|
165
|
+
return false;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
// if we have no bookmark data, we need to create it, this may be because our bookmark data was stale, or this is the first time being given permission
|
169
|
+
if (persist && !bookmarkData) {
|
170
|
+
AppSandboxFileAccess.persistPermissionURL(allowedUrl);
|
171
|
+
}
|
172
|
+
// execute the block with the file access permissions
|
173
|
+
try {
|
174
|
+
[allowedUrl startAccessingSecurityScopedResource];
|
175
|
+
block();
|
176
|
+
} finally {
|
177
|
+
[allowedUrl stopAccessingSecurityScopedResource];
|
178
|
+
}
|
179
|
+
return true;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
// Sandbox
|
184
|
+
function in_sandbox(){
|
185
|
+
var environ = [[NSProcessInfo processInfo] environment];
|
186
|
+
return (nil != [environ objectForKey:@"APP_SANDBOX_CONTAINER_ID"]);
|
187
|
+
}
|
188
|
+
|
189
|
+
var sandboxAccess = AppSandboxFileAccess.init({
|
190
|
+
message: "Please authorize Sketch to write to this folder. You will only need to do this once per folder.",
|
191
|
+
prompt: "Authorize",
|
192
|
+
title: "Sketch Authorization"
|
193
|
+
})
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Christian Petersen (http://cbp.io) <chrs@cbp.io>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# Sketch Dockpreview
|
2
|
+
|
3
|
+
A Sketch plugin that lets you preview your current artboard in the Dock.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
It's really easy. Just [download Dockpreview](https://github.com/fnky/sketch-dockpreview/releases) or clone the repository and put the Dockpreview `sketchplugin` file in your plugin folder. You can rename the folder if you'd like.
|
8
|
+
|
9
|
+
## Upgrade Notice
|
10
|
+
|
11
|
+
Sketch 3.3 changed plugin system from a folder/file system to a bundle-based approach. If you still use an older version of Sketch, you can still get older Dockpreview from [Releases](https://github.com/fnky/sketch-dockpreview/releases).
|
12
|
+
|
13
|
+
Older releases aren't maintained and Dockpreview keeps pushing the way forward.
|
14
|
+
|
15
|
+
##### Sketch 3
|
16
|
+
|
17
|
+
In Sketch 3 you can reveal your plugins folder in `Plugins > Reveal Plugins Folder...`
|
18
|
+
|
19
|
+
##### Sketch from App Store
|
20
|
+
|
21
|
+
Place the plugin in `~/Library/Containers/com.bohemiancoding.sketch/Data/Library/Application Support/Sketch/Plugins`
|
22
|
+
|
23
|
+
|
24
|
+
##### Sketch from Downloads
|
25
|
+
|
26
|
+
Place the plugin in `~/Library/Application Support/Sketch/Plugins`
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
- `⇧⌘D` (*Shift + Command + D*) - Preview current artboard in Dock.
|
31
|
+
|
32
|
+
To restore the icon back to the default Sketch icon, go to `Plugins > Restore Sketch icon`. If you quit Sketch, the icon will automatically restore by itself.
|
33
|
+
|
34
|
+
If you'd like to change the shortcuts, you can change the `manifest.json` file in `Dockpreview.sketchplugin/Contents/Sketch` and change the `shortcut` to your liking.
|
35
|
+
|
36
|
+
> *Note:* When the plugin updates, this will overwrite the `manifest.json` because of versioning.
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Found a bug? Perhaps have an idea for Dockpreview, you'd like to see? [Submit an issue or pull request
|
41
|
+
](wiki/Contributing) - all your help is needed.
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The MIT License (MIT)
|
Binary file
|
Binary file
|
@@ -0,0 +1,41 @@
|
|
1
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
2
|
+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
3
|
+
|
4
|
+
-----------------------------------------------------------
|
5
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
6
|
+
-----------------------------------------------------------
|
7
|
+
|
8
|
+
PREAMBLE
|
9
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
|
10
|
+
|
11
|
+
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
|
12
|
+
|
13
|
+
DEFINITIONS
|
14
|
+
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
|
15
|
+
|
16
|
+
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
|
17
|
+
|
18
|
+
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
|
19
|
+
|
20
|
+
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
|
21
|
+
|
22
|
+
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
|
23
|
+
|
24
|
+
PERMISSION & CONDITIONS
|
25
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
|
26
|
+
|
27
|
+
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
|
28
|
+
|
29
|
+
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
|
30
|
+
|
31
|
+
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
|
32
|
+
|
33
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
|
34
|
+
|
35
|
+
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
|
36
|
+
|
37
|
+
TERMINATION
|
38
|
+
This license becomes null and void if any of the above conditions are not met.
|
39
|
+
|
40
|
+
DISCLAIMER
|
41
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dpm (0.0.1)
|
5
|
+
gli (= 2.13.4)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
aruba (0.13.0)
|
11
|
+
childprocess (~> 0.5.6)
|
12
|
+
contracts (~> 0.9)
|
13
|
+
cucumber (>= 1.3.19)
|
14
|
+
ffi (~> 1.9.10)
|
15
|
+
rspec-expectations (>= 2.99)
|
16
|
+
thor (~> 0.19)
|
17
|
+
builder (3.2.2)
|
18
|
+
childprocess (0.5.9)
|
19
|
+
ffi (~> 1.0, >= 1.0.11)
|
20
|
+
colorize (0.7.7)
|
21
|
+
contracts (0.13.0)
|
22
|
+
crack (0.4.3)
|
23
|
+
safe_yaml (~> 1.0.0)
|
24
|
+
cucumber (2.3.2)
|
25
|
+
builder (>= 2.1.2)
|
26
|
+
cucumber-core (~> 1.4.0)
|
27
|
+
cucumber-wire (~> 0.0.1)
|
28
|
+
diff-lcs (>= 1.1.3)
|
29
|
+
gherkin (~> 3.2.0)
|
30
|
+
multi_json (>= 1.7.5, < 2.0)
|
31
|
+
multi_test (>= 0.1.2)
|
32
|
+
cucumber-core (1.4.0)
|
33
|
+
gherkin (~> 3.2.0)
|
34
|
+
cucumber-wire (0.0.1)
|
35
|
+
diff-lcs (1.2.5)
|
36
|
+
ffi (1.9.10)
|
37
|
+
gherkin (3.2.0)
|
38
|
+
gli (2.13.4)
|
39
|
+
json (1.8.3)
|
40
|
+
multi_json (1.11.2)
|
41
|
+
multi_test (0.1.2)
|
42
|
+
open_uri_redirections (0.2.1)
|
43
|
+
progressbar (0.21.0)
|
44
|
+
rake (10.5.0)
|
45
|
+
rdoc (4.2.1)
|
46
|
+
json (~> 1.4)
|
47
|
+
rspec-expectations (3.4.0)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.4.0)
|
50
|
+
rspec-support (3.4.1)
|
51
|
+
rubyzip (1.1.7)
|
52
|
+
safe_yaml (1.0.4)
|
53
|
+
thor (0.19.1)
|
54
|
+
|
55
|
+
PLATFORMS
|
56
|
+
ruby
|
57
|
+
|
58
|
+
DEPENDENCIES
|
59
|
+
aruba
|
60
|
+
colorize
|
61
|
+
crack
|
62
|
+
dpm!
|
63
|
+
open_uri_redirections
|
64
|
+
progressbar
|
65
|
+
rake
|
66
|
+
rdoc
|
67
|
+
rubyzip (>= 1.0.0)
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
1.10.6
|
data/Palette.json
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"name" : "Sample Project",
|
3
|
+
"author" : "Alasdair Monk",
|
4
|
+
"version" : 1.0,
|
5
|
+
"fonts" : [
|
6
|
+
"http://www.fontsquirrel.com/fonts/download/Inconsolata",
|
7
|
+
"http://www.fontsquirrel.com/fonts/download/junicode",
|
8
|
+
],
|
9
|
+
"sketch_plugins" : [
|
10
|
+
"https://github.com/fnky/sketch-dockpreview/archive/master.zip"
|
11
|
+
]
|
12
|
+
}
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('dpm.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/dpm
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'crack/json'
|
4
|
+
require 'shellwords'
|
5
|
+
require 'progressbar'
|
6
|
+
require 'net/http'
|
7
|
+
require 'uri'
|
8
|
+
require 'open-uri'
|
9
|
+
require 'open_uri_redirections'
|
10
|
+
require 'zip'
|
11
|
+
require 'colorize'
|
12
|
+
require 'json'
|
13
|
+
require 'securerandom'
|
14
|
+
|
15
|
+
begin
|
16
|
+
require 'dpm'
|
17
|
+
rescue LoadError
|
18
|
+
STDERR.puts "In development, you need to use `bundle exec bin/palette` to run your app"
|
19
|
+
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
20
|
+
STDERR.puts "Feel free to remove this message from bin/palette now"
|
21
|
+
exit 64
|
22
|
+
end
|
23
|
+
|
24
|
+
include GLI::App
|
25
|
+
|
26
|
+
program_desc 'A package manager for design assets'
|
27
|
+
version Dpm::VERSION
|
28
|
+
|
29
|
+
subcommand_option_handling :normal
|
30
|
+
|
31
|
+
# Constants
|
32
|
+
@sketch_plugins_dir = "#{Dir.home}/Library/Application Support/com.bohemiancoding.sketch3/Plugins/".gsub(/ /, '\ ')
|
33
|
+
@font_install_count = 0
|
34
|
+
@sketch_plugin_install_count = 0
|
35
|
+
|
36
|
+
# Begin setup
|
37
|
+
desc 'Installs dependencies from a local Palette.json'
|
38
|
+
arg_name 'Describe arguments to list here'
|
39
|
+
command :install do |c|
|
40
|
+
c.desc 'Installs dependencies from a local Palette.json'
|
41
|
+
c.action do |global_options,options,args|
|
42
|
+
working_directory = Dir.pwd
|
43
|
+
local_palettefile = "#{working_directory}/Palette.json"
|
44
|
+
|
45
|
+
if File.exists? local_palettefile
|
46
|
+
clean_palette_tmp_dir
|
47
|
+
install_fonts(local_palettefile)
|
48
|
+
install_sketch_plugins(local_palettefile)
|
49
|
+
puts "Palette complete. #{@font_install_count} fonts, #{@sketch_plugin_install_count} Sketch plugins now installed.".green
|
50
|
+
else
|
51
|
+
raise "No Palette.json found.".red
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Creates a sample Palette.json in the local directory'
|
57
|
+
command :touch do |c|
|
58
|
+
c.desc 'Creates a sample Palette.json in the local directory'
|
59
|
+
c.action do |global_options,options,args|
|
60
|
+
working_directory = Dir.pwd
|
61
|
+
local_palettefile = "#{working_directory}/Palette.json"
|
62
|
+
|
63
|
+
tempHash = {
|
64
|
+
"name" => "My Project",
|
65
|
+
"author" => "",
|
66
|
+
"version" => "1.0",
|
67
|
+
"fonts" => [""],
|
68
|
+
"sketch_plugins" => [""]
|
69
|
+
}
|
70
|
+
|
71
|
+
File.open("Palette.json","w") do |f|
|
72
|
+
pprint = tempHash.to_json
|
73
|
+
if f.write(JSON.pretty_generate(JSON.parse(pprint)))
|
74
|
+
puts "Created Palette.json".green
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
pre do |global,command,options,args|
|
81
|
+
# Pre logic here
|
82
|
+
# Return true to proceed; false to abort and not call the
|
83
|
+
# chosen command
|
84
|
+
# Use skips_pre before a command to skip this block
|
85
|
+
# on that command only
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
post do |global,command,options,args|
|
90
|
+
# Post logic here
|
91
|
+
# Use skips_post before a command to skip this
|
92
|
+
# block on that command only
|
93
|
+
end
|
94
|
+
|
95
|
+
on_error do |exception|
|
96
|
+
# Error logic here
|
97
|
+
# return false to skip default error handling
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def clean_palette_tmp_dir
|
102
|
+
system "rm -rf .palette && mkdir .palette"
|
103
|
+
end
|
104
|
+
|
105
|
+
def install_fonts(local_palettefile)
|
106
|
+
fonts_to_install = []
|
107
|
+
file = File.read local_palettefile
|
108
|
+
manifest = Crack::JSON.parse(file)
|
109
|
+
|
110
|
+
puts "#{manifest['name']} #{manifest['version']}".blue
|
111
|
+
|
112
|
+
if manifest['fonts']
|
113
|
+
manifest['fonts'].each do |font_url|
|
114
|
+
download_file(font_url, SecureRandom.hex)
|
115
|
+
end
|
116
|
+
|
117
|
+
Dir.glob(".palette/**/*.otf").each do |unzipped_files|
|
118
|
+
fonts_to_install << unzipped_files
|
119
|
+
@font_install_count += 1
|
120
|
+
end
|
121
|
+
|
122
|
+
Dir.glob(".palette/**/*.ttf").each do |unzipped_files|
|
123
|
+
fonts_to_install << unzipped_files
|
124
|
+
@font_install_count += 1
|
125
|
+
end
|
126
|
+
|
127
|
+
puts "Installing fonts..."
|
128
|
+
system "open #{fonts_to_install.join(" ")}"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def install_sketch_plugins(local_palettefile)
|
133
|
+
plugins_to_install = []
|
134
|
+
|
135
|
+
file = File.read local_palettefile
|
136
|
+
manifest = Crack::JSON.parse(file)
|
137
|
+
|
138
|
+
if manifest['sketch_plugins']
|
139
|
+
manifest['sketch_plugins'].each do |plugin_url|
|
140
|
+
download_file(plugin_url, SecureRandom.hex)
|
141
|
+
end
|
142
|
+
|
143
|
+
puts "Installing Sketch plugins..."
|
144
|
+
|
145
|
+
Dir.glob(".palette/**/*.sketchplugin").each do |unzipped_files|
|
146
|
+
plugins_to_install << unzipped_files
|
147
|
+
parent = File.basename(File.expand_path("..", unzipped_files))
|
148
|
+
filename = File.basename(unzipped_files)
|
149
|
+
|
150
|
+
system "[ -d #{@sketch_plugins_dir}#{parent} ] || mkdir -p #{@sketch_plugins_dir}#{parent}"
|
151
|
+
system "cp -r #{unzipped_files.gsub(/ /, '\ ')} #{@sketch_plugins_dir}#{parent}/#{filename.gsub(/ /, '\ ')}"
|
152
|
+
@sketch_plugin_install_count += 1
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
def download_file(url, unique_id)
|
158
|
+
pbar = nil
|
159
|
+
uri = URI.parse(url)
|
160
|
+
|
161
|
+
system "[ -d .palette/#{unique_id}/ ] || mkdir -p .palette/#{unique_id}/"
|
162
|
+
original_filename = ".palette/#{unique_id}/" + File.basename(uri.path)
|
163
|
+
|
164
|
+
open(original_filename, 'wb') do |file|
|
165
|
+
file << open(url, :content_length_proc => lambda { |t|
|
166
|
+
if t && 0 < t
|
167
|
+
pbar = ProgressBar.new("...", t)
|
168
|
+
pbar.file_transfer_mode
|
169
|
+
end
|
170
|
+
},
|
171
|
+
:progress_proc => lambda {|s|
|
172
|
+
pbar.set s if pbar
|
173
|
+
}, :allow_redirections => :safe).read
|
174
|
+
puts "Downloaded"
|
175
|
+
|
176
|
+
Zip.warn_invalid_date = false
|
177
|
+
Zip::File.open(original_filename) do |zip_file|
|
178
|
+
zip_file.each do |entry|
|
179
|
+
entry.extract(".palette/#{unique_id}/#{entry.name}")
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
exit run(ARGV)
|
data/dpm.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','dpm','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'dpm'
|
5
|
+
s.version = Dpm::VERSION
|
6
|
+
s.author = 'Alasdair Monk'
|
7
|
+
s.email = 'alasdair.monk@gmail.com'
|
8
|
+
s.homepage = 'http://alasdairmonk.com'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'A package manager for designers'
|
11
|
+
s.files = `git ls-files`.split("
|
12
|
+
")
|
13
|
+
s.require_paths << 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.rdoc_options << '--title' << 'dpm' << '--main' << 'README.rdoc' << '-ri'
|
16
|
+
s.bindir = 'bin'
|
17
|
+
s.executables << 'dpm'
|
18
|
+
s.add_development_dependency('rake')
|
19
|
+
s.add_development_dependency('rdoc')
|
20
|
+
s.add_development_dependency('aruba')
|
21
|
+
s.add_runtime_dependency('gli','2.13.4')
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
|
3
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
4
|
+
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
|
5
|
+
|
6
|
+
Before do
|
7
|
+
# Using "announce" causes massive warnings on 1.9.2
|
8
|
+
@puts = true
|
9
|
+
@original_rubylib = ENV['RUBYLIB']
|
10
|
+
ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
|
11
|
+
end
|
12
|
+
|
13
|
+
After do
|
14
|
+
ENV['RUBYLIB'] = @original_rubylib
|
15
|
+
end
|
data/lib/dpm.rb
ADDED
data/lib/dpm/version.rb
ADDED
data/palette.rdoc
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dpm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alasdair Monk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aruba
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gli
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.13.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.13.4
|
69
|
+
description:
|
70
|
+
email: alasdair.monk@gmail.com
|
71
|
+
executables:
|
72
|
+
- dpm
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Bold.ttf"
|
77
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldCondensed.ttf"
|
78
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldItalic.ttf"
|
79
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldItalicCondensed.ttf"
|
80
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Italic.ttf"
|
81
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-ItalicCondensed.ttf"
|
82
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Regular.ttf"
|
83
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-RegularCondensed.ttf"
|
84
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/SIL Open Font License.txt"
|
85
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/f66c3b2c25d2e040bdc211d96fad2b9c.pdf"
|
86
|
+
- ".palette/60bfbcc986a4ae31c7b4055ee630e83a/junicode"
|
87
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/master.zip"
|
88
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/dockpreview.coscript"
|
89
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/manifest.json"
|
90
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/sandbox.js"
|
91
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/source.coscript"
|
92
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/LICENSE"
|
93
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/README.md"
|
94
|
+
- ".palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/sketchpack.json"
|
95
|
+
- ".palette/cd425a1f5df660fb52ce8c7ab0b20a56/Inconsolata"
|
96
|
+
- ".palette/cd425a1f5df660fb52ce8c7ab0b20a56/Inconsolata.otf"
|
97
|
+
- ".palette/cd425a1f5df660fb52ce8c7ab0b20a56/SIL Open Font License.txt"
|
98
|
+
- Gemfile
|
99
|
+
- Gemfile.lock
|
100
|
+
- Palette.json
|
101
|
+
- README.rdoc
|
102
|
+
- Rakefile
|
103
|
+
- bin/dpm
|
104
|
+
- dpm.gemspec
|
105
|
+
- features/palette.feature
|
106
|
+
- features/step_definitions/palette_steps.rb
|
107
|
+
- features/support/env.rb
|
108
|
+
- lib/dpm.rb
|
109
|
+
- lib/dpm/version.rb
|
110
|
+
- palette.rdoc
|
111
|
+
- test/default_test.rb
|
112
|
+
- test/test_helper.rb
|
113
|
+
homepage: http://alasdairmonk.com
|
114
|
+
licenses: []
|
115
|
+
metadata: {}
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options:
|
118
|
+
- "--title"
|
119
|
+
- dpm
|
120
|
+
- "--main"
|
121
|
+
- README.rdoc
|
122
|
+
- "-ri"
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.4.5.1
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: A package manager for designers
|
142
|
+
test_files: []
|