class Rsense::Server::Command::Preload
Constants
- SourceCode
Public Class Methods
code(libs)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 28 def self.code(libs) libs.each do |l| l.files = Dir.glob(Pathname.new(l.path).join("**/*.rb")) end end
concat_files(paths)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 34 def self.concat_files(paths) code = paths.files.map { |f| Pathname.new(f).read } paths.source = code.join("\n") end
dependency_code(dependencies)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 16 def self.dependency_code(dependencies) paths = dependencies.map { |d| gen_source(d) }.compact! return [] unless paths lib_dirs(paths) code(paths) paths.each { |l| concat_files(l) } end
find_lib(path)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 45 def self.find_lib(path) p = Pathname.new(path.path).expand_path return p.dirname if p.file? return p end
gen_source(d)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 24 def self.gen_source(d) SourceCode.new(d.name, d.full_name, d.path.first) if d.path.first end
lib_dirs(paths)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 39 def self.lib_dirs(paths) paths.each { |p| p.path = find_lib(p) } end
load(project_manager, path)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 11 def self.load(project_manager, path) PROJMAN.roptions = Rsense::Server::Options.new(stub_data(path)) PROJMAN.rcommand = Rsense::Server::Command::Command.new(PROJMAN.roptions) end
stub_data(path)
click to toggle source
# File lib/rsense/server/command/preload.rb, line 7 def self.stub_data(path) { "project" => path.to_s } end