class StackProf::Local::Configuration
Constants
- ERB_EOUTVAR
- OPTIONS_FILE
Attributes
local_gems[R]
local_project[R]
remote_gems[R]
remote_project[R]
Public Class Methods
new(args)
click to toggle source
# File lib/stackprof/local/configuration.rb, line 14 def initialize(args) parser.parse!(args_from_options_file) parser.parse!(args) end
Private Instance Methods
args_from_options_file()
click to toggle source
# File lib/stackprof/local/configuration.rb, line 36 def args_from_options_file return [] unless File.exist?(OPTIONS_FILE) options_file_as_erb_string(OPTIONS_FILE).split(/\n+/).flat_map(&:shellsplit) end
options_file_as_erb_string(path)
click to toggle source
# File lib/stackprof/local/configuration.rb, line 41 def options_file_as_erb_string(path) ERB.new(File.read(path), nil, ERB_EOUTVAR).result(binding) end
parser()
click to toggle source
# File lib/stackprof/local/configuration.rb, line 21 def parser OptionParser.new do |parser| parser.on("--remote-gems PATH", String) do |path| @remote_gems = regexpify(path) end parser.on("--remote-project PATH", String) do |path| @remote_project = regexpify(path) end parser.on("--local-gems PATH", String) { |path| @local_gems = path } parser.on("--local-project PATH", String) { |path| @local_project = path } end end
regexpify(expression)
click to toggle source
# File lib/stackprof/local/configuration.rb, line 45 def regexpify(expression) Regexp === expression ? expression : /#{expression}/ end