hockeyver 0.1.3 → 0.1.4
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 +4 -4
- data/bin/hockeyver +45 -1
- data/lib/hockeyver.rb +24 -34
- data/lib/hockeyver/version.rb +3 -0
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d529e0644ef350b83491507063a1d1f91bfa875
|
4
|
+
data.tar.gz: 1f8318c4bca9138c1f58c6aaca31a16bfaa00103
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6485abcc34423c4ef20fb3ed4250f9ab15a6f3fe6f949fafa970698b8906aacc68f3f59f050ae214a4315448a2208d788294b0b42c6dae90c85c78ad0e86794
|
7
|
+
data.tar.gz: 2b873c998ace30b8ec79ba041245fdcb0af1293686c0996ed1378309e90e1c961d1e51a66ea93be4e4fc45413ff915f55d40f26f016a1604a13789d7f4647804
|
data/bin/hockeyver
CHANGED
@@ -1,4 +1,48 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'hockeyver'
|
4
|
-
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
# Setup required configuration
|
7
|
+
Configuration = Struct.new(:app_id, :token)
|
8
|
+
config = Configuration.new(nil, nil)
|
9
|
+
|
10
|
+
# Parse options
|
11
|
+
parser = OptionParser.new do |opts|
|
12
|
+
opts.banner = "Usage: hockeyver [options]"
|
13
|
+
opts.separator ""
|
14
|
+
opts.separator "Outputs the version number of the latest build on Hockey based on the provided Hockey ID and token."
|
15
|
+
opts.separator ""
|
16
|
+
opts.separator "Specific options:"
|
17
|
+
|
18
|
+
opts.on("-i", "--app_id APP_IDENTIFIER", "HockeyApp app identifier of the app you want to check version of. (required)") do |identifier|
|
19
|
+
config.app_id = identifier
|
20
|
+
end
|
21
|
+
|
22
|
+
opts.on("-t", "--token API_TOKEN", "HockeyApp API token which will be used to connect. (required)") do |token|
|
23
|
+
config.token = token
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
27
|
+
puts opts
|
28
|
+
exit
|
29
|
+
end
|
30
|
+
end
|
31
|
+
parser.parse!
|
32
|
+
|
33
|
+
# Safety checks
|
34
|
+
if config.app_id.nil?
|
35
|
+
puts "ERROR: You need to provide an app identifier. \n\n"
|
36
|
+
puts parser.help
|
37
|
+
exit 1
|
38
|
+
end
|
39
|
+
|
40
|
+
if config.token.nil?
|
41
|
+
puts "ERROR: You need to provide an API token. \n\n"
|
42
|
+
puts parser.help
|
43
|
+
exit 1
|
44
|
+
end
|
45
|
+
|
46
|
+
# Run the hockey version parser
|
47
|
+
result = HockeyVer.parse_hockey_version config.app_id, config.token
|
48
|
+
if result.nil? then exit 1 else exit end
|
data/lib/hockeyver.rb
CHANGED
@@ -2,39 +2,29 @@
|
|
2
2
|
|
3
3
|
require 'httparty'
|
4
4
|
require 'json'
|
5
|
-
require 'slop'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
json = JSON.parse(response.body)
|
33
|
-
|
34
|
-
begin
|
35
|
-
latest = json["app_versions"].first
|
36
|
-
puts(latest["version"])
|
37
|
-
rescue Exception
|
38
|
-
puts(json)
|
39
|
-
exit 1
|
6
|
+
module HockeyVer
|
7
|
+
|
8
|
+
def self.parse_hockey_version(app_id, api_token)
|
9
|
+
# Safety checking
|
10
|
+
raise "ERROR: No app id provided!" if app_id.nil?
|
11
|
+
raise "ERROR: No api token provided!" if api_token.nil?
|
12
|
+
|
13
|
+
# Fetch the information
|
14
|
+
response = HTTParty.get("https://rink.hockeyapp.net/api/2/apps/#{app_id}/app_versions",
|
15
|
+
:headers => { 'X-HockeyAppToken' => api_token})
|
16
|
+
|
17
|
+
json = JSON.parse(response.body)
|
18
|
+
|
19
|
+
# Parse the JSON
|
20
|
+
begin
|
21
|
+
# If found, return version
|
22
|
+
latest = json["app_versions"].first
|
23
|
+
return(latest["version"])
|
24
|
+
rescue Exception
|
25
|
+
# Error out and return nil otherwise
|
26
|
+
puts("Error while parsing hockey ver JSON. ", json)
|
27
|
+
return(nil)
|
28
|
+
end
|
29
|
+
end
|
40
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hockeyver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Welner
|
8
|
+
- Dominik Hadl
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
12
|
+
date: 2016-08-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: httparty
|
@@ -38,20 +39,6 @@ dependencies:
|
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '1.7'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: slop
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '4.4'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '4.4'
|
55
42
|
- !ruby/object:Gem::Dependency
|
56
43
|
name: bundler
|
57
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,6 +64,7 @@ extra_rdoc_files: []
|
|
77
64
|
files:
|
78
65
|
- bin/hockeyver
|
79
66
|
- lib/hockeyver.rb
|
67
|
+
- lib/hockeyver/version.rb
|
80
68
|
homepage: http://nodes.dk
|
81
69
|
licenses:
|
82
70
|
- MIT
|