gislacks
This is a plugin of Sublime Text 3 for submitting files to both Gist and Slack.
Details
Installs
- Total 108
- Win 61
- Mac 29
- Linux 18
Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
gislacks
Overview
This is a plugin of Sublime Text 3 for submitting files to both Gist and Slack.
Description
I like to use Sublime Text for developing scripts. And when I discuss about developing scripts, I often use Slack. When I submitted a script to Slack, I had saved the script to Gist as a backup. I had done manually this on my browser. Namely, I wanted to be saving the revision of script while I'm discussing about the script at Slack. One day, I wished this process had been able to be automatically run. So I created this plugin and gislack of a CLI tool.
I had created and used this by only myself, Recently, I thought that this also might be useful for other developers. So I published this. If you felt this is useful, I'm glad.
By this, the local environment for developing Google Apps Script (GAS) became more convenient.
Features
Submits files to both Gist and Slack, simultaneously.
Submits, gets and updates files for Gist.
Submits, gets files for Slack.
Retrieves access token from client ID and client secret for Gist and Slack.
Demo
This is a demonstration for submitting a GAS written by CoffeeScript to both Gist and Slack using Sublime Text. You can confirm that the revision of script uploaded to gist increases. The Google Apps Script is run by ggsrun.
How to Install
This plugin is constructed with following 2 tools.
1. Install gislacks
This is the plugin for Sublime Text 3.
This was published at https://packagecontrol.io/packages/gislacks.
- Launch Sublime Text
- Preferences -> Package Control -> Package Control: Install Package
- Choose gislacks
If you want to install directory the repository, you can use as following flow.
- Open Package Control by
ctrl+shift+p
(Windows, Linux) orcmd+shift+p
(OS X) - Select Add Repository at Package Control.
- Input https://github.com/tanaikech/gislacks. This is a repository of gislacks on GitHub.
- Select Install Package at Package Control.
- Find gislacks and select it. By this, gislacks is installed on your Sublime Text 3.
2. Install gislack
This is a CLI tool which is the interface between Sublime Text and Gist, Slack.
Download an executable file of gislack from the release page and import to a directory with path.
or
Use go get.
$ go get -u github.com/tanaikech/gislack
If you want to compile this on your PC, please also get a library https://github.com/tanaikech/getcode.
Retrieve Client ID and Client Secret
In order to use the plugin gislacks, at first, please retrieve client ID and client secret from GitHub and Slack.
1. Gist (GitHub)
- Login to GitHub.
- Open Developer applications page. https://github.com/settings/developers
- Click Register new application button.
- Input Application name, Homepage URL, Application description, Authorization callback URL. Authorization callback URL is
http://localhost:8080
. - After inputted the information, click register application.
- Copy Client ID and Client Secret.
2. Slack
- Login to Slack.
- Open Your Apps page. https://api.slack.com/apps
- Click Create New App button.
- Input App Name and Development Slack Team.
- After inputted the information, click Create App.
- Click OAuth & Permissions at left side or Permissions at Add features and functionality.
- Click Add a new Redirect URL.
- Input
http://localhost:8080
as a new Redirect URL. - Click Save URLs
- Click Basic Information at left side.
- Copy Client ID and Client Secret at App Credentials. When you see Client Secret, click the show button.
Usage
1. gislacks.sublime-settings
At first, please modify gislacks.sublime-settings
at Preferences -> Package Settings -> gislacks -> Settings-User. And please open your working folder by “File -> Open Folder”. The working folder is used as a saved place of file from Gist and Slack.
// gislack default settings.
//
{
// Path of gislack which is an execution file made by golang.
// If gislack is put in defined path, it is not necessary to set this.
"gislack_path": "",
// Path of gislack.cfg. If you want to use gislack.cfg at except for current working directory, please use this.
// If gislack.cfg is put in current working directory, it is not necessary to set this.
// This path is used with the highest priority.
"gislack_cfgpath": "",
// This parameter is used for submitting to Gist. When you want to submit a file to Gist as public,
// please modify this parameter to "true". Default is false. So your file is submitted as private.
"gist_public": false,
// Channel on Slack. This is a channel name you want to submit.
// For channel name, the top `#` is not required.
"slack_channel": "general",
}
2. Authorization
As a next step, please retrieve access token from Gist (GitHub) and Slack using each client ID and client Secret.
If you want to retrieve each access token using this plugin, please check here.
Authorization by Terminal
- Launch your terminal.
- Run following code. Please run following commands for GitHub and Slack.
For Gist (GitHub)
$ gislack auth -gi [client ID of GitHub] -gs [client secret of Github]
For Slack
$ gislack auth -si [client ID of Slack] -ss [client secret of Slack]
Following flow is the same to GitHub and Slack.
- When above is run, your browser is launched and waits for login to GitHub (or Slack).
- Please login to GitHub (or Slack).
- It opens authorization page. If the authorization button appears, please authorize it. If the button cannot be seen, a page with authorization code is opened.
- The authorization code can be retrieved automatically. And
Done
. is displayed on your terminal.- If your browser isn't launched or spends for 30 seconds from the wait of authorization, it becomes the input work queue. This is a manual mode. Please copy displayed URL and paste it to your browser, and login to GitHub (or Slack). A code is displayed on the browser. Please copy it and paste it to your terminal during the input work queue. If you cannot find the code on your browser, please check the URL of your browser.
- When
Done
is displayed on your terminal, the authorization is completed andgislack.cfg
is created on a directory you currently stay. (If you setcfgdirectory
as an option,gislack.cfg
is created to the directory set bycfgdirectory
.) - The priority of directory for
gislack.cfg
is as follows.- Option
--cfgdirectory=#####
or-cfgdir #####
. - Environment variable :
GISLACK_CFG_PATH
(For example, you can write this for.bashrc
asexport GISLACK_CFG_PATH=#####
.) - Current working directory.
- Option
Retrieved access tokens from GitHub and Slack have no limitation time. So the authorization process is only one time.
Congratulation! Here, the preparation for using gislacks was completed.
3. How to Submit File from Sublime Text using Plugin gislacks
Following explanations are for Sublime Text 3 using the plugin gislacks. In order to prevent miss for using shortcuts, the delete commands cannot be used at Sublime Text.
If following shortcuts are duplicated to your environment, please modify Default (Windows).sublime-keymap
or Default (OSX).sublime-keymap
or Default (Linux).sublime-keymap
.
Works | Default shortcut key (Windows, Linux) |
Default shortcut key (OS X) |
Command Palettectrl + shift + p ,cmd + shift + p |
---|---|---|---|
New Submission for Slack and Submission with Revision for Gist **1* |
ctrl + alt + w |
cmd + option + w |
gislacks: Submit to Gist (update) and Slack |
New Submission for Slack and Gist | ctrl + alt + e |
cmd + option + e |
gislacks: Submit to Gist and Slack |
New Submission for Gist **2* | ctrl + alt + a |
cmd + option + a |
gislacks: Submit to Gist |
New Submission for Slack | ctrl + alt + s |
cmd + option + s |
gislacks: Submit to Slack |
Get Gist **3* | ctrl + alt + z |
cmd + option + z |
gislacks: Get Gists |
Update Gist | ctrl + alt + x |
cmd + option + x |
gislacks: Update Gists |
Get Gist History | ctrl + alt + c |
cmd + option + c |
gislacks: Get Gist History |
Get Slack Files | ctrl + alt + v |
cmd + option + v |
gislacks: Get Slack Files |
Get Access Token from Gist (GitHub) | ctrl + alt + b |
cmd + option + b |
gislacks: Authorization Gist |
Get Access Token from Slack | ctrl + alt + n |
cmd + option + n |
gislacks: Authorization Slack |
- **1*: When it submits a file to both. After first submission was done, the file name is changed from original to the name included gist ID. This plugin updates the gist using this gist ID. Don't worry. The original file is not deleted.
- **2*: At Sublime Text, several files can not be uploaded as a gist. If you want to upload several files as a gist, please use gislack on terminal.
- **3*: At Sublime Text, a gist included several files can not be opened. If you want to get a gist with several files, please use gislack on terminal.
If you want to submit your files on your terminal, you can use gislack of CLI tool.
Other Demonstrations
Get Gist and Update It
By ctrl + alt + t
(Windows, Linux) or cmd + option + t
(OS X), the list of gists is opened. When you select one of them, the selected gist is opened on Sublime Text. After you modified the file, by ctrl + alt + y
(Windows, Linux) or cmd + option + y
(OS X), the selected gist is updated by the modified file.
The flow of this demo is as follows.
- Retrieve a Gist.
- Retrieve one more Gist.
- Run the Gist
- Modify the retrieved Gist.
- Run the modified Gist.
- Upload the modified Gist.
- Retrieve a version from the Gist's history.
- Run the retrieved Gist.
Get Slack File
By ctrl + alt + i
(Windows, Linux) or cmd + option + i
(OS X), the list of slack files is opened. When you select one of them, the selected file is opened on Sublime Text. In the case of Slack, the file cannot be updated.
The flow of this demo is as follows.
- Retrieve a file from Slack.
- Run the file
- Upload the file.
References
APIs
- Gist API document https://developer.github.com/v3/gists/
- Slack API document https://api.slack.com/methods
Controlling gislack by JSON
gislack can be controlled by JSON data. Using this, gislack may be used except for Sublime Text. The parameters for JSON can be seen at useJSON()
in handler.go
on https://github.com/tanaikech/gislack.
Update History
v1.0.0 (June 22, 2017)
Initial release.
v1.0.1 (June 22, 2017)
Modified Key Bindings.
v1.0.2 (June 23, 2017)
Added an option for submitting to Gist as public.