Class: DeployMongo::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/deploy_mongo/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Config

Returns a new instance of Config.



5
6
7
# File 'lib/deploy_mongo/config.rb', line 5

def initialize(config)
    @config = config
end

Class Method Details

.create_from_file(config_file) ⇒ Object



9
10
11
12
13
# File 'lib/deploy_mongo/config.rb', line 9

def self.create_from_file(config_file)
    config = YAML.load_file(config_file)
    config = config.merge("config_folder_path" => File.dirname(config_file))
    Config.new(config)
end

Instance Method Details

#databaseObject



27
28
29
# File 'lib/deploy_mongo/config.rb', line 27

def database
  @config["database"]
end

#delta_pathObject



23
24
25
# File 'lib/deploy_mongo/config.rb', line 23

def delta_path
  @config["config_folder_path"] + "/" + @config["delta_path"]
end

#hostnameObject



15
16
17
# File 'lib/deploy_mongo/config.rb', line 15

def hostname
  @config["hostname"]
end

#merge_config(config) ⇒ Object



35
36
37
# File 'lib/deploy_mongo/config.rb', line 35

def merge_config(config)
  @config = @config.merge(config)
end

#mongo_shell_pathObject



31
32
33
# File 'lib/deploy_mongo/config.rb', line 31

def mongo_shell_path
  @config["mongo_shell_path"]
end

#portObject



19
20
21
# File 'lib/deploy_mongo/config.rb', line 19

def port
  @config["port"]
end