latestver 1.7.17

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: c16c1c86b834a4a376d7c498fbac734d70e82fea
4
+ data.tar.gz: c1aeaa1361d22b0042c4d5d1d180594a72d9eca2
5
+ SHA512:
6
+ metadata.gz: 9c301daee692988b5a58c5bdf59435093c3bb0171fbe0fb512488316c64fe5d19c7081d126936f346181cf62482335a8bc169a433025e0027676e5698f7a05ea
7
+ data.tar.gz: 04cfe066faa998de417a4a5256e8a26ec2437aecea19ea69e83115982983f72df46f12426e2f00b86ed620855c194d977700f6d4edf2a6b44ddbbbf089e06e34
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 BinaryBabel OSS
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,26 @@
1
+ # Latestver RubyGem
2
+
3
+ Latestver command-line interface. Works with the hosted edition ([lv.binarybabel.org](https://lv.binarybabel.org)),
4
+ or private docker deployments. Project sync coming soon.
5
+
6
+ ## Installation
7
+
8
+ $ gem install latestver
9
+
10
+ ## Usage
11
+
12
+ $ latestver --help
13
+
14
+ ## Contributing
15
+
16
+ The gem is available as open source under the terms of the [GNU GPL 3 License](https://opensource.org/licenses/gpl-3.0).
17
+
18
+ Bug reports and pull requests are welcome on GitHub at https://github.com/binarybabel/latestver.
19
+
20
+ * After checking out the repo, run `bin/setup` to install dependencies.
21
+ * Then, run `rake test` to run the tests.
22
+
23
+ ## Author and License
24
+
25
+ - **Author:** BinaryBabel OSS ([https://keybase.io/binarybabel](https://keybase.io/binarybabel))
26
+ - **License:** GNU GPL 3
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "latestver"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'versioneer' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("versioneer", "versioneer")
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'optparse'
5
+ require 'latestver'
6
+
7
+ options = {
8
+ :server => 'https://lv.binarybabel.org',
9
+ :output => 'select',
10
+ :select => 'version',
11
+ }
12
+
13
+ opparser = OptionParser.new do |opts|
14
+ opts.banner = [
15
+ '',
16
+ 'Latestver CLI lv.binarybabel.org',
17
+ '---------------------------------------------',
18
+ ' latestver get NAME:TAG',
19
+ ' latestver [OPTIONS] ACTION [ARGS]',
20
+ '---------------------------------------------',
21
+ '',
22
+ ' Actions:',
23
+ ' get NAME:TAG',
24
+ '',
25
+ ' Options:'
26
+ ].join("\n")
27
+ opts.on('-p PATH.SELECTOR', 'Return sub-path of result data. default: version') do |v|
28
+ options[:select] = v
29
+ end
30
+ opts.on('--server SERVER', 'https://lv.binarybabel.org') do |v|
31
+ options[:server] = v
32
+ end
33
+ opts.on('--json', 'JSON output, clears default path selector') do
34
+ options[:output] = 'json'
35
+ options[:select] = nil
36
+ end
37
+ end
38
+ opparser.parse!
39
+
40
+ @app = Latestver::Client.new(options[:server])
41
+ @cli = Latestver::CliHelpers
42
+
43
+
44
+ if ARGV.size > 0
45
+ begin
46
+ case (action = ARGV.shift)
47
+
48
+ when /get/i
49
+ data = @app.catalog_get(ARGV[0])
50
+ puts @cli.output(options, data)
51
+
52
+ else
53
+ puts opparser.help
54
+ end
55
+ rescue Latestver::ClientError => e
56
+ puts @cli.output(options, e)
57
+ exit(1)
58
+ end
59
+ else
60
+ puts opparser.help
61
+ end
@@ -0,0 +1,7 @@
1
+ require 'latestver/version'
2
+ require 'latestver/client_error'
3
+ require 'latestver/client'
4
+ require 'latestver/cli_helpers'
5
+
6
+ module Latestver
7
+ end
@@ -0,0 +1,44 @@
1
+ module Latestver
2
+ class CliHelpers
3
+
4
+ def self.output(options, data)
5
+ data_out = data
6
+
7
+ unless data_out.is_a? Exception
8
+
9
+ if options[:select]
10
+ s = options[:select].split('.')
11
+ while s.length > 0 and not data_out.nil?
12
+ data_out = data_out[s.shift]
13
+ end
14
+ end
15
+
16
+ return nil unless data_out
17
+
18
+ end
19
+
20
+ case options[:output]
21
+ when 'json'
22
+ if data_out.is_a? String
23
+ data_out = {
24
+ value: data_out,
25
+ error: "",
26
+ }
27
+ elsif data_out.is_a? Exception
28
+ data_out = {
29
+ error: data_out.message,
30
+ value: "",
31
+ }
32
+ end
33
+ JSON.pretty_generate(data_out)
34
+ else
35
+ if data_out.is_a? Exception
36
+ "ERROR: #{data_out.message}"
37
+ else
38
+ data_out
39
+ end
40
+ end
41
+ end
42
+
43
+ end
44
+ end
@@ -0,0 +1,25 @@
1
+ require 'json'
2
+ require 'faraday'
3
+
4
+ module Latestver
5
+ class Client
6
+ REGEX_NAME_TAG = /\A([a-z0-9][a-z0-9_\.-]+[a-z0-9]):([a-z0-9][a-z0-9_\.-]+[a-z0-9])\z/i
7
+
8
+ attr_reader :server_url
9
+
10
+ def initialize(server_url)
11
+ @server_url = server_url.to_s.sub(/\/\z/, '')
12
+ end
13
+
14
+ def catalog_get(name_tag)
15
+ raise ClientError, "Invalid NAME:TAG, #{name_tag}" unless name_tag.match(REGEX_NAME_TAG)
16
+ name, tag = name_tag.split(':')
17
+ response = ::Faraday.get "#{server_url}/catalog-api/#{name}/#{tag}.json"
18
+ if response.status == 200
19
+ JSON.parse(response.body)
20
+ else
21
+ raise ClientError, "Failed to get entry from catalog. #{response.reason_phrase}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,4 @@
1
+ module Latestver
2
+ class ClientError < RuntimeError
3
+ end
4
+ end
@@ -0,0 +1,8 @@
1
+ module Latestver
2
+ begin
3
+ require 'versioneer'
4
+ VERSION = ::Versioneer::Config.new(::File.expand_path('../../../', __FILE__))
5
+ rescue LoadError
6
+ VERSION = '0.0.0'
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ 1.7.17
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: latestver
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.17
5
+ platform: ruby
6
+ authors:
7
+ - BinaryBabel OSS
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: versioneer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.10.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.10.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">"
102
+ - !ruby/object:Gem::Version
103
+ version: '3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">"
109
+ - !ruby/object:Gem::Version
110
+ version: '3'
111
+ description:
112
+ email:
113
+ - oss@binarybabel.org
114
+ executables:
115
+ - latestver
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - LICENSE.txt
120
+ - README.md
121
+ - bin/console
122
+ - bin/setup
123
+ - bin/versioneer
124
+ - exe/latestver
125
+ - lib/latestver.rb
126
+ - lib/latestver/cli_helpers.rb
127
+ - lib/latestver/client.rb
128
+ - lib/latestver/client_error.rb
129
+ - lib/latestver/version.rb
130
+ - version.lock
131
+ homepage: https://lv.binarybabel.org
132
+ licenses:
133
+ - MIT
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.5.1
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: Latestver command-line interface. Hosted or privately deployed. Project sync
155
+ coming soon.
156
+ test_files: []