module ChefFixie

Copyright © 2015 Chef Software Inc.

License

Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Author: Mark Anderson <mark@chef.io>

Much of this code was orginally derived from the orgmapper tool, which had many varied authors.

Constants

VERSION

Public Class Methods

configure() { |instance| ... } click to toggle source
# File lib/chef_fixie_shahid/config.rb, line 27
def self.configure
  yield Config.instance
end
load_config(config_file = nil) click to toggle source
# File lib/chef_fixie_shahid/config.rb, line 31
def self.load_config(config_file = nil)
  if config_file
    puts "loading config: #{config_file}..." if ChefFixie::Console.started_from_command_line?
    Kernel.load(config_file)
  else
    path = "/etc/opscode"
    puts "loading config from #{path}" if ChefFixie::Console.started_from_command_line?
    ChefFixie::Config.instance.load_from_pc(path)
  end
end
setup() click to toggle source
# File lib/chef_fixie_shahid/config.rb, line 42
def self.setup
  # TODO: do we have to polute global object with this to make it available to the irb instance?
  Object.const_set(:ORGS, ChefFixie::Sql::Orgs.new)
  Object.const_set(:USERS, ChefFixie::Sql::Users.new)
  Object.const_set(:ASSOCS, ChefFixie::Sql::Associations.new)
  Object.const_set(:INVITES, ChefFixie::Sql::Invites.new)

  # scope this by the global org id?
  Object.const_set(:GLOBAL_GROUPS, ChefFixie::Sql::Groups.new.by_org_id(ChefFixie::Sql::Orgs::GlobalOrg))
  Object.const_set(:GLOBAL_CONTAINERS, ChefFixie::Sql::Containers.new.by_org_id(ChefFixie::Sql::Orgs::GlobalOrg))
end