Module: Onceover::CodeQuality::Environment
- Defined in:
- lib/onceover/codequality/environment.rb
Constant Summary collapse
- ENVIRONMENT_CONF =
"environment.conf"
Class Method Summary collapse
-
.get_site_dirs ⇒ Object
Latest best practice is to change the name of ‘site` to be `site-modules`.
Class Method Details
.get_site_dirs ⇒ Object
Latest best practice is to change the name of ‘site` to be `site-modules`. This means we need to start processing `environment.conf` to extract this…
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/onceover/codequality/environment.rb', line 10 def self.get_site_dirs() if File.exist?(ENVIRONMENT_CONF) #modulepath = site-modules:modules:$basemodulepath modulepath = open(ENVIRONMENT_CONF) { |f| f.each_line.find { |line| line.include?("modulepath") } } begin environments = modulepath.split("=")[1].split(":").reject { |e| # reject any elements containing interpolation or referencing modules # loaded by r10k e =~ /\$/ || e == "modules" || e =~ /[\\.\/]/ }.map { |e| e.strip } rescue NoMethodError => e raise "Malformed environment configuration: #{ENVIRONMENT_CONF}" end else raise "Missing environment configuration: #{ENVIRONMENT_CONF}" end environments end |