Sha256: 545e9c0e0fbaf1bee3ada9544ee6e091d3fa48de4f0c70b2b45388ca84355535

Contents?: true

Size: 657 Bytes

Versions: 18

Compression:

Stored size: 657 Bytes

Contents

require 'rush/shell'

module Rush
	# This is a class that can be embedded in other applications 
	# rake tasks, utility scripts, etc
	# 
	# Delegates unknown method calls to a Rush::Shell instance
	class EmbeddableShell
		attr_accessor :shell
		def initialize(suppress_output = true)
			self.shell = Rush::Shell.new
			shell.suppress_output = suppress_output
		end
		
		# evalutes and unkown method call agains the rush shell
		def method_missing(sym, *args, &block)
			shell.execute sym.to_s
			$last_res
		end
		
		# take a whole block and execute it as if it were inside a shell
		def execute_in_shell(&block)
			self.instance_eval(&block)
		end
	end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
adamwiggins-rush-0.6.1 lib/rush/embeddable_shell.rb
adamwiggins-rush-0.6.2 lib/rush/embeddable_shell.rb
dysinger-rush-0.4.1221060147 lib/rush/embeddable_shell.rb
dysinger-rush-0.4.1221072146 lib/rush/embeddable_shell.rb
dysinger-rush-0.4 lib/rush/embeddable_shell.rb
rush-0.6.8 lib/rush/embeddable_shell.rb
rush-0.6.7 lib/rush/embeddable_shell.rb
rush-0.6.6 lib/rush/embeddable_shell.rb
rush-0.6.5 lib/rush/embeddable_shell.rb
rush-0.6.4 lib/rush/embeddable_shell.rb
rush-0.6.3 lib/rush/embeddable_shell.rb
rush-0.6.2 lib/rush/embeddable_shell.rb
rush-0.6 lib/rush/embeddable_shell.rb
rush-0.6.1 lib/rush/embeddable_shell.rb
rush-0.4.1 lib/rush/embeddable_shell.rb
rush-0.4.2 lib/rush/embeddable_shell.rb
rush-0.5.1 lib/rush/embeddable_shell.rb
rush-0.5 lib/rush/embeddable_shell.rb