tantrum 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/tantrum +30 -0
  3. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 41b51475c7fd8b5c23237f8a674899701a29724e
4
+ data.tar.gz: 86b136828f190ec51ae3cae3181120cf7f734687
5
+ SHA512:
6
+ metadata.gz: 9ad9049e2ec5720b1e6ac56f6364dd7ab9573b7add5e37f3f54d036a1da7e105e7e47f7dad7780c06220794fb7d25429b2ad82e628ff411a6005819c572fe603
7
+ data.tar.gz: c86d557424e8e9a0d451296ae29c188207e1e5db656e8f5f9ec2cda55ca165385da42fcd58999842e2d2d34046ca07fe6617392471be080f36bb144cddfda760
data/tantrum ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+ require 'net/http'
3
+ require 'uri'
4
+ require 'json'
5
+
6
+ @token = ENV['TANTRUM_TOKEN']
7
+
8
+ abort('Usage: tantrum [PR url]') if ARGV.count != 1 or ARGV.first == '-h'
9
+ abort('Error: Set TANTRUM_TOKEN') if @token.nil?
10
+
11
+ def request(verb, url, body = {})
12
+ uri = URI.parse(url)
13
+ req = Object.const_get("Net::HTTP::#{verb.capitalize}").new(uri)
14
+ req['authorization'] = "token #{@token}"
15
+ req['User-Agent'] = 'Razorpay/tantrum'
16
+ req.body = body if not body.empty?
17
+ http = Net::HTTP.new(uri.host, uri.port)
18
+ http.use_ssl = (uri.scheme == 'https')
19
+ JSON.parse(http.request(req).body)
20
+ end
21
+
22
+ url = ARGV.first.sub('github.com', 'api.github.com/repos')
23
+ url = url.sub('/pull/', '/pulls/')
24
+ res = request('get', url)
25
+
26
+ url = url.split('/')[0..-3].push('issues').join('/')
27
+ body = {'title' => res['title'], 'body' => "#{res['body']}\n\n------\n\n" }
28
+ res = request('post', url, body.to_json)
29
+
30
+ system('open', res['url'].sub('api.github.com/repos', 'github.com'))
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tantrum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Harman Singh
8
+ autorequire:
9
+ bindir: "."
10
+ cert_chain: []
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Tantrum is a commandline tool that creates Github issues, using pull
14
+ requests you feed to it. It sounds silly because it is.
15
+ email:
16
+ - harman28@gmail.com
17
+ executables:
18
+ - tantrum
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - "./tantrum"
23
+ homepage: https://github.com/harman28/tantrum
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - "."
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.5.1
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Creates issues. Lots of issues.
47
+ test_files: []