Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created July 30, 2013 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domcleal/6113370 to your computer and use it in GitHub Desktop.
Save domcleal/6113370 to your computer and use it in GitHub Desktop.
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}
%global gem_name foreman_discovery
%define rubyabi 1.9.1
%global foreman_bundlerd_dir /usr/share/foreman/bundler.d
# set and uncomment all three to set alpha tag
%global alphatag rc4
%global dotalphatag .%{alphatag}
%global dashalphatag -%{alphatag}
Summary: MaaS Discovery Plugin for Foreman
Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 1.0.0
Release: 0.1%{?dotalphatag}%{?dist}
Group: Applications/System
License: GPLv3
URL: http://github.com/theforeman/foreman_discovery
Source0: http://rubygems.org/downloads/%{gem_name}-%{version}%{?dotalphatag}.gem
#Source0: http://rubygems.org/downloads/%{gem_name}-%{version}%{?dotalphatag}.gem
Requires: foreman >= 1.2.0-0.4.RC3
%if 0%{?fedora} > 18
Requires: %{?scl_prefix}ruby(release)
%else
Requires: %{?scl_prefix}ruby(abi) >= %{rubyabi}
%endif
Requires: %{?scl_prefix}rubygems
BuildRequires: %{?scl_prefix}rubygems-devel
%if 0%{?fedora} > 18
BuildRequires: %{?scl_prefix}ruby(release)
%else
BuildRequires: %{?scl_prefix}ruby(abi) >= %{rubyabi}
%endif
BuildRequires: %{?scl_prefix}rubygems
BuildArch: noarch
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
%description
MaaS Discovery Plugin engine for Foreman.
%package build
BuildArch: noarch
Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release}
Summary: ISO building tools for rubygem-%{gem_name}
%description build
This package contains additional ISO image building tools for
rubygem-%{gem_name}.
It will add a new rake task to the Foreman installation.
%package doc
BuildArch: noarch
Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release}
Summary: Documentation for rubygem-%{gem_name}
%description doc
This package contains documentation for rubygem-%{gem_name}.
%prep
%setup -n %{pkg_name}-%{version} -q -c -T
mkdir -p .%{gem_dir}
%{?scl:scl enable %{scl} "}
gem install --local --install-dir .%{gem_dir} \
--force %{SOURCE0} --no-rdoc --no-ri
%{?scl:"}
%build
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{foreman_bundlerd_dir}
cat <<GEMFILE > %{buildroot}%{foreman_bundlerd_dir}/%{gem_name}.rb
gem '%{gem_name}'
GEMFILE
%files
%dir %{gem_instdir}
%{gem_instdir}/app
%{gem_instdir}/lib
%exclude %{gem_instdir}/lib/tasks.rake
%{gem_instdir}/config
%exclude %{gem_cache}
%{gem_spec}
%{foreman_bundlerd_dir}/%{gem_name}.rb
%doc %{gem_instdir}/LICENSE
%exclude %{gem_instdir}/test
%exclude %{gem_dir}/cache/%{gem_name}-%{version}.gem
%files build
%{gem_instdir}/extra
%{gem_instdir}/lib/tasks.rake
%doc %{gem_instdir}/LICENSE
%doc %{gem_instdir}/README.build_iso.md
%files doc
%doc %{gem_instdir}/LICENSE
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/%{gem_name}.gemspec
%exclude %{gem_instdir}/Gemfile*
%changelog
* Wed Jun 26 2013 Dominic Cleal <dcleal@redhat.com> 1.0.0-0.1.rc4
- initial package build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment