Package: serverspec-runner / 1.2.2-1

fix-path-issue Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Description: Workaround for default files location to fit debian.
Forwarded: not-needed
Author: KURASHIKI Satoru <lurdan@gmail.com>

Index: serverspec-runner/Rakefile
===================================================================
--- serverspec-runner.orig/Rakefile
+++ serverspec-runner/Rakefile
@@ -13,6 +13,8 @@ task :spec => 'spec:all'
 
 namespace :spec do
 
+  ENV['TEMPLATE_PATH'] = ENV['TEMPLATE_PATH'] || '/usr/share/serverspec-runner'
+
   ENV['EXEC_PATH'] = '/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin'
 
   if ENV['specroot'] == nil
@@ -26,8 +28,9 @@ namespace :spec do
   Dir.chdir(ENV['specroot']) if Dir.exists?(ENV['specroot'])
 
   ENV['specpath'] = "#{ENV['specroot']}/spec"
-  ENV['ssh_options'] = ENV['ssh_options'] || "#{ENV['specroot']}/ssh_options_default.yml" || "#{File.dirname(__FILE__)}/ssh_options_default.yml"
-  ENV['ssh_options'] = "#{File.dirname(__FILE__)}/ssh_options_default.yml" unless File.exists?(ENV['ssh_options'])
+  ENV['ssh_options'] = ENV['ssh_options'] || "#{ENV['specroot']}/ssh_options_default.yml"
+  ENV['ssh_options'] = "#{ENV['TEMPLATE_PATH']}/ssh_options_default.yml" unless File.exists?(ENV['ssh_options'])
+
   ssh_options = YAML.load_file(ENV['ssh_options'])
   ENV['result_csv'] = ENV['result_csv'] || './_serverspec_result.csv'
   csv_file = ENV['result_csv']
@@ -49,11 +52,11 @@ namespace :spec do
     end
 
     FileUtils.mkdir_p("#{path}/lib")
-    FileUtils.cp("#{File.dirname(__FILE__)}/scenario.yml", path)
-    FileUtils.cp("#{File.dirname(__FILE__)}/ssh_options_default.yml", path)
-    FileUtils.cp("#{File.dirname(__FILE__)}/.rspec", path)
-    FileUtils.cp_r("#{File.dirname(__FILE__)}/spec", path)
-    FileUtils.cp_r("#{File.dirname(__FILE__)}/lib/extension", "#{path}/lib")
+    FileUtils.cp("#{ENV['TEMPLATE_PATH']}/scenario.yml", ENV['specroot'])
+    FileUtils.cp("#{ENV['TEMPLATE_PATH']}/ssh_options_default.yml", ENV['specroot'])
+    FileUtils.cp("#{ENV['TEMPLATE_PATH']}/.rspec", ENV['specroot'])
+    FileUtils.cp_r("#{ENV['TEMPLATE_PATH']}/spec/.", path)
+    FileUtils.cp_r("#{ENV['TEMPLATE_PATH']}/lib/extension", "#{ENV['specroot']}/lib")
 
     puts("Please edit \"#{abs_path}/scenario.yml\" and change directory to \"#{abs_path}\" and exec \"serverspec-runner\" command !!")
   end
Index: serverspec-runner/bin/serverspec-runner
===================================================================
--- serverspec-runner.orig/bin/serverspec-runner
+++ serverspec-runner/bin/serverspec-runner
@@ -58,7 +58,7 @@ opts.each do |opt, arg|
 end
 
 Rake::TaskManager.record_task_metadata = showtasks
-load "#{File.dirname(__FILE__)}/../Rakefile"
+load "/usr/share/serverspec-runner/Rakefile"
 
 if showtasks
   mLen = (Rake.application.tasks.max_by { |t| t.name_with_args.size }).name_with_args.size