lib/runnable.rb in runnable-0.1.1 vs lib/runnable.rb in runnable-0.1.2
- old
+ new
@@ -14,10 +14,15 @@
#
# You should have received a copy of the GNU General Public License
# along with Runnable. If not, see <http://www.gnu.org/licenses/>.
+require 'runnable/gnu'
+require 'runnable/extended'
+
+require 'publisher'
+
# Convert a executable command in a Ruby-like class
# you are able to start, define params and send signals (like kill, or stop)
#
# @example Usage:
# class LS < Runnable
@@ -25,15 +30,10 @@
# end
#
# ls = LS.new
# ls.alh
# ls.run
-#
-$LOAD_PATH << File.expand_path( './runnable', __FILE__ )
-
-require 'publisher'
-
class Runnable
extend Publisher
# Fires to know whats happening inside
can_fire :fail, :finish
@@ -113,13 +113,11 @@
# we dont set the pid, because we dont know until run
@pid = nil
@excep_array = []
- # Metaprogramming part
- # Require the class to parse the command line options
- require command_style.to_s.downcase
+ # Metaprogramming part
# Create a new instance of the parser class
@command_line_interface = Object.const_get( command_style.to_s.capitalize.to_sym ).new
# End Metaprogramming part
#End of initialize instance variables
@@ -137,12 +135,11 @@
# Create pipes to redirect Standar I/O
out_rd, out_wr = IO.pipe
# Redirect Error I/O
err_rd, err_wr = IO.pipe
-
- #
+
@pid = Process.spawn( "#{@command} #{@input.join( " " )} \
#{@options} #{@command_line_interface.parse} \
#{@output.join( " " )}", { :out => out_wr, :err => err_wr } )
# Include instance in class variable
@@ -304,10 +301,9 @@
#
# @param [Symbol] method Method called that is missing
# @param [Array] params Params in the call
# @param [Block] block Block code in method
# @return [nil]
- # @override
def method_missing( method, *params, &block )
if params.length > 1
super( method, params, block )
else
if params[0].class == Hash