Class: Makitzo::Migrations::Migration
Instance Attribute Summary
Attributes inherited from SSH::Context
#connection, #connection_error, #host
Class Method Summary
collapse
Instance Method Summary
collapse
#exec, #exec!, #initialize, #logger, #quote, #sudo, #x
Methods included from Commands
#upload_migration_file
#killall
#require_ruby!, #ruby_version
#download, #download!, #download_with_curl, #download_with_wget
#scp_upload
#cd, #dir_exists?, #find_or_create_dir!, #mv, #require_dir!, #rm_rf!, #which?
#daily_shutdown, #install_app, #install_pkg, #mount_dmg, #reboot, #serial_number, #shutdown, #shutdown_at, #unmount_dmg, #use_network_time_server
Class Method Details
.directory ⇒ Object
7
|
# File 'lib/makitzo/migrations/migration.rb', line 7
def directory; @directory; end
|
.directory=(d) ⇒ Object
8
|
# File 'lib/makitzo/migrations/migration.rb', line 8
def directory=(d); @directory = d; end
|
.hosts(*hosts) ⇒ Object
Also known as:
host
16
17
18
19
20
|
# File 'lib/makitzo/migrations/migration.rb', line 16
def hosts(*hosts)
@hosts ||= []
@hosts.concat([hosts].flatten) unless hosts.empty?
@hosts
end
|
.protected_context_methods ⇒ Object
Returns an array of methods which are required by migrations. Used to prevent helpers from defining conflicting methods.
36
37
38
|
# File 'lib/makitzo/migrations/migration.rb', line 36
def protected_context_methods
%w(up down local_directory local_migration_file remote_directory remote_migration_file)
end
|
.query ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'lib/makitzo/migrations/migration.rb', line 22
def query
unless @query
@query = World::Query.new
roles.each { |r| @query.roles << r }
hosts.each { |h| @query.hosts << h }
end
@query
end
|
.roles(*roles) ⇒ Object
Also known as:
role
10
11
12
13
14
|
# File 'lib/makitzo/migrations/migration.rb', line 10
def roles(*roles)
@roles ||= []
@roles.concat([roles].flatten) unless roles.empty?
@roles
end
|
.timestamp ⇒ Object
4
|
# File 'lib/makitzo/migrations/migration.rb', line 4
def timestamp; @timestamp; end
|
.timestamp=(ts) ⇒ Object
5
|
# File 'lib/makitzo/migrations/migration.rb', line 5
def timestamp=(ts); @timestamp = ts; end
|
Instance Method Details
#down ⇒ Object
61
62
63
|
# File 'lib/makitzo/migrations/migration.rb', line 61
def down
raise UnsupportedMigrationError, "down direction is not defined!"
end
|
#local_directory ⇒ Object
41
42
43
|
# File 'lib/makitzo/migrations/migration.rb', line 41
def local_directory
self.class.directory
end
|
#local_migration_file(file) ⇒ Object
45
46
47
|
# File 'lib/makitzo/migrations/migration.rb', line 45
def local_migration_file(file)
File.join(local_directory, file)
end
|
#remote_directory ⇒ Object
49
50
51
|
# File 'lib/makitzo/migrations/migration.rb', line 49
def remote_directory
File.join(host.migration_history_dir, self.class.timestamp.to_s)
end
|
#remote_migration_file(file) ⇒ Object
53
54
55
|
# File 'lib/makitzo/migrations/migration.rb', line 53
def remote_migration_file(file)
File.join(remote_directory, file)
end
|
#to_i ⇒ Object
65
66
67
|
# File 'lib/makitzo/migrations/migration.rb', line 65
def to_i
self.class.timestamp
end
|
#up ⇒ Object
57
58
59
|
# File 'lib/makitzo/migrations/migration.rb', line 57
def up
raise UnsupportedMigrationError, "up direction is not defined!"
end
|