Merge branch '22614-railsapi-service-packaging'
[arvados.git] / services / login-sync / arvados-login-sync.gemspec
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.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", "services/login-sync"],
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-login-sync'
38   s.version     = version
39   s.date        = git_timestamp.strftime("%Y-%m-%d")
40   s.summary     = "Set up local login accounts for Arvados users"
41   s.description = "Creates and updates local login accounts for Arvados users. Built from git commit #{git_hash}"
42   s.authors     = ["Arvados Authors"]
43   s.email       = 'packaging@arvados.org'
44   s.licenses    = ['AGPL-3.0']
45   s.files       = ["bin/arvados-login-sync", "agpl-3.0.txt"]
46   s.executables << "arvados-login-sync"
47   s.required_ruby_version = '>= 2.5.0'
48   # The minimum version's 'a' suffix is necessary to enable bundler
49   # to consider 'pre-release' versions.  See:
50   # https://github.com/rubygems/bundler/issues/4340
51   s.add_runtime_dependency 'arvados', arv_dep_version
52   s.add_runtime_dependency 'launchy', '< 2.5'
53   # arvados fork of google-api-client gem with old API and new
54   # compatibility fixes, built from ../../sdk/ruby-google-api-client/
55   s.add_runtime_dependency('arvados-google-api-client', '>= 0.8.7.5', '< 0.8.9')
56   s.homepage    =
57     'https://arvados.org'
58 end