Browse Source

Merge "Improve environment integration"

Jenkins 2 years ago
parent
commit
f925f5e84c
5 changed files with 24 additions and 5 deletions
  1. 7
    1
      lib/noop/config/base.rb
  2. 3
    1
      lib/noop/manager/base.rb
  3. 1
    1
      lib/noop/manager/options.rb
  4. 9
    0
      lib/noop/task/run.rb
  5. 4
    2
      noop_tests.rb

+ 7
- 1
lib/noop/config/base.rb View File

@@ -117,7 +117,13 @@ module Noop
117 117
     # @return [Pathname]
118 118
     def self.dir_path_reports
119 119
       return @dir_path_reports if @dir_path_reports
120
-      @dir_path_reports = dir_path_root + 'reports'
120
+      @dir_path_reports = Noop::Utils.path_from_env 'SPEC_REPORTS_DIR'
121
+      @dir_path_reports = dir_path_root + 'reports' unless @dir_path_reports
122
+      begin
123
+        @dir_path_reports = @dir_path_reports.realpath
124
+      rescue
125
+        @dir_path_reports
126
+      end
121 127
     end
122 128
   end
123 129
 end

+ 3
- 1
lib/noop/manager/base.rb View File

@@ -176,7 +176,9 @@ module Noop
176 176
 
177 177
 #########################################
178 178
 
179
-    def main
179
+    def main(override_options = {})
180
+      options.merge! override_options
181
+
180 182
       if ENV['SPEC_TASK_CONSOLE']
181 183
         require 'pry'
182 184
         binding.pry

+ 1
- 1
lib/noop/manager/options.rb View File

@@ -15,7 +15,7 @@ module Noop
15 15
         opts.on('-j', '--jobs JOBS', 'Parallel run RSpec jobs') do |jobs|
16 16
           @options[:parallel_run] = jobs
17 17
         end
18
-        opts.on('-g', '--globals', 'Run all globals tasks and update saved globals YAML files') do |jobs|
18
+        opts.on('-g', '--globals', 'Run all globals tasks and update saved globals YAML files') do
19 19
           ENV['SPEC_UPDATE_GLOBALS'] = 'YES'
20 20
           options[:filter_specs] = [Noop::Config.spec_name_globals]
21 21
         end

+ 9
- 0
lib/noop/task/run.rb View File

@@ -59,6 +59,15 @@ module Noop
59 59
           'SPEC_FACTS_NAME' => file_name_facts.to_s,
60 60
           'SPEC_FILE_NAME' => file_name_spec.to_s,
61 61
           'GEM_HOME' => Noop::Config.dir_path_gem_home.to_s,
62
+
63
+          'SPEC_ROOT_DIR' => Noop::Config.dir_path_root.to_s,
64
+          'SPEC_DEPLOYMENT_DIR' => Noop::Config.dir_path_deployment.to_s,
65
+          'SPEC_HIERA_DIR' => Noop::Config.dir_path_hiera.to_s,
66
+          'SPEC_FACTS_DIR' => Noop::Config.dir_path_facts.to_s,
67
+          'SPEC_REPORTS_DIR' => Noop::Config.dir_path_reports.to_s,
68
+          'SPEC_SPEC_DIR' => Noop::Config.dir_path_task_spec.to_s,
69
+          'SPEC_TASK_DIR' => Noop::Config.dir_path_tasks_local.to_s,
70
+          'SPEC_MODULE_PATH' => Noop::Config.dir_path_modules_local.to_s,
62 71
       }
63 72
       command = "rspec #{file_path_spec.to_s} #{rspec_options} --format json --out #{file_path_report_json.to_s}"
64 73
       command = "bundle exec #{command}" if ENV['SPEC_BUNDLE_EXEC']

+ 4
- 2
noop_tests.rb View File

@@ -5,5 +5,7 @@ require_relative 'lib/noop/task'
5 5
 require_relative 'lib/noop/manager'
6 6
 require_relative 'lib/noop/utils'
7 7
 
8
-manager = Noop::Manager.new
9
-manager.main
8
+if $0 == __FILE__
9
+  manager = Noop::Manager.new
10
+  manager.main
11
+end

Loading…
Cancel
Save