SimControl 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/SimControl/cli.rb +8 -8
- data/lib/SimControl/version.rb +1 -1
- data/spec/cli/simulate_spec.rb +6 -2
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/SimControl/cli.rb
CHANGED
@@ -47,15 +47,15 @@ module SimControl
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def results_directory(scenario)
|
50
|
-
File.join("results", scenario)
|
50
|
+
File.join(Dir.pwd, "results", scenario)
|
51
51
|
end
|
52
52
|
|
53
53
|
def control_file_name
|
54
|
-
File.join(
|
54
|
+
File.join("Controlfile")
|
55
55
|
end
|
56
56
|
|
57
57
|
def scenario_file_name(scenario)
|
58
|
-
File.join(
|
58
|
+
File.join("scenarios", "#{ scenario }.rb")
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.scenario_files_exist?(scenario)
|
@@ -64,17 +64,17 @@ module SimControl
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def self.results_path(scenario_name)
|
67
|
-
results_path = File.join("results", scenario_name)
|
67
|
+
results_path = File.join(Dir.pwd, "results", scenario_name)
|
68
68
|
end
|
69
69
|
|
70
70
|
def self.scenario_path(scenario_name)
|
71
|
-
scenario_path = File.join("scenarios", "#{scenario_name}.rb")
|
71
|
+
scenario_path = File.join(Dir.pwd, "scenarios", "#{scenario_name}.rb")
|
72
72
|
end
|
73
73
|
|
74
74
|
def self.init_generated_files_exist?
|
75
|
-
raise Thor::Error.new "scenarios missing, run init" unless File.directory?("scenarios")
|
76
|
-
raise Thor::Error.new "results missing, run init" unless File.directory?("results")
|
77
|
-
raise Thor::Error.new "Controlfile missing, run init" unless File.exists?("Controlfile")
|
75
|
+
raise Thor::Error.new "scenarios missing, run init" unless File.directory?(File.join Dir.pwd, "scenarios")
|
76
|
+
raise Thor::Error.new "results missing, run init" unless File.directory?(File.join Dir.pwd, "results")
|
77
|
+
raise Thor::Error.new "Controlfile missing, run init" unless File.exists?(File.join Dir.pwd, "Controlfile")
|
78
78
|
end
|
79
79
|
|
80
80
|
def self.source_root
|
data/lib/SimControl/version.rb
CHANGED
data/spec/cli/simulate_spec.rb
CHANGED
@@ -6,8 +6,11 @@ require "fakefs/spec_helpers"
|
|
6
6
|
describe SimControl::CLI do
|
7
7
|
include FakeFS::SpecHelpers
|
8
8
|
describe "simulate" do
|
9
|
+
let(:root) { "/an/absolute/path" }
|
9
10
|
before(:each) do
|
10
11
|
scenario = "hosts {}"
|
12
|
+
FileUtils.mkdir_p(root)
|
13
|
+
Dir.chdir(root)
|
11
14
|
FileUtils.mkdir("scenarios")
|
12
15
|
FileUtils.mkdir("results")
|
13
16
|
FileUtils.touch("Controlfile")
|
@@ -18,7 +21,8 @@ describe SimControl::CLI do
|
|
18
21
|
it "calls SimControl::Controller.execute()" do
|
19
22
|
scenario_description = "scenario"
|
20
23
|
simulation_description = "simulation"
|
21
|
-
|
24
|
+
Dir.stub(pwd: root)
|
25
|
+
results_path = File.join(root, "results", "myScenario")
|
22
26
|
hostname = "a-hostname"
|
23
27
|
File.open("scenarios/myScenario.rb", "w") { |f| f.write(scenario_description) }
|
24
28
|
File.open("Controlfile", "w") { |f| f.write(simulation_description) }
|
@@ -28,7 +32,7 @@ describe SimControl::CLI do
|
|
28
32
|
end
|
29
33
|
|
30
34
|
it "fails if no results directory exists" do
|
31
|
-
FileUtils.rm_rf("results")
|
35
|
+
FileUtils.rm_rf("/an/absolute/path/results")
|
32
36
|
expect do
|
33
37
|
SimControl::CLI.new.invoke :simulate, ["myScenario"]
|
34
38
|
end.to raise_error(Thor::Error, /results missing/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SimControl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|