dpm 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/Palette.json +8 -9
  4. data/bin/dpm +13 -9
  5. data/lib/dpm/version.rb +1 -1
  6. metadata +2 -23
  7. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Bold.ttf +0 -0
  8. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldCondensed.ttf +0 -0
  9. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldItalic.ttf +0 -0
  10. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-BoldItalicCondensed.ttf +0 -0
  11. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Italic.ttf +0 -0
  12. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-ItalicCondensed.ttf +0 -0
  13. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-Regular.ttf +0 -0
  14. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/Junicode-RegularCondensed.ttf +0 -0
  15. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/SIL Open Font License.txt +0 -41
  16. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/f66c3b2c25d2e040bdc211d96fad2b9c.pdf +0 -0
  17. data/.palette/60bfbcc986a4ae31c7b4055ee630e83a/junicode +0 -0
  18. data/.palette/a626645c7f4389575c047ade7fc39dd2/master.zip +0 -0
  19. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/dockpreview.coscript +0 -111
  20. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/manifest.json +0 -32
  21. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/sandbox.js +0 -193
  22. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/Dockpreview.sketchplugin/Contents/Sketch/source.coscript +0 -4
  23. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/LICENSE +0 -21
  24. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/README.md +0 -45
  25. data/.palette/a626645c7f4389575c047ade7fc39dd2/sketch-dockpreview-master/sketchpack.json +0 -5
  26. data/.palette/cd425a1f5df660fb52ce8c7ab0b20a56/Inconsolata +0 -0
  27. data/.palette/cd425a1f5df660fb52ce8c7ab0b20a56/Inconsolata.otf +0 -0
  28. data/.palette/cd425a1f5df660fb52ce8c7ab0b20a56/SIL Open Font License.txt +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 452c8025abdf8622a9b679601dd8ff95d9bdc56c
4
- data.tar.gz: a3d6691ac0443446141b5e32ac077be9437c40ea
3
+ metadata.gz: c123444865aae70f7cd5210b47a2e06fe4288e95
4
+ data.tar.gz: 9168a0301e124c1979fc146968795b0dfb97727b
5
5
  SHA512:
6
- metadata.gz: 600f700ef9d584e20df1e48ee895f30ed521b5db00ccd725795f6100bd5633c5fd08ab1f1e952dc0e0387d8075c5f535343021b972c466d448870772f45a5b89
7
- data.tar.gz: 57f4c2fac8428e19b71fcf03bd17f403e82d089ac56f40be1cd83f46a7be8f0baec16095132090bf1787912b0538f5a2ec8862c86ef091c43b1ad41b05d76056
6
+ metadata.gz: 6c3138bc7f7578a5aed0910292f9736fbabe677387a9c879c5ba59945976c6943bd44b89964846283371d1a5f711ee759220a1d5ee142814d3f02f5e87da3c8c
7
+ data.tar.gz: f4148b1faa7e4fb75cd2d1c61188a20ab303389ec251ab2440fb9f5ff12cb086ffdf29c8240875b03696f8f495353acd1cba7187610149dd66ef0260dba5f72b
@@ -0,0 +1,4 @@
1
+ .palette/**
2
+ .palette/*
3
+ .palette
4
+ pkg
@@ -1,12 +1,11 @@
1
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",
2
+ "name": "My Project",
3
+ "author": "",
4
+ "version": "1.0",
5
+ "fonts": [
6
+
8
7
  ],
9
- "sketch_plugins" : [
10
- "https://github.com/fnky/sketch-dockpreview/archive/master.zip"
8
+ "sketch_plugins": [
9
+
11
10
  ]
12
- }
11
+ }
data/bin/dpm CHANGED
@@ -60,18 +60,22 @@ command :touch do |c|
60
60
  working_directory = Dir.pwd
61
61
  local_palettefile = "#{working_directory}/Palette.json"
62
62
 
63
- tempHash = {
63
+ if File.exists?(local_palettefile)
64
+ puts "Palette.json already exists".red
65
+ else
66
+ tempHash = {
64
67
  "name" => "My Project",
65
68
  "author" => "",
66
69
  "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
70
+ "fonts" => [],
71
+ "sketch_plugins" => []
72
+ }
73
+
74
+ File.open("Palette.json","w") do |f|
75
+ pprint = tempHash.to_json
76
+ if f.write(JSON.pretty_generate(JSON.parse(pprint)))
77
+ puts "Created Palette.json".green
78
+ end
75
79
  end
76
80
  end
77
81
  end
@@ -1,3 +1,3 @@
1
1
  module Dpm
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alasdair Monk
@@ -73,28 +73,7 @@ executables:
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
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"
76
+ - ".gitignore"
98
77
  - Gemfile
99
78
  - Gemfile.lock
100
79
  - Palette.json
@@ -1,41 +0,0 @@
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.
@@ -1,111 +0,0 @@
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();
@@ -1,32 +0,0 @@
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
- }
@@ -1,193 +0,0 @@
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
- })
@@ -1,4 +0,0 @@
1
- @import 'dockpreview.coscript';
2
-
3
- var setAppIcon = Dockpreview.setAppIconImage;
4
- var restoreAppIcon = Dockpreview.restoreAppIconImage;
@@ -1,21 +0,0 @@
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.
@@ -1,45 +0,0 @@
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)
@@ -1,5 +0,0 @@
1
- {
2
- "name": "Sketch Dockpreview",
3
- "description": "A Sketch plugin that lets you preview your current artboard in the Dock.",
4
- "tags": ["dock", "preview"]
5
- }
@@ -1,41 +0,0 @@
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.