diff --git a/.gitignore b/.gitignore index 3d0efe5..26be770 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ thor-0.13.6.gem /thor-0.14.6.gem +/thor-0.16.0.gem diff --git a/rubygem-thor.spec b/rubygem-thor.spec index 40b75b6..ba4e93d 100644 --- a/rubygem-thor.spec +++ b/rubygem-thor.spec @@ -5,30 +5,20 @@ Summary: Scripting framework that replaces rake, sake and rubigen Name: rubygem-%{gem_name} -Version: 0.14.6 -Release: 6%{?dist} +Version: 0.16.0 +Release: 1%{?dist} Group: Development/Languages License: MIT -URL: http://github.com/wycats/thor -Source0: http://rubygems.org/download/%{gem_name}-%{version}.gem -# all these patches should be contained in next version -Patch0: thor-allow-random-test-execution-order.patch -Patch1: thor-rake-0.9-compat.patch -Patch2: thor-fix-method-missing.patch -Patch3: thor-fix-rake-desc-not-being-passed.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +URL: http://whatisthor.com/ +Source0: http://rubygems.org/downloads/%{gem_name}-%{version}.gem Requires: ruby(rubygems) Requires: ruby(abi) = %{rubyabi} -Requires: rubygem(ruby2ruby) -Requires: rubygem(rake) -Requires: rubygem(diff-lcs) BuildRequires: rubygems-devel BuildRequires: ruby(abi) = %{rubyabi} -BuildRequires: rubygem(rspec-core) -BuildRequires: rubygem(rake) -BuildRequires: rubygem(diff-lcs) -BuildRequires: rubygem(rdoc) +BuildRequires: rubygem(rspec) BuildRequires: rubygem(fakeweb) +BuildRequires: rubygem(bundler) +BuildRequires: git BuildArch: noarch Provides: rubygem(%{gem_name}) = %{version} @@ -38,8 +28,8 @@ Thor is a scripting framework that replaces rake, sake and rubigen. %package doc Summary: Documentation for %{name} Group: Documentation - Requires: %{name} = %{version}-%{release} +BuildArch: noarch %description doc This package contains documentation for %{name}. @@ -50,17 +40,11 @@ This package contains documentation for %{name}. mkdir -p .%{gem_dir} gem install -V \ --local \ - --install-dir $(pwd)/%{gem_dir} \ - --force --rdoc \ + --install-dir .%{gem_dir} \ + --bindir .%{_bindir} \ + --force \ %{SOURCE0} -pushd .%{gem_instdir} -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -popd - %build %install @@ -68,44 +52,55 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{gem_dir} cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}/ -mkdir -p %{buildroot}/%{_bindir} -mv %{buildroot}%{gem_dir}/bin/* %{buildroot}/%{_bindir} -rmdir %{buildroot}%{gem_dir}/bin +mkdir -p %{buildroot}%{_bindir} +cp -pa .%{_bindir}/* \ + %{buildroot}%{_bindir}/ + find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x find %{buildroot}%{gem_instdir}/bin -type f | \ xargs -n 1 sed -i -e 's"^#!/usr/bin/env ruby"#!/usr/bin/ruby"' -%clean -rm -rf %{buildroot} - %check -pushd %{buildroot}%{gem_instdir} +pushd .%{gem_instdir} # kill simplecov dependency sed -i '3,7d' spec/spec_helper.rb + +# This fixes on test failure due to encoding issues. +# https://github.com/wycats/thor/issues/278 +sed -i '166 i\content.force_encoding "UTF-8"' spec/shell/basic_spec.rb + rspec spec popd %files -%defattr(-,root,root,-) %{_bindir}/thor %{_bindir}/rake2thor +%dir %{gem_instdir} %doc %{gem_instdir}/CHANGELOG.rdoc -%doc %{gem_instdir}/LICENSE +%doc %{gem_instdir}/LICENSE.md %doc %{gem_instdir}/README.md -%dir %{gem_instdir} +%exclude %{gem_instdir}/.* %{gem_instdir}/bin %{gem_libdir} -%{gem_cache} +%exclude %{gem_cache} %{gem_spec} %files doc -%defattr(-,root,root,-) +%{gem_instdir}/Gemfile %{gem_instdir}/Thorfile -%{gem_instdir}/spec -%{gem_docdir} +%{gem_instdir}/thor.gemspec +%{gem_instdir}/spec/ +%exclude %{gem_instdir}/spec/fixtures/doc/components/.empty_directory +%doc %{gem_docdir} %changelog +* Tue Nov 13 2012 Vít Ondruch - 0.16.0-1 +- Update to thor 0.16.0. +- Remove rubygem(diff-lcs) dependency, since it is just optional. +- Remove rubygem(ruby2ruby) dependnecy, since it is just optional, to allow + conversion of Rakefiles to Thorfiles (but it doesnt work withou ParseTree anyway). + * Sat Jul 21 2012 Fedora Release Engineering - 0.14.6-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild diff --git a/sources b/sources index 3886d0d..8c5f047 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d52dcc3cc08a2e6443bba665c2123a59 thor-0.14.6.gem +e8ddb0b47f3fbd4b84e1b387fb68c00d thor-0.16.0.gem diff --git a/thor-allow-random-test-execution-order.patch b/thor-allow-random-test-execution-order.patch deleted file mode 100644 index a05f2a8..0000000 --- a/thor-allow-random-test-execution-order.patch +++ /dev/null @@ -1,29 +0,0 @@ -commit fb1a829d173a633446c56b4d0ed665312882e83b -Author: Brian Donovan -Date: Tue Sep 20 09:31:49 2011 -0700 - - Replace ARGV with an empty array before each spec run. - - Some of the specs were leaving ARGV in a non-pristine state (such as - those in runner_spec.rb), which was then implicitly used in - Thor::Base.start et al. It happened to be the case that the order in - which rspec was loading and running the specs made this not a problem, - but if the specs were run in a randomized order it could be a problem. - - Closes #171. - -diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb -index 00181ad..175637d 100644 ---- a/spec/spec_helper.rb -+++ b/spec/spec_helper.rb -@@ -29,6 +29,10 @@ load File.join(File.dirname(__FILE__), "fixtures", "script.thor") - load File.join(File.dirname(__FILE__), "fixtures", "invoke.thor") - - RSpec.configure do |config| -+ config.before :each do -+ ARGV.replace [] -+ end -+ - def capture(stream) - begin - stream = stream.to_s diff --git a/thor-fix-method-missing.patch b/thor-fix-method-missing.patch deleted file mode 100644 index 4282f27..0000000 --- a/thor-fix-method-missing.patch +++ /dev/null @@ -1,120 +0,0 @@ -commit 018b25811118c3bb95162324b3feae3a1e2b9923 -Author: Yehuda Katz -Date: Sat Jul 2 20:51:23 2011 -0700 - - Get method_missing working again. I'm not sure how it was working before, but the tests didn't pass. - -# Altered a bit to work with this version. -diff --git a/lib/thor/task.rb b/lib/thor/task.rb -index 8dcff53..f94d5b6 100644 ---- a/lib/thor/task.rb -+++ b/lib/thor/task.rb -@@ -18,8 +18,15 @@ class Thor - # By default, a task invokes a method in the thor class. You can change this - # implementation to create custom tasks. - def run(instance, args=[]) -- public_method?(instance) ? -- instance.send(name, *args) : instance.class.handle_no_task_error(name) -+ if private_method?(instance) -+ instance.class.handle_no_task_error(name) -+ elsif public_method?(instance) -+ instance.send(name, *args) -+ elsif local_method?(instance, :method_missing) -+ instance.send(:method_missing, name.to_sym, *args) -+ else -+ instance.class.handle_no_task_error(name) -+ end - rescue ArgumentError => e - handle_argument_error?(instance, e, caller) ? - instance.class.handle_argument_error(self, e) : (raise e) -@@ -71,6 +78,15 @@ class Thor - (collection & [name.to_s, name.to_sym]).empty? - end - -+ def private_method?(instance) -+ !(instance.private_methods & [name.to_s, name.to_sym]).empty? -+ end -+ -+ def local_method?(instance, name) -+ methods = instance.public_methods(false) + instance.private_methods(false) + instance.protected_methods(false) -+ !(methods & [name.to_s, name.to_sym]).empty? -+ end -+ - def sans_backtrace(backtrace, caller) #:nodoc: - saned = backtrace.reject { |frame| frame =~ FILE_REGEXP } - saned -= caller -@@ -105,11 +121,7 @@ class Thor - - def run(instance, args=[]) - if (instance.methods & [name.to_s, name.to_sym]).empty? -- if ((instance.protected_methods + instance.public_methods) & ([:method_missing, "method_missing"])).empty? -- super -- else -- instance.send(:method_missing, name.to_sym, *args) -- end -+ super - else - instance.class.handle_no_task_error(name) - end -diff --git a/spec/task_spec.rb b/spec/task_spec.rb -index 1c7ea7c..3372de1 100644 ---- a/spec/task_spec.rb -+++ b/spec/task_spec.rb -@@ -11,21 +11,18 @@ describe Thor::Task do - - describe "#formatted_usage" do - it "includes namespace within usage" do -- Object.stub!(:namespace).and_return("foo") -- Object.stub!(:arguments).and_return([]) -- task(:bar => :required).formatted_usage(Object).should == "foo:can_has --bar=BAR" -+ object = Struct.new(:namespace, :arguments).new("foo", []) -+ task(:bar => :required).formatted_usage(object).should == "foo:can_has --bar=BAR" - end - - it "removes default from namespace" do -- Object.stub!(:namespace).and_return("default:foo") -- Object.stub!(:arguments).and_return([]) -- task(:bar => :required).formatted_usage(Object).should == ":foo:can_has --bar=BAR" -+ object = Struct.new(:namespace, :arguments).new("default:foo", []) -+ task(:bar => :required).formatted_usage(object).should == ":foo:can_has --bar=BAR" - end - - it "injects arguments into usage" do -- Object.stub!(:namespace).and_return("foo") -- Object.stub!(:arguments).and_return([ Thor::Argument.new(:bar, nil, true, :string) ]) -- task(:foo => :required).formatted_usage(Object).should == "foo:can_has BAR --foo=FOO" -+ object = Struct.new(:namespace, :arguments).new("foo", [Thor::Argument.new(:bar, nil, true, :string)]) -+ task(:foo => :required).formatted_usage(object).should == "foo:can_has BAR --foo=FOO" - end - end - -@@ -55,15 +52,23 @@ describe Thor::Task do - describe "#run" do - it "runs a task by calling a method in the given instance" do - mock = mock() -- mock.should_receive(:send).with("can_has", 1, 2, 3) -- task.run(mock, [1, 2, 3]) -+ mock.should_receive(:can_has).and_return {|*args| args } -+ task.run(mock, [1, 2, 3]).should == [1, 2, 3] - end - - it "raises an error if the method to be invoked is private" do -- mock = mock() -- mock.should_receive(:private_methods).and_return(['can_has']) -- mock.class.should_receive(:handle_no_task_error).with("can_has") -- task.run(mock) -+ klass = Class.new do -+ def self.handle_no_task_error(name) -+ name -+ end -+ -+ private -+ def can_has -+ "fail" -+ end -+ end -+ -+ task.run(klass.new).should == "can_has" - end - end - end diff --git a/thor-fix-rake-desc-not-being-passed.patch b/thor-fix-rake-desc-not-being-passed.patch deleted file mode 100644 index b639240..0000000 --- a/thor-fix-rake-desc-not-being-passed.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit 36603c1811451d370da4915e24eed665fe805ae4 -Author: Gabriel Horner -Date: Mon Jul 4 14:44:07 2011 -0400 - - Fix rake desc not being passed to thor - -diff --git a/lib/thor/rake_compat.rb b/lib/thor/rake_compat.rb -index b3a8beb..c86e840 100644 ---- a/lib/thor/rake_compat.rb -+++ b/lib/thor/rake_compat.rb -@@ -46,7 +46,8 @@ self.instance_eval do - description << task.arg_names.map{ |n| n.to_s.upcase }.join(' ') - description.strip! - -- klass.desc description, task.comment || non_namespaced_name -+ klass.desc description, Rake.application.last_description || non_namespaced_name -+ Rake.application.last_description = nil - klass.send :define_method, non_namespaced_name do |*args| - Rake::Task[task.name.to_sym].invoke(*args) - end diff --git a/thor-rake-0.9-compat.patch b/thor-rake-0.9-compat.patch deleted file mode 100644 index f2e3408..0000000 --- a/thor-rake-0.9-compat.patch +++ /dev/null @@ -1,115 +0,0 @@ -commit 11c8748933cc611972f32831657ab99e6701bd93 -Author: Yehuda Katz -Date: Sat Jul 2 20:50:39 2011 -0700 - - Upgrade Rake compatibility for the more constrained Rake 0.9 - -diff --git a/lib/thor/rake_compat.rb b/lib/thor/rake_compat.rb -index 0d0757f..b3a8beb 100644 ---- a/lib/thor/rake_compat.rb -+++ b/lib/thor/rake_compat.rb -@@ -1,4 +1,5 @@ - require 'rake' -+require 'rake/dsl_definition' - - class Thor - # Adds a compatibility layer to your Thor classes which allows you to use -@@ -16,6 +17,8 @@ class Thor - # end - # - module RakeCompat -+ include Rake::DSL if defined?(Rake::DSL) -+ - def self.rake_classes - @rake_classes ||= [] - end -@@ -29,12 +32,12 @@ class Thor - end - end - --class Object #:nodoc: -- alias :rake_task :task -- alias :rake_namespace :namespace -+# override task on (main), for compatibility with Rake 0.9 -+self.instance_eval do -+ alias rake_namespace namespace - -- def task(*args, &block) -- task = rake_task(*args, &block) -+ def task(*) -+ task = super - - if klass = Thor::RakeCompat.rake_classes.last - non_namespaced_name = task.name.split(':').last -@@ -52,7 +55,7 @@ class Object #:nodoc: - task - end - -- def namespace(name, &block) -+ def namespace(name) - if klass = Thor::RakeCompat.rake_classes.last - const_name = Thor::Util.camel_case(name.to_s).to_sym - klass.const_set(const_name, Class.new(Thor)) -@@ -60,7 +63,8 @@ class Object #:nodoc: - Thor::RakeCompat.rake_classes << new_klass - end - -- rake_namespace(name, &block) -+ super - Thor::RakeCompat.rake_classes.pop - end - end -+ -diff --git a/lib/thor/task.rb b/lib/thor/task.rb -index 6db3b60..8dcff53 100644 ---- a/lib/thor/task.rb -+++ b/lib/thor/task.rb -@@ -104,7 +104,11 @@ class Thor - - def run(instance, args=[]) - if (instance.methods & [name.to_s, name.to_sym]).empty? -- super -+ if ((instance.protected_methods + instance.public_methods) & ([:method_missing, "method_missing"])).empty? -+ super -+ else -+ instance.send(:method_missing, name.to_sym, *args) -+ end - else - instance.class.handle_no_task_error(name) - end -diff --git a/spec/rake_compat_spec.rb b/spec/rake_compat_spec.rb -index f8d694c..0b642aa 100644 ---- a/spec/rake_compat_spec.rb -+++ b/spec/rake_compat_spec.rb -@@ -2,20 +2,24 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') - require 'thor/rake_compat' - require 'rake/tasklib' - -+$main = self -+ - class RakeTask < Rake::TaskLib - def initialize - define - end - - def define -- desc "Say it's cool" -- task :cool do -- puts "COOL" -- end -+ $main.instance_eval do -+ desc "Say it's cool" -+ task :cool do -+ puts "COOL" -+ end - -- namespace :hiper_mega do -- task :super do -- puts "HIPER MEGA SUPER" -+ namespace :hiper_mega do -+ task :super do -+ puts "HIPER MEGA SUPER" -+ end - end - end - end