%global gem_name ruby-debug19
%global rubyabi 1.9.1
Summary: Command line interface (CLI) for ruby-debug-base
Name: rubygem-%{gem_name}
Version: 0.11.6
Release: 3%{?dist}
Group: Development/Languages
# LICENSE
License: BSD
URL: http://rubyforge.org/projects/ruby-debug19/
Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem
Requires: ruby(abi) = %{rubyabi}
Requires: ruby(rubygems)
Requires: rubygem(columnize) >= 0.3.1
Requires: rubygem(linecache19) >= 0.5.13
Requires: rubygem(ruby-debug-base19) >= 0.11.26
BuildRequires: ruby(abi) = %{rubyabi}
BuildRequires: rubygems-devel
# %% check
BuildRequires: rubygem(columnize) >= 0.3.1
BuildRequires: rubygem(linecache19) >= 0.5.13
BuildRequires: rubygem(ruby-debug-base19) >= 0.11.26
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}-%{release}
# Obsolete this, not providing
Obsoletes: rubygem-ruby-debug <= 0.10.5
%description
A generic command line interface for ruby-debug.
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
# Obsolete this, not providing
Obsoletes: rubygem-ruby-debug-doc <= 0.10.5
%description doc
Documentation for %{name}
%prep
%setup -q -c -T
# Gem repack
TOPDIR=$(pwd)
mkdir tmpunpackdir
pushd tmpunpackdir
gem unpack %{SOURCE0}
cd %{gem_name}-%{version}
gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
gem build %{gem_name}.gemspec
mv %{gem_name}-%{version}.gem $TOPDIR
popd
rm -rf tmpunpackdir
%build
mkdir -p .%{gem_dir}
gem install \
--local \
--install-dir .%{gem_dir} \
-V \
--force \
%{gem_name}-%{version}.gem
# Permission
find . -type f -print0 | xargs --null chmod go-w
%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
pushd %{buildroot}
mv .%{gem_dir}/bin/* \
./%{_bindir}/
rmdir .%{gem_dir}/bin
popd
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%check
pushd .%{gem_instdir}
# Just see how it works for now
cat > debugger-gcd-test.rb <<EOF
#!/usr/bin/ruby
def gcd(a, b)
if a > b
a, b = [b, a]
end
if a == b or a == 1
return a
end
return gcd(a, b-a)
end
a, b = ARGV[0..1].map{|arg| arg.to_i}
puts "The gcd of %i and %i is %i\n" % [a, b, gcd(a,b)]
EOF
cat -n debugger-gcd-test.rb
yes "p a ; p b ; s" | env PATH=$(pwd)/bin:$PATH \
ruby -Icli -S rdebug ./debugger-gcd-test.rb 120 84
popd
%files
%dir %{gem_instdir}
%doc %{gem_instdir}/[A-Z]*
%{_bindir}/rdebug
%{gem_instdir}/bin/
%{gem_instdir}/cli/
%{gem_instdir}/rdbg.rb
%exclude %{gem_cache}
%{gem_spec}
%files doc
%{gem_docdir}
%changelog
* Sat Oct 27 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.11.6-3
- Some cleanup
* Fri Sep 14 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.11.6-2
- Rebuild
* Thu May 3 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.11.6-1
- Initial package