lib/coderunner/class_methods.rb in coderunner-0.11.23 vs lib/coderunner/class_methods.rb in coderunner-0.12.0

- old
+ new

@@ -75,10 +75,32 @@ def self.delete(copts={}) runner = fetch_runner(copts) runner.destroy end + def self.dumb_film(copts = {}) +# process_copts(copts) + #old_term = GraphKit::GNUPLOT_DEFAULT_TERM + size = Terminal.terminal_size + size[0] -= 2 + term = "dumb #{size.reverse.join(' ')}" + string = "\n" * size[0] + + runner = fetch_runner(copts) + string_to_eval = copts[:w] + frame_array = copts[:F][:frame_array] || copts[:F][:fa] + index_name = copts[:F][:index_name] || copts[:F][:in] + #options = (options and options =~ /\S/) ? eval(options): {} + puts string + for index in frame_array[0]..frame_array[1] + string.true_lines.times{print "\033[A"} + kit = runner.graphkit_from_lists(copts[:G], copts[:g], index_name => index) + kit.gp.term = term + kit.gnuplot(eval: string_to_eval) + sleep(copts[:F][:fr] ? 1.0/copts[:F][:fr] : 0.1) + end + end # def self.executable_name # :nodoc: # "" # end # # def self.rcp # :nodoc: @@ -203,16 +225,20 @@ puts string exec string end + def self.launcher_directory + ENV['HOME'] + "/.coderunner/to_launch/#{ENV['CODE_RUNNER_LAUNCHER']}" + end def self.start_launcher(refresh, max_queue, copts={}) raise "Raise refresh is #{refresh}: it must be >= 1" if refresh.to_i < 1 raise "Raise max_queue is #{max_queue}: it must be >= 5" if max_queue.to_i < 5 #raise "Launcher already running" if %x[ps -e -o cmd].split("\n").grep(/coderunner\s+launch/).size > 0 require 'thread' - tl = ENV['HOME'] + "/.coderunner_to_launch_#{ENV['CODE_RUNNER_LAUNCHER']}" #SCRIPT_FOLDER + '/to_launch' - exit unless Feedback.get_boolean( "Launch directory #{tl} already exists: it is suggested that you change the prefix by changing the environment variable CODE_RUNNER_LAUNCHER. Do you wish to continue (don't select yes unless you know what you are doing)?") if FileTest.exist? tl + tl = launcher_directory #SCRIPT_FOLDER + '/to_launch' + #exit unless Feedback.get_boolean( "Launch directory #{tl} already exists: it is suggested that you change the prefix by changing the environment variable CODE_RUNNER_LAUNCHER. Do you wish to continue (don't select yes unless you know what you are doing)?") if FileTest.exist? tl + raise "Launch directory #{tl} already exists: it is suggested that you change the prefix by changing the environment variable CODE_RUNNER_LAUNCHER. Do you wish to continue (don't select yes unless you know what you are doing)?" if FileTest.exist? tl # FileUtils.rm_r tl if FileTest.exist? tl eputs "Starting launcher\n" at_exit{FileUtils.rm_r tl} FileUtils.makedirs tl Thread.new{loop{`cp #{tl}/queue_status.txt #{tl}/queue_status2.txt; ps > #{tl}/queue_status.txt`; sleep 1}}