forked from ottobehrens/gemstone-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
example_glass_rakefile.rb
55 lines (45 loc) · 1.23 KB
/
example_glass_rakefile.rb
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
# Execute with:
# rake -f example_glass_rakefile.rb -T
require 'glass_stone'
# This is an example Rakefile for a GLASS installation.
# For your own installation, extend Stone/GlassStone and override to
# change the behaviour for your situation.
#
# Your initialize_new_stone will most probably differ, for example.
#
# Set to true to see what commands gets executed
verbose(false)
task :default do
puts "Example tasks for managing a GemStone installation"
end
desc "Create a new stone"
task :new_stone, :stone_name do |t, args|
puts "Creating #{args.stone_name}"
GlassStone.create(args.stone_name)
end
desc "Server status"
task :status do
GemStoneInstallation.current.status
end
desc "Stop netldi"
task :stopnetldi do
GemStoneInstallation.current.stopnetldi
end
desc "Start netldi"
task :startnetldi do
GemStoneInstallation.current.startnetldi
end
def task_gemstone(stone, action)
desc "#{action.to_s} - #{stone.name}"
task action do
stone.send(action)
end
end
GemStoneInstallation.current.stones.each do |stoneName|
namespace stoneName do
stone = GlassStone.new(stoneName)
[:stop, :start, :restart, :status, :backup, :restore_latest_backup].each do |action|
task_gemstone(stone, action)
end
end
end