Sha256: de92c8d74bdebdc656757b19a98ad7fadaaa56ecb69a0cbecad8251d6d884799

Contents?: true

Size: 717 Bytes

Versions: 5

Compression:

Stored size: 717 Bytes

Contents

#
# Author:: Anicheev Serghei (<sanicheev@tacitknowledge.com>)
# Copyright:: Copyright (c) 2016 Tacit Knowledge.
#

module CookbookCreator
  class Helpers

    def self.load_config_file(default_options, modified_options)
      config_file = default_options.merge!(modified_options)[:config_file]
      File.exists?(config_file) ? config_file : raise_er
    end

    def raise_er
      raise 'Selected config file does not exists or does not have read permissions'
    end

    def self.merge_configs(default_config, config, sym_hash)
      combined_config = default_config.merge!(sym_hash)
      combined_config_options = combined_config.merge(config)
      config.replace(combined_config_options)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cookbook_creator-0.0.6 lib/cookbook_creator/helpers.rb
cookbook_creator-0.0.5 lib/cookbook_creator/helpers.rb
cookbook_creator-0.0.4 lib/cookbook_creator/helpers.rb
cookbook_creator-0.0.3 lib/cookbook_creator/helpers.rb
cookbook_creator-0.0.2 lib/cookbook_creator/helpers.rb