lib/coderunner/remote_code_runner.rb in coderunner-0.13.32 vs lib/coderunner/remote_code_runner.rb in coderunner-0.14.0

- old
+ new

@@ -22,15 +22,15 @@ # puts data # end # end # end - attr_accessor :combined_ids, :phantom_ids, :ids, :combined_run_list, :phantom_run_list, :run_list, :remote_cache, :libraries + attr_accessor :combined_ids, :component_ids, :ids, :combined_run_list, :component_run_list, :run_list, :remote_cache, :libraries # include Log # puts instance_methods; exit -# SHOULD_NOT_BE_CALLED = :add_phantom +# SHOULD_NOT_BE_CALLED = :add_component class << self aliold :new def new(host, folder, copts = {}) if host.length == 0 # p 'hello' @@ -156,11 +156,11 @@ shell_script = <<EOF cd #@folder export ROWS=#{Terminal.terminal_size[0]} export COLS=#{Terminal.terminal_size[1]} source /etc/bashrc /etc/profile > /dev/null 2> /dev/null -source ~/.bashrc ~/.bash_login ~/.bash_profile ~/.profile > /dev/null 2> /dev/null +#{%w{ ~/.bashrc ~/.bash_login ~/.bash_profile ~/.profile}.map{|w| "source #{w} > /dev/null 2> /dev/null "}.join(" && ")} if [ "$CODE_RUNNER_COMMAND" ] then $CODE_RUNNER_COMMAND runner_eval #{string.inspect} -Z #{@copts.inspect.inspect} else coderunner runner_eval #{string.inspect} -Z #{@copts.inspect.inspect} @@ -222,16 +222,10 @@ rescue TypeError, ArgumentError => err eputs err eputs data[0..100] if err.class == TypeError raise err unless err.message =~ /undefined class/ self.class.repair_marshal_run_class_not_found_error(err) - #NB this means that all code_names have to contain only lowercase letters: -# code, modlet = err.message.scan(/CodeRunner\:\:([A-Z][a-z0-9]+)([A-Z][\w]+)?Run/)[0] -# ep code, modlet -# modlet.gsub!(/\B([A-Z])/, '_\1') if modlet -# modlet = modlet.downcase if modlet -# @run_class = CodeRunner.setup_run_class(code.downcase, modlet: modlet) retry end if [:refresh, :auto].include? @remote_cache eputs "Writing Cache" @@ -239,46 +233,26 @@ end return output end def update -# ep '@server1', @server - instance_vars = retrieve_method(:marshalled_variables) #.sub(/\A\s*/, '') - #begin - #instance_vars = Marshal.load(data) - #rescue TypeError, ArgumentError => err - #eputs err - #eputs data [0..100] if err.class == TypeError - #raise err unless err.message =~ /undefined class/ - #self.class.repair_marshal_run_class_not_found_error(err) - ##NB this means that all code_names have to contain only lowercase letters: -## code, modlet = err.message.scan(/CodeRunner\:\:([A-Z][a-z0-9]+)([A-Z][\w]+)?Run/)[0] -## ep code, modlet -## modlet.gsub!(/\B([A-Z])/, '_\1') if modlet -## modlet = modlet.downcase if modlet -## @run_class = CodeRunner.setup_run_class(code.downcase, modlet: modlet) - #retry - #end -# ep @run_class.executable instance_vars[:@run_list].values.each{|run| run.runner=self} -# class_vars.each do |var, val| -# # raise 'found it ' + var.to_s if val.class == CodeRunner -# next if [:@@global_binding, :@@server, :SCRIPT_FOLDER, :@@sys].include? var -# self.class.class_variable_set(var, val) -# end instance_vars.each do |var, val| -# puts val.class -# raise 'found it ' + var.to_s if val.class == CodeRunner - next if [:@server, :@sys].include? var - instance_variable_set(var, val) + case var + when :@server, :@sys + next + when :@use_phantom + # For backwards compatbility with versions < 0.14 + instance_variable_set(:@use_component, val) + when :@phantom_run_list + # For backwards compatbility with versions < 0.14 + instance_variable_set(:@component_run_list, val) + else + instance_variable_set(var, val) + end end -# @run_class.executable = instance_vars[:@executable] - - # ep @run_class.executable -# ep '@sort', @sort sort_runs -# ep '@server', @server return self end end