diff --git a/.gitignore b/.gitignore index e69de29..01abd0f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/redcarpet-2.1.1.gem diff --git a/remove_rake_extension.patch b/remove_rake_extension.patch new file mode 100644 index 0000000..ac28ecd --- /dev/null +++ b/remove_rake_extension.patch @@ -0,0 +1,51 @@ +diff --git a/Rakefile b/Rakefile +index 3936a10..d8001a9 100644 +--- a/Rakefile ++++ b/Rakefile +@@ -1,17 +1,10 @@ + require 'date' + require 'rake/clean' +-require 'rake/extensiontask' + require 'digest/md5' + + task :default => :test + + # ========================================================== +-# Ruby Extension +-# ========================================================== +- +-Rake::ExtensionTask.new('redcarpet') +- +-# ========================================================== + # Testing + # ========================================================== + +@@ -20,10 +13,10 @@ Rake::TestTask.new('test:unit') do |t| + t.test_files = FileList['test/*_test.rb'] + t.ruby_opts += ['-rubygems'] if defined? Gem + end +-task 'test:unit' => [:compile] ++task 'test:unit' + + desc 'Run conformance tests (MARKDOWN_TEST_VER=1.0)' +-task 'test:conformance' => [:compile] do |t| ++task 'test:conformance' do |t| + script = "#{pwd}/bin/redcarpet" + test_version = ENV['MARKDOWN_TEST_VER'] || '1.0.3' + lib_dir = "#{pwd}/lib" +@@ -33,13 +26,13 @@ task 'test:conformance' => [:compile] do |t| + end + + desc 'Run version 1.0 conformance suite' +-task 'test:conformance:1.0' => [:compile] do |t| ++task 'test:conformance:1.0' do |t| + ENV['MARKDOWN_TEST_VER'] = '1.0' + Rake::Task['test:conformance'].invoke + end + + desc 'Run 1.0.3 conformance suite' +-task 'test:conformance:1.0.3' => [:compile] do |t| ++task 'test:conformance:1.0.3' do |t| + ENV['MARKDOWN_TEST_VER'] = '1.0.3' + Rake::Task['test:conformance'].invoke + end diff --git a/rubygem-redcarpet.spec b/rubygem-redcarpet.spec new file mode 100644 index 0000000..9f4b0be --- /dev/null +++ b/rubygem-redcarpet.spec @@ -0,0 +1,128 @@ +%global gem_name redcarpet +%global rubyabi 1.9.1 +%global gem_extinstdir %{gem_extdir}/lib + +%if 0%{?el6} +%global gem_dir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null) +%global gem_cache %{gem_dir}/cache/%{gem_name}-%{version}.gem +%global gem_docdir %{gem_dir}/doc/%{gem_name}-%{version} +%global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version} +%global gem_libdir %{gem_instdir}/lib +%global gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}.gemspec +%endif + +%if 0%{?el6}%{?fc16} +%global rubyabi 1.8 +%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"] ')} +%global gem_extinstdir %{ruby_sitearch} +%endif + + +Summary: A fast, safe and extensible Markdown to (X)HTML parser +Name: rubygem-%{gem_name} +Version: 2.1.1 +Release: 1%{?dist} +Group: Development/Languages +License: ISC +URL: http://github.com/tanoku/redcarpet +Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem +Patch0: remove_rake_extension.patch +Requires: ruby(abi) = %{rubyabi} + +%if 0%{?el6} +BuildRequires: rubygems +%else +BuildRequires: rubygems-devel +%endif + +BuildRequires: ruby-devel +BuildRequires: rubygem(minitest) +BuildRequires: rubygem(rake) +BuildRequires: rubygem(nokogiri) + +Provides: rubygem(%{gem_name}) = %{version} + + + +%description +A fast, safe and extensible Markdown to (X)HTML parser + + +%package doc +Summary: Documentation for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name} + +%prep +gem unpack %{SOURCE0} +%setup -q -D -T -n %{gem_name}-%{version} +%patch0 -p1 + +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec + +%build +mkdir -p .%{gem_dir} +gem build %{gem_name}.gemspec +export CONFIGURE_ARGS="--with-cflags='%{optflags}'" + +# gem install compiles any C extensions and installs into a directory +# We set that to be a local directory so that we can move it into the +# buildroot in the install section +gem install -V \ + --local \ + --install-dir ./%{gem_dir} \ + --bindir ./%{_bindir} \ + --force \ + --rdoc \ + %{gem_name}-%{version}.gem + +# Fix permissions +chmod 644 ./%{gem_dir}/gems/%{gem_name}-%{version}/COPYING +chmod 644 ./%{gem_dir}/gems/%{gem_name}-%{version}/ext/redcarpet/* + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/ + +mkdir -p %{buildroot}%{_bindir} +cp -a ./%{_bindir}/* %{buildroot}%{_bindir} +chmod 755 %{buildroot}%{_bindir}/redcarpet + +mkdir -p %{buildroot}%{gem_extinstdir} +mv %{buildroot}%{gem_instdir}/lib/redcarpet.so %{buildroot}%{gem_extinstdir} + +# Clean up ext artifacts +rm %{buildroot}%{gem_instdir}/ext/redcarpet/*.o +rm %{buildroot}%{gem_instdir}/ext/redcarpet/*.so + +%check +pushd .%{gem_instdir} +rake test:unit +popd + +%files +%dir %{gem_instdir} +%{_bindir}/redcarpet +%{gem_instdir}/bin +%{gem_instdir}/ext +%{gem_libdir} +%{gem_extinstdir} +%{gem_cache} +%{gem_spec} +%doc %{gem_instdir}/COPYING +%doc %{gem_instdir}/README.markdown + +%files doc +%{gem_instdir}/Rakefile +%{gem_instdir}/test +%{gem_instdir}/%{gem_name}.gemspec +%doc %{gem_docdir} + + +%changelog +* Thu Apr 26 2012 Matt Hicks - 2.1.1-1 +- Initial package diff --git a/sources b/sources index e69de29..40f061c 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +9fb22c5a84d5068362d78c95505dd307 redcarpet-2.1.1.gem