From 40eac2a516d2fca7603971d0401a1bec2ab0986b42c71a8ace6ae7fceaf41ea7 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Sun, 29 Jul 2012 18:54:29 +0000 Subject: [PATCH] gem2rpm OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby:extensions/rubygem-ruby_parser?expand=0&rev=15 --- rubygem-ruby_parser.spec | 95 +++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/rubygem-ruby_parser.spec b/rubygem-ruby_parser.spec index aa8d62b..003ce21 100644 --- a/rubygem-ruby_parser.spec +++ b/rubygem-ruby_parser.spec @@ -20,19 +20,12 @@ Name: rubygem-ruby_parser Version: 2.3.1 Release: 0 %define mod_name ruby_parser -# -# +%define mod_full_name %{mod_name}-%{version} + BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: rubygems_with_buildroot_patch -%rubygems_requires -# sexp_processor ~> 3.0 -BuildRequires: rubygem-sexp_processor-3 >= 3.0 -Requires: rubygem-sexp_processor-3 >= 3.0 -Provides: rubygem-ruby_parser-2 = %{version} -# -Url: http://parsetree.rubyforge.org/ -Source: %{mod_name}-%{version}.gem -# +BuildRequires: ruby-macros >= 1 +Url: https://github.com/seattlerb/ruby_parser +Source: %{mod_full_name}.gem Summary: ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which does by default use a C extension) License: MIT Group: Development/Languages/Ruby @@ -42,45 +35,65 @@ ruby_parser (RP) is a ruby parser written in pure ruby (utilizing racc--which does by default use a C extension). RP's output is the same as ParseTree's output: s-expressions using ruby's arrays and base types. - As an example: - - def conditional1(arg1) - if arg1 == 0 then - return 1 - end - return 0 - end - +def conditional1(arg1) +if arg1 == 0 then +return 1 +end +return 0 +end becomes: +s(:defn, :conditional1, +s(:args, :arg1), +s(:scope, +s(:block, +s(:if, +s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), +s(:return, s(:lit, 1)), +nil), +s(:return, s(:lit, 0))))) - s(:defn, :conditional1, - s(:args, :arg1), - s(:scope, - s(:block, - s(:if, - s(:call, s(:lvar, :arg1), :==, s(:arglist, s(:lit, 0))), - s(:return, s(:lit, 1)), - nil), - s(:return, s(:lit, 0))))) +%package doc +Summary: RDoc documentation for %{mod_name} +Group: Development/Languages/Ruby +Requires: %{name} = %{version} + +%description doc +Documentation generated at gem installation time. +Usually in RDoc and RI formats. + +%package testsuite +Summary: Test suite for %{mod_name} +Group: Development/Languages/Ruby +Requires: %{name} = %{version} + +%description testsuite +Test::Unit or RSpec files, useful for developers. %prep +#gem_unpack +#if you need patches, apply them here and replace the # with a % sign in the surrounding lines +#gem_build + %build + %install -%gem_install %{S:0} - -# fix require of /usr/local/bin/ruby -sed -i 's,/usr/local/bin/ruby,/usr/bin/ruby,' %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/test/*.rb - -%clean -%{__rm} -rf %{buildroot} +%gem_install -f %files %defattr(-,root,root,-) %{_bindir}/ruby_parse -%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_name}-%{version}.gem -%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_name}-%{version}/ -%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_name}-%{version}.gemspec -%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_name}-%{version}/ +%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem +%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/ +%exclude %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/test +%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec + +%files doc +%defattr(-,root,root,-) +%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/ + +%files testsuite +%defattr(-,root,root,-) +%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/test %changelog