class Bio::Shell::Web
Public Class Methods
new()
click to toggle source
# File lib/bio/shell/web.rb, line 17 def initialize Bio::Shell.cache[:binding] = binding Bio::Shell.cache[:results] ||= Results.new install_rails setup_rails start_rails end
Private Instance Methods
install_rails()
click to toggle source
# File lib/bio/shell/web.rb, line 37 def install_rails savedir = Bio::Shell.cache[:savedir] path = File.join(savedir, "script", "generate") unless File.exist?(path) puts "Installing Rails application for BioRuby shell ... " system("rails #{savedir}") puts "done" end path = File.join(savedir, "app", "controllers", "bioruby_controller.rb") unless File.exist?(path) basedir = File.dirname(__FILE__) puts "Installing Rails plugin for BioRuby shell ... " FileUtils.cp_r("#{basedir}/rails/.", savedir) Dir.chdir(savedir) do system("./script/generate bioruby shell") end puts "done" end end
setup_rails()
click to toggle source
# File lib/bio/shell/web.rb, line 27 def setup_rails puts puts ">>>" puts ">>> open http://localhost:3000/bioruby" puts ">>>" puts puts '(You can change the port number by adding "-- -p 4000" option)' puts end
start_rails()
click to toggle source
# File lib/bio/shell/web.rb, line 57 def start_rails begin Bio::Shell.cache[:rails] = Thread.new do Dir.chdir(Bio::Shell.cache[:savedir]) do require './config/boot' require 'commands/server' end end end end