Skip to content

Instantly share code, notes, and snippets.

@pvalena
Last active May 15, 2018 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvalena/3d284d067d489454182ab4c4624fa981 to your computer and use it in GitHub Desktop.
Save pvalena/3d284d067d489454182ab4c4624fa981 to your computer and use it in GitHub Desktop.
diff --git a/macros.rubygems b/macros.rubygems
index 8167e3c..2c00ae8 100644
--- a/macros.rubygems
+++ b/macros.rubygems
@@ -146,7 +146,7 @@ unset -v gemspec_remove_dep_script \
read -d '' gemspec_add_file_script << 'EOR' || : \
gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \
\
- abort if 1 < ( 0 %{?-t:+1} %{?-r:+1} ) \
+ abort("Use only one option at a time.") if "%{?-t}%{?-r}" == "-t-r" \
\
filenames = %{*}%{!?1:nil} \
filenames = Array(filenames) \
@@ -174,13 +174,12 @@ unset -v gemspec_add_file_script \
# -s <gemspec_file> Overrides the default .gemspec location.
# -t Edit test_files only.
# -r Edit extra_rdoc_files only.
-# -a Edit all.
#
-%gemspec_remove_file(s:tra) \
+%gemspec_remove_file(s:tr) \
read -d '' gemspec_remove_file_script << 'EOR' || : \
gemspec_file = '%{-s*}%{!?-s:%{_builddir}/%{gem_name}-%{version}.gemspec}' \
\
- abort if 1 < ( 0 %{?-r:+1} %{?-t:+1} %{?-a:+1} ) \
+ abort("Use only one option at a time.") if "%{?-t}%{?-r}" == "-t-r" \
\
filenames = %{*}%{!?1:nil} \
filenames = Array(filenames) \
@@ -189,12 +188,6 @@ read -d '' gemspec_remove_file_script << 'EOR' || : \
abort("#{gemspec_file} is not accessible.") unless spec \
\
spec.%{?-t:test_}%{?-r:extra_rdoc_}files -= filenames \
- \
- if %{?-a:true} \
- spec.test_files -= filenames \
- spec.extra_rdoc_files -= filenames \
- end \
- \
File.write gemspec_file, spec.to_ruby \
EOR\
echo "$gemspec_remove_file_script" | ruby \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment