-
-
Save daniellockard/5011108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require './lib/harddisk' | |
module ReImagEngine | |
class DiskImager | |
attr_reader :harddisks | |
attr_accessor :server_address, | |
:server_shared_type, | |
:server_share_name | |
# config shit here or even extract a config class | |
def initialize | |
# Initialize Configuration | |
# Initialize System Harddisks | |
# expect { expression }.to raise_error(ArgumentError) | |
`parted -lm`.split("\n").grep(/sd[a-z]/).map { |d| d.split(":").first }.each do |hdd| | |
harddisks.push HardDisk.new(hdd) | |
end | |
end | |
def harddisks | |
@harddisks || Array.new | |
end | |
private | |
def load_configuration | |
config = YAML.load_file('./config.yaml') | |
config["server"].each{|attr| | |
create_attr(attr) | |
} | |
end | |
def create_method(name,&block) | |
self.class.send(:define_method, name, &block) | |
end | |
def create_attr(name) | |
create_method("#{name}=".to_sym) { |val| | |
instance_variable_set("@"+name, val) | |
} | |
create_method( name.to_sym ) { | |
instance_variable_get("@" + name) | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment