Merge branch '22607-arvbox' refs #22607
[arvados.git] / sdk / cli / arvados-cli.gemspec
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 begin
6   git_root = "#{__dir__}/../.."
7   git_timestamp, git_hash = IO.popen(
8     ["git", "-C", git_root,
9      "log", "-n1", "--first-parent", "--format=%ct:%H",
10      "--", "build/version-at-commit.sh", "sdk/ruby", "sdk/cli"],
11   ) do |git_log|
12     git_log.readline.chomp.split(":")
13   end
14 rescue Errno::ENOENT
15   $stderr.puts("failed to get version information: 'git' not found")
16   exit 69  # EX_UNAVAILABLE
17 end
18
19 if $? != 0
20   $stderr.puts("failed to get version information: 'git log' exited #{$?}")
21   exit 65  # EX_DATAERR
22 end
23 git_timestamp = Time.at(git_timestamp.to_i).utc
24 version = ENV["ARVADOS_BUILDING_VERSION"] || IO.popen(
25             ["#{git_root}/build/version-at-commit.sh", git_hash],
26           ) do |ver_out|
27   ver_out.readline.chomp.encode("utf-8")
28 end
29 version = version.sub("~dev", ".dev").sub("~rc", ".rc")
30 arv_dep_version = if dev_index = (version =~ /\.dev/)
31                     "~> #{version[...dev_index]}.a"
32                   else
33                     "= #{version}"
34                   end
35
36 Gem::Specification.new do |s|
37   s.name        = 'arvados-cli'
38   s.version     = version
39   s.date        = git_timestamp.strftime("%Y-%m-%d")
40   s.summary     = "Arvados CLI tools"
41   s.description = "Arvados command line tools, git commit #{git_hash}"
42   s.authors     = ["Arvados Authors"]
43   s.email       = 'packaging@arvados.org'
44   #s.bindir      = '.'
45   s.licenses    = ['Apache-2.0']
46   s.files       = ["bin/arv", "bin/arv-tag", "LICENSE-2.0.txt"]
47   s.executables << "arv"
48   s.executables << "arv-tag"
49   s.required_ruby_version = '>= 2.7.0'
50   s.add_runtime_dependency 'arvados', arv_dep_version
51   # arvados fork of google-api-client gem with old API and new
52   # compatibility fixes, built from ../ruby-google-api-client/
53   s.add_runtime_dependency('arvados-google-api-client', '>= 0.8.7.5', '< 0.8.9')
54   s.add_runtime_dependency 'activesupport', '>= 3.2.13', '< 8.0'
55   s.add_runtime_dependency 'json', '>= 1.7.7', '<3'
56   s.add_runtime_dependency 'optimist', '~> 3.0'
57   s.add_runtime_dependency 'andand', '~> 1.3', '>= 1.3.3'
58   # oj 3.10.9 requires ruby >= 2.4 and arvbox doesn't currently have it because of SSO
59   s.add_runtime_dependency 'oj', '< 3.10.9'
60   s.add_runtime_dependency 'curb', '~> 0.8'
61   s.add_runtime_dependency 'launchy', '< 2.5'
62   s.homepage    =
63     'https://arvados.org'
64 end