Blob Blame History Raw
%global app_root %{_datadir}/%{name}
%global gem_name hub

# https://fedoraproject.org/wiki/Packaging:SourceURL#Github
# For a number of reasons (immutability, availability, uniqueness), you must
# use the full commit revision hash when referring to the sources.
%global commit e807a3891b13a45d52447b63ca4e54c25a78dc13
%global shortcommit %(c=%{commit}; echo ${c:0:7})

Summary:        A command-line wrapper for git with github shortcuts
Name:           hub
Version:        1.12.1
Release:        1%{?dist}
Group:          Development/Languages
License:        MIT
URL:            http://hub.github.com/

# https://fedoraproject.org/wiki/Packaging:SourceURL#Github
# Keep in mind that github tarballs are generated on-demand, so their
# modification dates will vary and cause checksum tests to fail. Reviewers will
# need to use diff -r to verify the tarballs. 
Source0:        https://github.com/github/hub/archive/%{commit}/hub-%{commit}.tar.gz

BuildArch:      noarch

BuildRequires:  ruby-devel
BuildRequires:  rubygems-devel
BuildRequires:  rubygem(rspec)

## For the test suite.
#BuildRequires:  rubygem-minitest
#BuildRequires:  rubygem-webmock
#BuildRequires:  rubygem-bundler
#BuildRequires:  rubygem-rake>=10.1.1
#BuildRequires:  rubygem-cucumber
#BuildRequires:  tmux
#BuildRequires:  zsh

Requires:       ruby(rubygems)
Requires:       ruby(release)

%description
hub is a command line tool that wraps `git` in order to extend it with extra
features and commands that make working with GitHub easier.

    $ hub clone rtomayko/tilt

    # expands to:
    $ git clone git://github.com/rtomayko/tilt.git

%package doc
Summary:        API documentation for %{name}
Group:          Documentation
Requires:       %{name} = %{version}-%{release}

%description doc
Documentation for %{name} generated by rdoc.

%prep
%setup -qn %{name}-%{commit}

%build
gem build %{gem_name}.gemspec
%gem_install

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/
rm -rf %{buildroot}%{gem_dir}/doc/

mkdir -p %{buildroot}%{_bindir}
cp -a ./%{_bindir}/hub %{buildroot}%{_bindir}/hub

rdoc --op %{buildroot}%{_defaultdocdir}/%{name}/
# But then, it gets installed twice in that directory; remove the nested one.
rm -rf %{buildroot}%{_defaultdocdir}/%{name}/usr/

# Remove spurious executable permission
chmod -x %{buildroot}%{_defaultdocdir}/%{name}/images/*.png

install -d -m 755 %{buildroot}%{_mandir}/man1/
cp -p man/hub.1 %{buildroot}%{_mandir}/man1/.

# Tests are commented out for now since they require rubygem-rake>=10.1.1 which
# isn't available in rawhide yet.
#%%check
#./script/test

%files
%doc LICENSE README.md CONTRIBUTING.md
%{_bindir}/hub
%{_mandir}/man1/hub.1.gz
%{gem_spec}
%{gem_instdir}
%exclude %{gem_cache}

%files doc
%{_defaultdocdir}/%{name}/

%changelog
* Wed May 28 2014 Ralph Bean <rbean@redhat.com> - 1.12.1-1
- Latest upstream.

* Thu May 22 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-4
- Add -doc subpackage with rdoc product.
- Add check section, but left it commented out due to dep issues.
- Remove spurious man files.
- Remove weirdly nested docs from rdoc.

* Wed Apr 02 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-3
- Update Source0 URL to use the github guidelines.
- Replace weird %%prep %%setup stuff with something more familiar.

* Wed Apr 02 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-2
- Remove version from the doc directory.
- Replace install macro with just "install".

* Mon Mar 31 2014 Ralph Bean <rbean@redhat.com> - 1.12.0-1
- Initial packaging for Fedora