mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Vendor thor 1.0.0
This commit is contained in:
		
							parent
							
								
									38002a8adb
								
							
						
					
					
						commit
						0fab900538
					
				
				
				Notes:
				
					git
				
				2019-12-15 16:41:38 +09:00 
				
			
			
			
		
		
					 3 changed files with 44 additions and 9 deletions
				
			
		
							
								
								
									
										22
									
								
								lib/bundler/vendor/thor/lib/thor/base.rb
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								lib/bundler/vendor/thor/lib/thor/base.rb
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -2,6 +2,7 @@ require_relative "command"
 | 
			
		|||
require_relative "core_ext/hash_with_indifferent_access"
 | 
			
		||||
require_relative "error"
 | 
			
		||||
require_relative "invocation"
 | 
			
		||||
require_relative "nested_context"
 | 
			
		||||
require_relative "parser"
 | 
			
		||||
require_relative "shell"
 | 
			
		||||
require_relative "line_editor"
 | 
			
		||||
| 
						 | 
				
			
			@ -418,14 +419,20 @@ class Bundler::Thor
 | 
			
		|||
      #     remove_command :this_is_not_a_command
 | 
			
		||||
      #   end
 | 
			
		||||
      #
 | 
			
		||||
      def no_commands
 | 
			
		||||
        @no_commands = true
 | 
			
		||||
        yield
 | 
			
		||||
      ensure
 | 
			
		||||
        @no_commands = false
 | 
			
		||||
      def no_commands(&block)
 | 
			
		||||
        no_commands_context.enter(&block)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      alias_method :no_tasks, :no_commands
 | 
			
		||||
 | 
			
		||||
      def no_commands_context
 | 
			
		||||
        @no_commands_context ||= NestedContext.new
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def no_commands?
 | 
			
		||||
        no_commands_context.entered?
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Sets the namespace for the Bundler::Thor or Bundler::Thor::Group class. By default the
 | 
			
		||||
      # namespace is retrieved from the class name. If your Bundler::Thor class is named
 | 
			
		||||
      # Scripts::MyScript, the help method, for example, will be called as:
 | 
			
		||||
| 
						 | 
				
			
			@ -607,7 +614,7 @@ class Bundler::Thor
 | 
			
		|||
      def inherited(klass)
 | 
			
		||||
        super(klass)
 | 
			
		||||
        Bundler::Thor::Base.register_klass_file(klass)
 | 
			
		||||
        klass.instance_variable_set(:@no_commands, false)
 | 
			
		||||
        klass.instance_variable_set(:@no_commands, 0)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Fire this callback whenever a method is added. Added methods are
 | 
			
		||||
| 
						 | 
				
			
			@ -624,8 +631,7 @@ class Bundler::Thor
 | 
			
		|||
        # Return if it's not a public instance method
 | 
			
		||||
        return unless public_method_defined?(meth.to_sym)
 | 
			
		||||
 | 
			
		||||
        @no_commands ||= false
 | 
			
		||||
        return if @no_commands || !create_command(meth)
 | 
			
		||||
        return if no_commands? || !create_command(meth)
 | 
			
		||||
 | 
			
		||||
        is_thor_reserved_word?(meth, :command)
 | 
			
		||||
        Bundler::Thor::Base.register_klass_file(self)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										29
									
								
								lib/bundler/vendor/thor/lib/thor/nested_context.rb
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								lib/bundler/vendor/thor/lib/thor/nested_context.rb
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
class Bundler::Thor
 | 
			
		||||
  class NestedContext
 | 
			
		||||
    def initialize
 | 
			
		||||
      @depth = 0
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def enter
 | 
			
		||||
      push
 | 
			
		||||
 | 
			
		||||
      yield
 | 
			
		||||
    ensure
 | 
			
		||||
      pop
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def entered?
 | 
			
		||||
      @depth > 0
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    private
 | 
			
		||||
 | 
			
		||||
    def push
 | 
			
		||||
      @depth += 1
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def pop
 | 
			
		||||
      @depth -= 1
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
							
								
								
									
										2
									
								
								lib/bundler/vendor/thor/lib/thor/version.rb
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								lib/bundler/vendor/thor/lib/thor/version.rb
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,3 @@
 | 
			
		|||
class Bundler::Thor
 | 
			
		||||
  VERSION = "0.20.3"
 | 
			
		||||
  VERSION = "1.0.0"
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue