summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2017-09-11 17:50:18 +0200
committerVít Ondruch <vondruch@redhat.com>2017-11-28 12:12:31 +0100
commit3ec67ba9a3b351384e922dc9d6558f7f6e86fe4e (patch)
tree78be094b405aa23ba7c6cf68fccec52da5bd023d
parent6bceec47e722e79ac688f18690ba7cca46f8bfd0 (diff)
downloadrubygem-sitemap_generator-3ec67ba9a3b351384e922dc9d6558f7f6e86fe4e.tar.gz
rubygem-sitemap_generator-3ec67ba9a3b351384e922dc9d6558f7f6e86fe4e.tar.xz
rubygem-sitemap_generator-3ec67ba9a3b351384e922dc9d6558f7f6e86fe4e.zip
Initial package
-rw-r--r--rubygem-sitemap_generator-5.3.1-Fix-Ruby-2.0.0-compatibility.patch27
-rw-r--r--rubygem-sitemap_generator.spec95
-rw-r--r--sitemap.rb49
-rw-r--r--sources2
4 files changed, 173 insertions, 0 deletions
diff --git a/rubygem-sitemap_generator-5.3.1-Fix-Ruby-2.0.0-compatibility.patch b/rubygem-sitemap_generator-5.3.1-Fix-Ruby-2.0.0-compatibility.patch
new file mode 100644
index 0000000..8e9a214
--- /dev/null
+++ b/rubygem-sitemap_generator-5.3.1-Fix-Ruby-2.0.0-compatibility.patch
@@ -0,0 +1,27 @@
+From 7ed62817d6e249751aedd6145aaeda1385e98b14 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
+Date: Mon, 11 Sep 2017 17:18:40 +0200
+Subject: [PATCH] Fix Ruby 2.0.0+ compatibility.
+
+YAML::ENGINE is not available since Ruby 2.0.0+, when Syck was removed
+from stdlib and replaced by Psych.
+---
+ lib/sitemap_generator/core_ext/big_decimal.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/sitemap_generator/core_ext/big_decimal.rb b/lib/sitemap_generator/core_ext/big_decimal.rb
+index fa96550..7920edb 100644
+--- a/lib/sitemap_generator/core_ext/big_decimal.rb
++++ b/lib/sitemap_generator/core_ext/big_decimal.rb
+@@ -19,7 +19,7 @@ class SitemapGenerator::BigDecimal < BigDecimal
+ #
+ # Note that reconstituting YAML floats to native floats may lose precision.
+ def to_yaml(opts = {})
+- return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck?
++ return super unless defined?(YAML::ENGINE) && YAML::ENGINE.syck?
+
+ YAML.quick_emit(nil, opts) do |out|
+ string = to_s
+--
+2.14.1
+
diff --git a/rubygem-sitemap_generator.spec b/rubygem-sitemap_generator.spec
new file mode 100644
index 0000000..5ce87f8
--- /dev/null
+++ b/rubygem-sitemap_generator.spec
@@ -0,0 +1,95 @@
+# Generated from sitemap_generator-5.3.1.gem by gem2rpm -*- rpm-spec -*-
+%global gem_name sitemap_generator
+
+Name: rubygem-%{gem_name}
+Version: 5.3.1
+Release: 1%{?dist}
+Summary: Easily generate XML Sitemaps
+License: MIT
+URL: http://github.com/kjvarga/sitemap_generator
+Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
+# git clone https://github.com/kjvarga/sitemap_generator.git && cd sitemap_generator
+# git checkout v5.3.1 && tar czvf sitemap_generator-5.3.1-specs.tar.gz spec/
+Source1: %{gem_name}-%{version}-specs.tar.gz
+Source2: https://raw.githubusercontent.com/kjvarga/sitemap_generator/v5.3.1/config/sitemap.rb
+# Fix compatibility with Ruby 2.0.0+.
+# https://github.com/kjvarga/sitemap_generator/pull/291
+Patch0: rubygem-sitemap_generator-5.3.1-Fix-Ruby-2.0.0-compatibility.patch
+Requires: rubygem(bigdecimal)
+BuildRequires: ruby(release)
+BuildRequires: rubygems-devel
+BuildRequires: ruby
+BuildRequires: rubygem(bigdecimal)
+BuildRequires: rubygem(builder)
+BuildRequires: rubygem(fog-aws) >= 1.2
+BuildRequires: rubygem(nokogiri) >= 1.6
+BuildRequires: rubygem(rspec) >= 3.5
+BuildRequires: rubygem(webmock) >= 2.3
+BuildArch: noarch
+
+%description
+SitemapGenerator is a framework-agnostic XML Sitemap generator written in Ruby
+with automatic Rails integration. It supports Video, News, Image, Mobile,
+PageMap and Alternate Links sitemap extensions and includes Rake tasks for
+managing your sitemaps, as well as many other great features.
+
+
+%package doc
+Summary: Documentation for %{name}
+Requires: %{name} = %{version}-%{release}
+BuildArch: noarch
+
+%description doc
+Documentation for %{name}.
+
+%prep
+%setup -q -n %{gem_name}-%{version} -b 1
+
+%patch0 -p1
+
+%build
+# Create the gem as gem install only works on a gem file
+gem build ../%{gem_name}-%{version}.gemspec
+
+# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
+# by default, so that we can move it into the buildroot in %%install
+%gem_install
+
+%install
+mkdir -p %{buildroot}%{gem_dir}
+cp -a .%{gem_dir}/* \
+ %{buildroot}%{gem_dir}/
+
+
+
+%check
+pushd .%{gem_instdir}
+ln -s %{_builddir}/spec .
+
+mkdir config
+ln -s %{SOURCE2} ./config
+
+# Get rid of Bundler.
+sed -i '/[bB]undler/ s/^/#/' spec/spec_helper.rb
+
+rspec -rsitemap_generator spec
+popd
+
+%files
+%dir %{gem_instdir}
+%license %{gem_instdir}/MIT-LICENSE
+%{gem_instdir}/VERSION
+%{gem_libdir}
+%{gem_instdir}/rails
+%{gem_instdir}/templates
+%exclude %{gem_cache}
+%{gem_spec}
+
+%files doc
+%doc %{gem_docdir}
+%doc %{gem_instdir}/CHANGES.md
+%doc %{gem_instdir}/README.md
+
+%changelog
+* Mon Sep 11 2017 Vít Ondruch <vondruch@redhat.com> - 5.3.1-1
+- Initial package
diff --git a/sitemap.rb b/sitemap.rb
new file mode 100644
index 0000000..f515733
--- /dev/null
+++ b/sitemap.rb
@@ -0,0 +1,49 @@
+SitemapGenerator::Sitemap.default_host = 'http://www.example.com'
+
+SitemapGenerator::Sitemap.create(
+ :include_root => true, :include_index => true,
+ :filename => :new_sitemaps, :sitemaps_path => 'fr/') do
+
+ add('/one', :priority => 0.7, :changefreq => 'daily')
+
+ # Test a new location and filename and sitemaps host
+ group(:sitemaps_path => 'en/', :filename => :xxx,
+ :sitemaps_host => 'http://newhost.com') do
+
+ add '/two'
+ add '/three'
+ end
+
+ # Test a simple namer.
+ group(:namer => SitemapGenerator::SimpleNamer.new(:abc, :start => 4, :zero => 3)) do
+ add '/four'
+ add '/five'
+ add '/six'
+ end
+
+ # Test a simple namer
+ group(:namer => SitemapGenerator::SimpleNamer.new(:def)) do
+ add '/four'
+ add '/five'
+ add '/six'
+ end
+
+ add '/seven'
+
+ # This should be in a file of its own.
+ # Not technically valid to have a link with a different host, but people like
+ # to do strange things sometimes.
+ group(:sitemaps_host => 'http://exceptional.com') do
+ add '/eight'
+ add '/nine'
+ end
+
+ add '/ten'
+
+ # This should have no effect. Already added default links.
+ group(:include_root => true, :include_index => true) {}
+
+ # Not technically valid to have a link with a different host, but people like
+ # to do strange things sometimes
+ add '/merchant_path', :host => 'https://www.merchanthost.com'
+end
diff --git a/sources b/sources
index e69de29..281049b 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,2 @@
+SHA512 (sitemap_generator-5.3.1.gem) = 1f75c8522327a8c851e345d28ff59a199c8b3c9eb1f03658f0940d791fb5ffaa8c65971ec6fe2d4f3ea9855a39dd521cb03456a106417e7faac241d41ef0235f
+SHA512 (sitemap_generator-5.3.1-specs.tar.gz) = b57b158c396cbfaa2eda7ac34a8bb94227302217ec92f3a26005fe1e8e71b3e68bfdf934e05b9bd4789d0e7342a0e07735eb3b898bb199a88db67b41c88aa06d