octokitty 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a87dc2eedebd8894c34b0d84013363bdf69e205d
4
+ data.tar.gz: 70fa0d4fcf26e8fdef77f97c3c43cc37c0edf96e
5
+ SHA512:
6
+ metadata.gz: 497a8b46852e88b5f5ece502cb91764df5920267390d7a4a53ec93e710e4012710b682a489a363005b40cf9d514f87c9ff63dc976b73968ebabe801c532e7ac4
7
+ data.tar.gz: 4588ed28e17a6858c3f85ca8f9fdc3dc25ce3442b44cd82d5f661488095e0e0f15b0c8cc56555ba1e81f73edf802666b1cce60b055287a71a5d537473146e223
@@ -0,0 +1 @@
1
+ vendor/**
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'octokit', '~> 4.2', '>= 4.2.0'
@@ -0,0 +1,21 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.3.8)
5
+ faraday (0.9.2)
6
+ multipart-post (>= 1.2, < 3)
7
+ multipart-post (2.0.0)
8
+ octokit (4.2.0)
9
+ sawyer (~> 0.6.0, >= 0.5.3)
10
+ sawyer (0.6.0)
11
+ addressable (~> 2.3.5)
12
+ faraday (~> 0.8, < 0.10)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ octokit (~> 4.2, >= 4.2.0)
19
+
20
+ BUNDLED WITH
21
+ 1.11.2
@@ -0,0 +1,21 @@
1
+
2
+ The MIT License (MIT)
3
+ Copyright © 2016 Chris Olstrom <chris@olstrom.com>
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
+ #+TITLE: OctoKiTTY
2
+ #+SUBTITLE: Like busybox for the GitHub API
3
+
4
+ #+LATEX: \pagebreak
5
+
6
+ * Overview
7
+
8
+ OctoKiTTY is a GitHub API Client written in Ruby.
9
+
10
+ * Installation
11
+
12
+ #+BEGIN_SRC shell
13
+ gem install octokitty
14
+ #+END_SRC
15
+
16
+ * Usage
17
+
18
+ How to use OctoKiTTY depends on the API call you wish to make. Calling it with
19
+ no parameters will give you proper usage for the interface you invoked.
20
+
21
+ ** Examples
22
+
23
+ #+BEGIN_SRC shell
24
+ $ create_status
25
+
26
+ usage: create_status <repo> <sha> <state> [options]
27
+ #+END_SRC
28
+
29
+ #+BEGIN_SRC shell
30
+ $ pull_requests
31
+
32
+ usage: pull_requests <repo> [options]
33
+ #+END_SRC
34
+
35
+ ** Environment
36
+
37
+ OctoKiTTY expects to find ~GITHUB_ACCESS_TOKEN~ in the environment.
38
+
39
+ * License
40
+
41
+ In keeping with the spirit of GitHub, OctoKiTTY is released under the [[https://tldrlegal.com/license/mit-license][MIT
42
+ License]]. See ~LICENSE.txt~ for the full text.
43
+
44
+ * Contributors
45
+ - [[https://colstrom.github.io/][Chris Olstrom]] | [[mailto:chris@olstrom.com][e-mail]] | [[https://twitter.com/ChrisOlstrom][Twitter]]
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'octokit'
4
+ require 'json'
5
+
6
+ class OctoKiTTY
7
+ def github
8
+ @github ||= Octokit::Client.new auto_paginate: true, access_token: ENV.fetch('GITHUB_ACCESS_TOKEN')
9
+ end
10
+ end
11
+
12
+ github = OctoKiTTY.new.github
13
+
14
+ command = File.basename($0).gsub('-', '_')
15
+
16
+ if command == 'octokitty'
17
+ if ARGV.empty?
18
+ puts 'usage: octokitty <function>'
19
+ exit false
20
+ else
21
+ command = ARGV.shift.gsub('-', '_')
22
+ end
23
+ end
24
+
25
+ required, optional = github.method(command).parameters.partition { |p,_| p == :req }.map { |l| l.flat_map { |p| p.last } }
26
+ arguments = ARGV.shift(required.length)
27
+ options = ARGV.select { |a| a.start_with? '--' }.map{ |a| a[2..-1].to_sym }.zip(ARGV.reject { |a| a.start_with? '--' }).to_h
28
+
29
+ if arguments.length < required.length
30
+ printf "usage: %s %s %s\n", command, required.map { |r| "<#{r}>" }.join(' '), optional.map { |o| "[#{o}]" }.join(' ')
31
+ exit false
32
+ end
33
+
34
+ puts JSON.dump github.method(command).call(*arguments, options).map(&:to_h)
@@ -0,0 +1,15 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = 'octokitty'
3
+ gem.version = '1.0.0'
4
+ gem.licenses = 'MIT'
5
+ gem.authors = ['Chris Olstrom']
6
+ gem.email = 'chris@olstrom.com'
7
+ gem.homepage = 'http://colstrom.github.io/octokitty/'
8
+ gem.summary = 'Like busybox for the GitHub API'
9
+ gem.description = 'OctoKiTTY brings the GitHub API to your Terminal, in a manner inspired by busybox.'
10
+
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
13
+
14
+ gem.add_runtime_dependency 'octokit', '~> 4.2', '>= 4.2.0'
15
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octokitty
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Olstrom
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: octokit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.2.0
33
+ description: OctoKiTTY brings the GitHub API to your Terminal, in a manner inspired
34
+ by busybox.
35
+ email: chris@olstrom.com
36
+ executables:
37
+ - octokitty
38
+ extensions: []
39
+ extra_rdoc_files: []
40
+ files:
41
+ - ".gitignore"
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - LICENSE.txt
45
+ - README.org
46
+ - bin/octokitty
47
+ - octokitty.gemspec
48
+ homepage: http://colstrom.github.io/octokitty/
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.5.1
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Like busybox for the GitHub API
72
+ test_files: []
73
+ has_rdoc: