diff --git a/method_source-0.8.2.gem b/method_source-0.8.2.gem new file mode 100644 index 0000000..842453a Binary files /dev/null and b/method_source-0.8.2.gem differ diff --git a/rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings-tests.patch b/rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings-tests.patch new file mode 100644 index 0000000..174d80c --- /dev/null +++ b/rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings-tests.patch @@ -0,0 +1,13 @@ +diff --git a/test/test.rb b/test/test.rb +index 4743a50..b99f717 100644 +--- a/test/test.rb ++++ b/test/test.rb +@@ -13,7 +13,7 @@ + end + + it 'should not raise for immediate instance methods' do +- [Symbol, Fixnum, TrueClass, FalseClass, NilClass].each do |immediate_class| ++ [Symbol, Integer, TrueClass, FalseClass, NilClass].each do |immediate_class| + lambda { immediate_class.instance_method(:to_s).source_location }.should.not.raise + end + end diff --git a/rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings.patch b/rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings.patch new file mode 100644 index 0000000..de77fd6 --- /dev/null +++ b/rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings.patch @@ -0,0 +1,52 @@ +diff --git a/lib/method_source/code_helpers.rb b/lib/method_source/code_helpers.rb +index 6c1d53e..9d9da55 100644 +--- a/lib/method_source/code_helpers.rb ++++ b/lib/method_source/code_helpers.rb +@@ -6,14 +6,14 @@ module CodeHelpers + # This is useful to get module or method source code. + # + # @param [Array, File, String] file The file to parse, either as a File or as +- # @param [Fixnum] line_number The line number at which to look. ++ # @param [Integer] line_number The line number at which to look. + # NOTE: The first line in a file is + # line 1! + # @param [Hash] options The optional configuration parameters. + # @option options [Boolean] :strict If set to true, then only completely + # valid expressions are returned. Otherwise heuristics are used to extract + # expressions that may have been valid inside an eval. +- # @option options [Fixnum] :consume A number of lines to automatically ++ # @option options [Integer] :consume A number of lines to automatically + # consume (add to the expression buffer) without checking for validity. + # @return [String] The first complete expression + # @raise [SyntaxError] If the first complete expression can't be identified +@@ -46,7 +46,7 @@ def expression_at(file, line_number, options={}) + # + # @param [Array, File, String] file The file to parse, either as a File or as + # a String or an Array of lines. +- # @param [Fixnum] line_number The line number at which to look. ++ # @param [Integer] line_number The line number at which to look. + # NOTE: The first line in a file is line 1! + # @return [String] The comment + def comment_describing(file, line_number) +@@ -84,7 +84,7 @@ def complete_expression?(str) + # Get the first expression from the input. + # + # @param [Array] lines +- # @param [Fixnum] consume A number of lines to automatically ++ # @param [Integer] consume A number of lines to automatically + # consume (add to the expression buffer) without checking for validity. + # @yield a clean-up function to run before checking for complete_expression + # @return [String] a valid ruby expression +diff --git a/lib/method_source/source_location.rb b/lib/method_source/source_location.rb +index 1e2a22a..7629869 100644 +--- a/lib/method_source/source_location.rb ++++ b/lib/method_source/source_location.rb +@@ -111,7 +111,7 @@ def source_location + case + when klass == Symbol + return :a.method(name).source_location +- when klass == Fixnum ++ when klass == Integer + return 0.method(name).source_location + when klass == TrueClass + return true.method(name).source_location diff --git a/rubygem-method_source.spec b/rubygem-method_source.spec new file mode 100644 index 0000000..2f40f8d --- /dev/null +++ b/rubygem-method_source.spec @@ -0,0 +1,61 @@ +%global gem_name method_source +Summary: Retrieve the source code for a method +Name: rubygem-%{gem_name} +Version: 0.8.2 +Release: 1 +License: MIT +URL: https://banisterfiend.wordpress.com +Source0: http://rubygems.org/gems/%{gem_name}-%{version}.gem +Patch0: rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings.patch +Patch1: rubygem-method_source-0.8.2-fix-fixnum-bignum-warnings-tests.patch +BuildRequires: ruby(release) rubygems-devel ruby rubygem-bacon +BuildArch: noarch +%description +Retrieve the source code for a method + +%package doc +Summary: Documentation for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch +%description doc +Documentation for %{name} + +%prep +%setup -q -c -T +%gem_install -n %{SOURCE0} +pushd .%{gem_instdir} +%patch0 -p1 +popd + +%build + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +%check +pushd .%{gem_instdir} +cat %{PATCH1} | patch -p1 +bacon test/test.rb +popd + +%files +%dir %{gem_instdir} +%exclude %{gem_instdir}/.* +%license %{gem_instdir}/LICENSE +%{gem_libdir} +%exclude %{gem_cache} +%{gem_spec} + +%files doc +%doc %{gem_docdir} +%{gem_instdir}/Gemfile +%doc %{gem_instdir}/README.markdown +%{gem_instdir}/Rakefile +%{gem_instdir}/method_source.gemspec +%{gem_instdir}/test + +%changelog +* Wed Aug 19 2020 geyanan - 0.8.2-1 +- package init diff --git a/rubygem-method_source.yaml b/rubygem-method_source.yaml new file mode 100644 index 0000000..5e39c9c --- /dev/null +++ b/rubygem-method_source.yaml @@ -0,0 +1,4 @@ +version_control:NA +src_repo:NA +tag_prefix: +seperator:"."