class Xfabricator::FabricationConfig

Attributes

default_target[R]
project[R]
template_location[R]
variables[R]

Public Class Methods

create_config(config) click to toggle source
# File lib/xfabricator/fabrication_config.rb, line 43
def FabricationConfig.create_config(config)
  options = {}
  config.call(options)
  FabricationConfig.new options[:project_file], options[:template_location], options[:variables], options[:default_target]
end
load_config(config_file) click to toggle source
# File lib/xfabricator/fabrication_config.rb, line 12
def FabricationConfig.load_config(config_file)
  unless config_file
    raise ArgumentError, 'config file not specified'
  end

  unless config_file.exist?
    raise ArgumentError, "config file doesn't exist"
  end

  relative_path = config_file.parent.to_s
  config = eval(File.read(config_file.to_s), binding)

  unless config
    raise RuntimeError, "config was not loaded"
  end

  unless config.is_a? FabricationConfig
    raise RuntimeError, "Valid config not loaded"
  end

  return config
end
new(project_file, template_location, variables, default_target_name) click to toggle source
# File lib/xfabricator/fabrication_config.rb, line 35
def initialize(project_file, template_location, variables, default_target_name)
  project = Xcodeproj::Project.open(project_file)
  @project = project
  @variables = variables
  @template_location = template_location
  @default_target = project.targets.find { |target| target.name == default_target_name }
end