Class: Architect4r::InstanceManager
- Inherits:
-
Object
- Object
- Architect4r::InstanceManager
- Defined in:
- lib/architect4r/instance_manager.rb
Instance Method Summary collapse
-
#initialize(path) ⇒ InstanceManager
constructor
A new instance of InstanceManager.
- #reset ⇒ Object
- #reset_to_sample_data(from) ⇒ Object
- #restart ⇒ Object
- #server_path ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(path) ⇒ InstanceManager
Returns a new instance of InstanceManager.
4 5 6 |
# File 'lib/architect4r/instance_manager.rb', line 4 def initialize(path) @path = path end |
Instance Method Details
#reset ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/architect4r/instance_manager.rb', line 24 def reset self.stop # Reset the database FileUtils.rm_rf("#{server_path}/data/graph.db") FileUtils.mkdir("#{server_path}/data/graph.db") # Remove log files FileUtils.rm_rf("#{server_path}/data/log") FileUtils.mkdir("#{server_path}/data/log") # Start the server self.start end |
#reset_to_sample_data(from) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/architect4r/instance_manager.rb', line 39 def reset_to_sample_data(from) self.stop FileUtils.rm_rf("#{server_path}/data/graph.db") FileUtils.cp_r(from, "#{server_path}/data/graph.db/") self.start end |
#restart ⇒ Object
20 21 22 |
# File 'lib/architect4r/instance_manager.rb', line 20 def restart %x[#{server_path}/bin/neo4j restart] end |
#server_path ⇒ Object
8 9 10 |
# File 'lib/architect4r/instance_manager.rb', line 8 def server_path @path end |
#start ⇒ Object
12 13 14 |
# File 'lib/architect4r/instance_manager.rb', line 12 def start %x[#{server_path}/bin/neo4j start] end |
#stop ⇒ Object
16 17 18 |
# File 'lib/architect4r/instance_manager.rb', line 16 def stop %x[#{server_path}/bin/neo4j stop] end |