tping 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/exe/tping +52 -1
- data/lib/tping.rb +6 -5
- data/lib/tping/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8010bf104527f15d24dbd394f7ab42ea7937ff847977c29cebb985ba0d2c5602
|
4
|
+
data.tar.gz: fccfc6bf86b5e680c72590ccc9ff207362e591fb7ebaabed7b90c57b6a9bfafa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee45659d5d0758937f68ae701f9559756cbbfad515c82f984c762898fd3d6cb6d036c1c87814c532cbe485f302845dbc9e4abca19ebb84cfa3f33e21a6929971
|
7
|
+
data.tar.gz: a4b4d6791938470d965f0be2d881f9d5537cb6676784a9b58d5578735f6ec81befb9a294c7d521d3e9e2599eea1d84cdbcae4864c002cc08d9161b89bc19e4ed
|
data/exe/tping
CHANGED
@@ -1,5 +1,56 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "optparse"
|
3
4
|
require_relative "../lib/tping"
|
4
5
|
|
5
|
-
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
optparse = OptionParser.new do |opts|
|
9
|
+
options[:token] = nil
|
10
|
+
opts.on("-t", "--token TOKEN", "Your Travis API token") do |token|
|
11
|
+
options[:token] = token
|
12
|
+
end
|
13
|
+
|
14
|
+
options[:user] = nil
|
15
|
+
opts.on("-u", "--user USER", "The GitHub user/organization that owns the repo to trigger", "(e.g. aguynamedryan)") do |user|
|
16
|
+
options[:user] = user
|
17
|
+
end
|
18
|
+
|
19
|
+
options[:repo] = nil
|
20
|
+
opts.on("-r", "--repo REPO", "The name of repo to trigger", "(e.g. tping)") do |repo|
|
21
|
+
options[:repo] = repo
|
22
|
+
end
|
23
|
+
|
24
|
+
options[:pro] = false
|
25
|
+
opts.on("-p", "--pro", "Ping Travis 'professional'") do |pro|
|
26
|
+
options[:pro] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on("-b", "--branch [BRANCH]", "The branch to trigger", "(defaults to 'master')") do |branch|
|
30
|
+
options[:branch] = branch
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on("-h", "--help", "Display this screen") do
|
34
|
+
puts opts
|
35
|
+
exit
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
optparse.parse!
|
40
|
+
|
41
|
+
options[:branch] ||= "master"
|
42
|
+
|
43
|
+
# OptionParser claims to check if required options are provided, but it didn't
|
44
|
+
# seem to work for me. Instead of debugging, I hacked this little ditty
|
45
|
+
# to check for required options for me.
|
46
|
+
missing_opts = options.keys.select { |k| options[k].nil? }.map { |k| "--#{k}" }
|
47
|
+
|
48
|
+
unless missing_opts.empty?
|
49
|
+
puts "Please specify the following options:"
|
50
|
+
puts missing_opts.join("\n")
|
51
|
+
puts
|
52
|
+
puts optparse
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
|
56
|
+
Tping.request_build(options)
|
data/lib/tping.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
require_relative "tping/version"
|
2
2
|
|
3
3
|
module Tping
|
4
|
-
def self.request_build(
|
4
|
+
def self.request_build(opts)
|
5
5
|
headers = ["Content-Type: application/json",
|
6
6
|
"Accept: application/json",
|
7
7
|
"Travis-API-Version: 3",
|
8
|
-
"Authorization: token #{token}"].flat_map do |header|
|
8
|
+
"Authorization: token #{opts[:token]}"].flat_map do |header|
|
9
9
|
["-H", header]
|
10
10
|
end
|
11
11
|
|
12
|
-
command = %w(curl -s -X POST)
|
12
|
+
command = %w(curl -v -s -X POST)
|
13
13
|
command += headers
|
14
|
-
command += ["-d",
|
15
|
-
command << "https://api.travis-ci.#{pro ? "com" : "org"}/repo/#{user}%2F#{repo}/requests"
|
14
|
+
command += ["-d", %Q|{ "request": { "branch": "#{opts[:branch]}" }}|]
|
15
|
+
command << "https://api.travis-ci.#{opts[:pro] ? "com" : "org"}/repo/#{opts[:user]}%2F#{opts[:repo]}/requests"
|
16
|
+
p command
|
16
17
|
system(*command)
|
17
18
|
end
|
18
19
|
end
|
data/lib/tping/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Duryea
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.6
|
80
|
+
rubygems_version: 2.7.6
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Feed it a token and a repo and it will attempt to fire off a new build
|