bin/_rsense.rb in rsense-server-0.5.2 vs bin/_rsense.rb in rsense-server-0.5.4

- old
+ new

@@ -1,8 +1,11 @@ +#!/usr/bin/env ruby + require "rsense/server" require "rsense/server/config" require "optparse" +require "awesome_print" SOCKET_PATH = '127.0.0.1:' DEFAULT_PORT = 47367 options = {} @@ -60,34 +63,19 @@ configure { set :server, :puma } set :port, PORT def setup(jsondata) - if PROJMAN.roptions && PROJMAN.roptions.project_path.to_s =~ /#{jsondata["project"]}/ - changed = check_options(jsondata) - return if changed && changed.empty? + if PROJMAN.roptions && PROJMAN.roptions.project_path.to_s =~ /#{jsondata["project"]}/ && PROJMAN.rcommand && PROJMAN.roptions.file.to_s =~ /#{jsondata["file"]}/ + PROJMAN.roptions = Rsense::Server::Options.new(jsondata) PROJMAN.rcommand.options = PROJMAN.roptions else PROJMAN.roptions = Rsense::Server::Options.new(jsondata) PROJMAN.rcommand = Rsense::Server::Command::Command.new(PROJMAN.roptions) end end - def check_options(data) - changed = [] - data.each do |k, v| - if PROJMAN.roptions.respond_to? k.to_sym - keyval = PROJMAN.roptions.send k.to_sym - unless keyval.to_s =~ /#{v}/ - PROJMAN.roptions.__send__("#{k}=", v) - changed << k - end - end - end - changed - end - def code_completion if PROJMAN.roptions.code candidates = PROJMAN.rcommand.code_completion(PROJMAN.roptions.file, PROJMAN.roptions.location, PROJMAN.roptions.code) else candidates = PROJMAN.rcommand.code_completion(PROJMAN.roptions.file, PROJMAN.roptions.location) @@ -106,9 +94,11 @@ def add_deps Thread.new do if PROJMAN.rcommand.placeholders.first proj, feat = PROJMAN.rcommand.placeholders.shift + puts "Add deps: " + puts feat PROJMAN.rcommand.rrequire(proj, feat, true, 0) end end end