biosphere 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/biosphere +14 -3
- data/lib/biosphere/node.rb +50 -1
- data/lib/biosphere/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07a529aa22b0274989393f6105d8ca6e3fda645b
|
4
|
+
data.tar.gz: 055f4a5f72c074c03e338d5cd28b3aaf4c2af184
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77f8b8cfaf284f335622fce5f853604cbdd4eccb5e758cb1da3bf98556cc000fea73125ff3bfce4f54d65bbfdbb50cb94d739934f5be61e3ee2654f8d4935da1
|
7
|
+
data.tar.gz: 42aea2700cc84a49ac80127ee9762f2c05c74d10883041c81ec3db70902b35e72607d857dc304289f323329bd7d91000c082e01f9f2a919b781d19f225b53f1b
|
data/bin/biosphere
CHANGED
@@ -64,11 +64,21 @@ end
|
|
64
64
|
|
65
65
|
if options.src
|
66
66
|
suite = Biosphere::Suite.new(options.src)
|
67
|
+
if options.src == "./"
|
68
|
+
STDERR.puts "Loading suite from current directory (#{File.expand_path(options.src)}). Use --src to change the path"
|
69
|
+
end
|
70
|
+
|
67
71
|
suite.load_all()
|
68
|
-
else
|
69
|
-
STDERR.puts "No --src set"
|
70
72
|
end
|
71
73
|
|
74
|
+
if options.build
|
75
|
+
if !File.directory?(options.build)
|
76
|
+
STDERR.puts "Creating build directory #{options.build} because it was missing"
|
77
|
+
Dir.mkdir(options.build)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
72
82
|
if ARGV[0] == "json" && options.src
|
73
83
|
suite.evaluate_resources()
|
74
84
|
|
@@ -90,7 +100,7 @@ end
|
|
90
100
|
|
91
101
|
if ARGV[0] == "plan" && options.src
|
92
102
|
suite.evaluate_plans()
|
93
|
-
ap suite.node
|
103
|
+
ap suite.node, :indent=>-4
|
94
104
|
end
|
95
105
|
|
96
106
|
if ARGV[0] == "action" && options.src
|
@@ -98,6 +108,7 @@ if ARGV[0] == "action" && options.src
|
|
98
108
|
|
99
109
|
context.build_directory = options.build
|
100
110
|
|
111
|
+
STDERR.puts "Executing action #{ARGV[1]}"
|
101
112
|
suite.call_action(ARGV[1], context)
|
102
113
|
|
103
114
|
suite.save_node()
|
data/lib/biosphere/node.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pp'
|
2
|
+
require 'awesome_print'
|
2
3
|
|
3
4
|
class Biosphere
|
4
5
|
class Node
|
@@ -31,4 +32,52 @@ class Biosphere
|
|
31
32
|
return Marshal.dump(self)
|
32
33
|
end
|
33
34
|
end
|
34
|
-
end
|
35
|
+
end
|
36
|
+
|
37
|
+
module AwesomePrint
|
38
|
+
module Node
|
39
|
+
def self.included(base)
|
40
|
+
base.send :alias_method, :cast_without_node, :cast
|
41
|
+
base.send :alias_method, :cast, :cast_with_node
|
42
|
+
end
|
43
|
+
|
44
|
+
def cast_with_node(object, type)
|
45
|
+
cast = cast_without_node(object, type)
|
46
|
+
if (defined?(::Biosphere::Node)) && (object.is_a?(::Biosphere::Node))
|
47
|
+
cast = :node_instance
|
48
|
+
end
|
49
|
+
cast
|
50
|
+
end
|
51
|
+
|
52
|
+
def awesome_node_instance(object)
|
53
|
+
"#{object.class} #{awesome_hash(object.data)}"
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module AwesomePrint
|
60
|
+
module IPAddress
|
61
|
+
def self.included(base)
|
62
|
+
base.send :alias_method, :cast_without_ipaddress, :cast
|
63
|
+
base.send :alias_method, :cast, :cast_with_ipaddress
|
64
|
+
end
|
65
|
+
|
66
|
+
def cast_with_ipaddress(object, type)
|
67
|
+
cast = cast_without_ipaddress(object, type)
|
68
|
+
if (defined?(::IPAddress)) && (object.is_a?(::IPAddress))
|
69
|
+
cast = :ipaddress_instance
|
70
|
+
end
|
71
|
+
cast
|
72
|
+
end
|
73
|
+
|
74
|
+
def awesome_ipaddress_instance(object)
|
75
|
+
"#{object.class}(#{object.to_string})"
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
AwesomePrint::Formatter.send(:include, AwesomePrint::Node)
|
82
|
+
AwesomePrint::Formatter.send(:include, AwesomePrint::IPAddress)
|
83
|
+
|
data/lib/biosphere/version.rb
CHANGED