tinygist 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/bin/tinygist +32 -0
- data/lib/tinygist.rb +44 -0
- data/lib/tinygist/version.rb +3 -0
- data/tinygist.gemspec +27 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7c9cf71eddd61ee447b2efb4443f866fee17bbaea6e1e74fd48d5fa5e054cbf7
|
4
|
+
data.tar.gz: 30c6d8467de2631fae3941c0ca054f14ed53ba04ba11df04ba0bfcc68cf9a2d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13ce1ac61317be30f6b5c436549e7f00f903ae9d01aa6e3529e4e60105c3d5dcc68933bf4036396c8f981f3715c80b6df5c08b3722fcc84f6187541f1a66a6f7
|
7
|
+
data.tar.gz: ca32c98dbf9c432fda69cd5b1a849966c19fb7fd2bd579fd376cc74def1539d835f62c1466d3b1f6b9b107b3a174b63639fdbbe01066a2b22c5fb29f1fd84f4b
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at ritiekmalhotra123@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 ritiek
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# tinygist
|
2
|
+
|
3
|
+
A simple tool to to share gist content from and to clipboard.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
$ gem install tinygist
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
```
|
14
|
+
$ tinygist
|
15
|
+
usage: bin/tinygist [-d | -u] <unique_identifier>
|
16
|
+
```
|
17
|
+
|
18
|
+
Create a new gist from your clipboard content:
|
19
|
+
```
|
20
|
+
$ tinygist -u <some_unique_keywords>
|
21
|
+
```
|
22
|
+
|
23
|
+
Get the gist content on another PC's clipboard:
|
24
|
+
```
|
25
|
+
$ tinygist -d <same_unique_keywords>
|
26
|
+
```
|
27
|
+
|
28
|
+
**BEWARE:** Make sure you do not have any sensitive data on your
|
29
|
+
clipboard before sharing your content. You won't be able to remove it later on!
|
30
|
+
(Even though we create a secret gist but prying eyes can reach anywhere!)
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome. This project is intended to be a safe
|
35
|
+
, welcoming space for collaboration, and contributors are expected to adhere to
|
36
|
+
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the
|
41
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
42
|
+
|
43
|
+
## Code of Conduct
|
44
|
+
|
45
|
+
Everyone interacting in the tinygist project’s codebases, issue trackers,
|
46
|
+
chat rooms and mailing lists is expected to follow
|
47
|
+
the [code of conduct](https://github.com/[USERNAME]/tinygist/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/tinygist
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "tinygist"
|
4
|
+
require "clipboard"
|
5
|
+
|
6
|
+
extend Tinygist
|
7
|
+
help = "usage: #{$0} [-d | -u] <unique_identifier>"
|
8
|
+
|
9
|
+
type = ARGV[0]
|
10
|
+
short_name = ARGV[1]
|
11
|
+
|
12
|
+
if ARGV.count < 2
|
13
|
+
puts help
|
14
|
+
abort
|
15
|
+
end
|
16
|
+
|
17
|
+
if type == '-d'
|
18
|
+
url = self.get_gist_url(short_name)
|
19
|
+
code = self.raw_code(url)
|
20
|
+
Clipboard.copy(code)
|
21
|
+
puts 'copied from ' + url
|
22
|
+
elsif type == '-u'
|
23
|
+
raw_url = self.create_gist(short_name, Clipboard.paste())
|
24
|
+
response = self.shorten_url(raw_url, short_name)
|
25
|
+
puts response.code
|
26
|
+
if response.code == '201'
|
27
|
+
puts response['location']
|
28
|
+
puts raw_url
|
29
|
+
end
|
30
|
+
else
|
31
|
+
puts help
|
32
|
+
end
|
data/lib/tinygist.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require "tinygist/version"
|
2
|
+
require 'net/http'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Tinygist
|
6
|
+
def get_gist_url(name)
|
7
|
+
response = Net::HTTP.get_response(URI('https://git.io/' + name))
|
8
|
+
gist_url = response['location']
|
9
|
+
return gist_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def raw_code(gist_url)
|
13
|
+
gist = Net::HTTP.get_response(URI(gist_url))
|
14
|
+
code = gist.body
|
15
|
+
return code
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_gist(name, code)
|
19
|
+
uri = URI('https://api.github.com/gists')
|
20
|
+
payload = {
|
21
|
+
'public' => false,
|
22
|
+
'files' => {
|
23
|
+
name => {
|
24
|
+
'content' => code
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
req = Net::HTTP::Post.new(uri.path)
|
30
|
+
req.body = payload.to_json
|
31
|
+
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|
|
32
|
+
http.request(req)
|
33
|
+
end
|
34
|
+
|
35
|
+
raw_url = JSON.parse(res.body)['files'][name]['raw_url']
|
36
|
+
return raw_url
|
37
|
+
end
|
38
|
+
|
39
|
+
def shorten_url(github_url, code)
|
40
|
+
uri = URI('https://git.io')
|
41
|
+
response = Net::HTTP.post_form(uri, 'url' => github_url, 'code' => code)
|
42
|
+
return response
|
43
|
+
end
|
44
|
+
end
|
data/tinygist.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "tinygist/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "tinygist"
|
8
|
+
spec.version = Tinygist::VERSION
|
9
|
+
spec.authors = ["ritiek"]
|
10
|
+
spec.email = ["ritiekmalhotra123@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "A simple tool to to share gist content from and to clipboard."
|
13
|
+
spec.homepage = "https://github.com/ritiek/tinygist"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "clipboard", "~> 1.1"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tinygist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ritiek
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-02-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: clipboard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- ritiekmalhotra123@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CODE_OF_CONDUCT.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/tinygist
|
69
|
+
- lib/tinygist.rb
|
70
|
+
- lib/tinygist/version.rb
|
71
|
+
- tinygist.gemspec
|
72
|
+
homepage: https://github.com/ritiek/tinygist
|
73
|
+
licenses:
|
74
|
+
- MIT
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.7.3
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: A simple tool to to share gist content from and to clipboard.
|
96
|
+
test_files: []
|