├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md └── SketchToGit.sketchplugin └── Contents └── Sketch ├── app.js ├── common.js └── manifest.json /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## 1. Purpose 4 | 5 | A primary goal of Sketch Post Repo is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof). 6 | 7 | This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior. 8 | 9 | We invite all those who participate in Sketch Post Repo to help us create safe and positive experiences for everyone. 10 | 11 | ## 2. Open Source Citizenship 12 | 13 | A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community. 14 | 15 | Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society. 16 | 17 | If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know. 18 | 19 | ## 3. Expected Behavior 20 | 21 | The following behaviors are expected and requested of all community members: 22 | 23 | * Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community. 24 | * Exercise consideration and respect in your speech and actions. 25 | * Attempt collaboration before conflict. 26 | * Refrain from demeaning, discriminatory, or harassing behavior and speech. 27 | * Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential. 28 | * Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations. 29 | 30 | ## 4. Unacceptable Behavior 31 | 32 | The following behaviors are considered harassment and are unacceptable within our community: 33 | 34 | * Violence, threats of violence or violent language directed against another person. 35 | * Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language. 36 | * Posting or displaying sexually explicit or violent material. 37 | * Posting or threatening to post other people’s personally identifying information ("doxing"). 38 | * Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability. 39 | * Inappropriate photography or recording. 40 | * Inappropriate physical contact. You should have someone’s consent before touching them. 41 | * Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances. 42 | * Deliberate intimidation, stalking or following (online or in person). 43 | * Advocating for, or encouraging, any of the above behavior. 44 | * Sustained disruption of community events, including talks and presentations. 45 | 46 | ## 5. Consequences of Unacceptable Behavior 47 | 48 | Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated. 49 | 50 | Anyone asked to stop unacceptable behavior is expected to comply immediately. 51 | 52 | If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event). 53 | 54 | ## 6. Reporting Guidelines 55 | 56 | If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. kylian.le.mette@gmail.com. 57 | 58 | 59 | 60 | Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress. 61 | 62 | ## 7. Addressing Grievances 63 | 64 | If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify Kylian Lm with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies. 65 | 66 | 67 | 68 | ## 8. Scope 69 | 70 | We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business. 71 | 72 | This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members. 73 | 74 | ## 9. Contact info 75 | 76 | kylian.le.mette@gmail.com 77 | 78 | ## 10. License and attribution 79 | 80 | This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/). 81 | 82 | Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy). 83 | 84 | Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/) 85 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue, 4 | email, or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a code of conduct, please follow it in all your interactions with the project. 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Mathieu Dutour 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## (WIP) Sketch To Git 3 | 4 | need Sketch 43+ 5 | 6 | ### Install 7 | 8 | Download Zip File, and double click on SketchToGit.sketchplugin. 9 | That's it 10 | 11 | ### Git 12 | 13 | This plugin don't manage your git folder. You need to do this with CLI or GUI. 14 | 15 | To use git with CLI 16 | ``` 17 | $ git init 18 | $ git checkout -b newBranch 19 | ``` 20 | Make your change on sketch. 21 | Click on Unzip option or press Cmd + Shift + U. 22 | 23 | Don't forget to generate .gitignore with "*.sketch" 24 | 25 | Then 26 | ``` 27 | $ git add --all 28 | $ git commit -m "[CHG] DESCRIBE YOUR CHANGE HERE" 29 | ``` 30 | 31 | You can do this with Git GUI like Git Kraken or Github Desktop. 32 | 33 | ------ 34 | Inspired by 35 | https://github.com/mathieudutour/git-sketch-plugin 36 | -------------------------------------------------------------------------------- /SketchToGit.sketchplugin/Contents/Sketch/app.js: -------------------------------------------------------------------------------- 1 | @import 'common.js' 2 | 3 | var onRun = function (context) { 4 | var doc = context.document; 5 | unzip(context, doc.displayName()); 6 | } 7 | 8 | var onGenerateIgnore = function (context) { 9 | cli(context, 'echo "*.sketch" >> .gitignore'); 10 | } 11 | 12 | var onRepoInfo = function (context) { 13 | var sketch = context.api(), 14 | branch = getTheCurrentBranch(context), 15 | remote = getTheCurrentRemote(context); 16 | sketch.alert(remote,branch); 17 | } 18 | 19 | var onReload = function (context) { 20 | var doc = context.document, 21 | sketch = context.api(); 22 | var inputs = sketch.getSelectionFromUser("You confirm to reload ?", ["Yes"], 0); 23 | if (inputs[0] != "1001") { 24 | reloadSketch(context, doc.displayName()); 25 | [NSApp sendAction:'saveDocument:' to:nil from:doc] 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /SketchToGit.sketchplugin/Contents/Sketch/common.js: -------------------------------------------------------------------------------- 1 | function removeFileExtension(layerName){ 2 | if([layerName containsString:@"."]){ 3 | var nameArray = [layerName componentsSeparatedByString:@"."]; 4 | var name = nameArray[0]; 5 | return name; 6 | } else { 7 | return layerName; 8 | } 9 | } 10 | 11 | function cli(context, command) { 12 | var task = NSTask.alloc().init() 13 | var pipe = NSPipe.pipe() 14 | 15 | var path = getCurrentDirectory(context) 16 | command = `cd "${path}" && ${command}` 17 | 18 | task.setLaunchPath_('/bin/bash') 19 | task.setArguments_(NSArray.arrayWithObjects_('-c', '-l', command, null)) 20 | task.standardOutput = pipe 21 | task.launch() 22 | 23 | const data = pipe.fileHandleForReading().readDataToEndOfFile() 24 | return NSString.alloc().initWithData_encoding_(data, NSUTF8StringEncoding) 25 | } 26 | 27 | function getCurrentDirectory (context) { 28 | return context.document.fileURL().URLByDeletingLastPathComponent().path() 29 | } 30 | 31 | function getTheCurrentBranch (context) { 32 | return cli(context, "git rev-parse --abbrev-ref HEAD"); 33 | } 34 | 35 | function getTheCurrentRemote (context) { 36 | return cli(context, "git ls-remote --get-url"); 37 | } 38 | 39 | function unzip(context, name) { 40 | var docname = removeFileExtension(name); 41 | cli(context, `cp ${name} ${docname}.zip`); 42 | cli(context, `unzip -o ${docname}.zip -d ${docname} && rm -Rf ${docname}.zip`); 43 | cli(context, `rm -Rf ${docname}/previews`); 44 | } 45 | 46 | function reloadSketch(context, name) { 47 | var docname = removeFileExtension(name); 48 | cli(context, `cd ${docname} && zip ${docname}.zip -r .`); 49 | cli(context, `cd ${docname} && cp ${docname}.zip ../${docname}.sketch`); 50 | cli(context, `rm -Rf ${docname}/${docname}.zip`); 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /SketchToGit.sketchplugin/Contents/Sketch/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "Sketch To Git", 3 | "identifier" : "sketch.to.git.plugin", 4 | "version" : "0.1.0", 5 | "description" : "Sketch To Git", 6 | "authorEmail" : "kylian.le.mette@gmail.com", 7 | "author" : "Le Mette Kylian", 8 | "homepage":"https://github.com/KylianLM/sketch-to-git", 9 | "downloadURL": "https://github.com/KylianLM/sketch-to-git/downloads", 10 | "updateURL": "https://github.com/KylianLM/sketch-to-git/downloads", 11 | "compatibleVersion": "3", 12 | "commands" : [ 13 | { 14 | "script" : "app.js", 15 | "handler" : "onRun", 16 | "shortcut" : "command shift u", 17 | "name" : "Unzip", 18 | "identifier" : "sketch.to.git.unzip" 19 | }, 20 | { 21 | "script": "app.js", 22 | "handler": "onReload", 23 | "shortcut" : "command shift h", 24 | "name" : "Directory to Sketch", 25 | "identifier": "sketch.to.git.reload" 26 | }, 27 | { 28 | "script" : "app.js", 29 | "handler": "onGenerateIgnore", 30 | "shortcut" : "command shift i", 31 | "name" : "Generate Ignore File", 32 | "identifier" : "sketch.to.git.ignore" 33 | }, 34 | { 35 | "script": "app.js", 36 | "handler": "onRepoInfo", 37 | "shortcut": "command shift b", 38 | "name": "Get repository information", 39 | "identifier": "sketch.to.git.repo" 40 | } 41 | ], 42 | } 43 | --------------------------------------------------------------------------------