File vagrant-address.spec of Package vagrant-address
#
# spec file for package vagrant-address
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global rb_build_versions %rb_default_ruby
%global rb_build_abi %rb_default_ruby_abi
%global rb_ruby_suffix %rb_default_ruby_suffix
Name: vagrant-address
Version: 0.3.1
Release: 0
%define mod_name vagrant-address
%define mod_full_name %{mod_name}-%{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Requires: vagrant
BuildRequires: vagrant
BuildRequires: %{ruby}
BuildRequires: ruby-macros >= 5
BuildRequires: %{rubygem builder }
BuildRequires: %{rubygem rspec }
BuildRequires: %{rubygem bundler }
BuildRequires: %{rubygem vagrant-spec}
BuildRequires: fdupes
BuildRequires: procps
BuildRequires: kmod
URL: https://github.com/johanneskastl/vagrant-address
Source: %{mod_full_name}.gem
Summary: Vagrant plugin for obtaining an IP address of a guest machine
License: MIT
%description
This plugin allows obtaining a public IP address of a guest machine.
* compatible with machines started remotely, i.e. by vSphere or AWS providers,
* supports multi-machine environments.
%package -n %{name}-doc
Summary: Documentation for vagrant-address
%description -n %{name}-doc
This package contains the documentation for the Vagrant addr plugin.
%global vagrant_plugin_name %{name}
%prep
%gem_unpack
%build
%gem_build
%install
%vagrant_plugin_install
%fdupes %{buildroot}%{vagrant_plugin_instdir}
%check
# Use the actual gemspec for tests
cp %{mod_full_name}/%{mod_full_name}.gemspec \
%{buildroot}%{vagrant_plugin_instdir}/%{vagrant_plugin_name}.gemspec
pushd %{buildroot}%{vagrant_plugin_instdir}
# Create dummy Gemfile and load dependencies via the gemspec
echo "gem 'vagrant'" > Gemfile
echo "gem 'rdoc'" >> Gemfile
echo "gem 'vagrant-spec'" >> Gemfile
echo "gemspec" >> Gemfile
# Relax developement rspec dependency
sed -i '/rspec/ s/~>/>=/' %{vagrant_plugin_name}.gemspec
export GEM_PATH=%{vagrant_plugin_dir}:`ruby.%{vagrant_rb_ruby_suffix} -e "print Gem.path.join(':')"`
bundle exec rspec spec
rm %{vagrant_plugin_name}.gemspec
popd
%files
%{vagrant_plugin_instdir}
%{vagrant_plugin_cache}
%{vagrant_plugin_spec}
%doc %{mod_full_name}/README.md
%license %{mod_full_name}/LICENSE.txt
%exclude %{vagrant_plugin_instdir}/.*
%exclude %{vagrant_plugin_instdir}/Gemfile
%exclude %{vagrant_plugin_instdir}/Rakefile
%exclude %{vagrant_plugin_instdir}/README.md
%exclude %{vagrant_plugin_instdir}/LICENSE
%files -n %{name}-doc
%doc %{vagrant_plugin_docdir}
%changelog