Skip to content

Instantly share code, notes, and snippets.

@pvalena
Created January 11, 2024 06:30
Show Gist options
  • Save pvalena/c28ed7be7a3d80fe430021e6608d9217 to your computer and use it in GitHub Desktop.
Save pvalena/c28ed7be7a3d80fe430021e6608d9217 to your computer and use it in GitHub Desktop.
--- rubygem-safe_yaml/.generated.spec 2024-01-11 07:17:57.439728898 +0100
+++ rubygem-safe_yaml/rubygem-safe_yaml.spec 2023-10-03 13:06:28.581446355 +0200
@@ -1,22 +1,31 @@
-Downloaded safe_yaml-1.0.5
-# Generated from safe_yaml-1.0.5.gem by gem2rpm -*- rpm-spec -*-
%global gem_name safe_yaml
+# Although there are tests
+# the dependancies aren't in Fedora yet
+%global enable_tests 0
+Summary: Parse YAML safely
Name: rubygem-%{gem_name}
Version: 1.0.5
Release: 1%{?dist}
-Summary: SameYAML provides an alternative implementation of YAML.load suitable for accepting user input in Ruby applications
License: MIT
-URL: https://github.com/dtao/safe_yaml
+URL: http://dtao.github.com/safe_yaml/
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
-BuildRequires: ruby >= 1.8.7
+%if 0%{?enable_tests}
+BuildRequires: rubygem(hashie)
+#BuildRequires: rubygem(heredoc_unindent)
+#BuildRequires: rubygem(ostruct)
+BuildRequires: rubygem(rspec)
+#BuildRequires: rubygem(yaml)
+%endif
BuildArch: noarch
%description
-Parse YAML safely.
-
+The SafeYAML gem provides an alternative implementation of
+YAML.load suitable for accepting user input in Ruby applications.
+Unlike Ruby's built-in implementation of YAML.load, SafeYAML's
+version will not expose apps to arbitrary code execution exploits.
%package doc
Summary: Documentation for %{name}
@@ -24,58 +33,125 @@
BuildArch: noarch
%description doc
-Documentation for %{name}.
+Documentation for %{name}
%prep
%setup -q -n %{gem_name}-%{version}
%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}/
-
+cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}/
mkdir -p %{buildroot}%{_bindir}
-cp -a .%{_bindir}/* \
- %{buildroot}%{_bindir}/
+cp -a ./%{_bindir}/* %{buildroot}%{_bindir}
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
+%if 0%{?enable_tests}
%check
pushd .%{gem_instdir}
-# Run the test suite.
+rspec -Ilib spec
popd
+%endif
%files
-%dir %{gem_instdir}
%{_bindir}/safe_yaml
-%exclude %{gem_instdir}/.gitignore
-%exclude %{gem_instdir}/.travis.yml
-%{gem_instdir}/CHANGES.md
-%license %{gem_instdir}/LICENSE.txt
+%doc %{gem_instdir}/LICENSE.txt
+%dir %{gem_instdir}
%{gem_instdir}/bin
-%{gem_instdir}/bundle_install_all_ruby_versions.sh
%{gem_libdir}
-%{gem_instdir}/run_specs_all_ruby_versions.sh
%exclude %{gem_cache}
%{gem_spec}
+%exclude %{gem_instdir}/.*
+%exclude %{gem_instdir}/bundle_install_all_ruby_versions.sh
%files doc
-%doc %{gem_docdir}
-%{gem_instdir}/Gemfile
+%doc %{gem_instdir}/CHANGES.md
%doc %{gem_instdir}/README.md
+%doc %{gem_docdir}
%{gem_instdir}/Rakefile
-%{gem_instdir}/safe_yaml.gemspec
+%{gem_instdir}/Gemfile
+%{gem_instdir}/run_specs_all_ruby_versions.sh
%{gem_instdir}/spec
+%{gem_instdir}/%{gem_name}.gemspec
%changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment