Sha256: 734c1824fae6a97712ca8575048646fe3d74f7a6b4ee6566b2a908a02c3c4e80

Contents?: true

Size: 1.71 KB

Versions: 3

Compression:

Stored size: 1.71 KB

Contents

require 'yaml'
require 'fwtoolkit/configfile'

module FWToolkit
  module Projectfile
    extend self #singleton 
   
    extend FWToolkit::ConfigFile
 
    def load!(project_root)
      load_config! projectfile_for_root(project_root)
      merge_config defaults_with_config(@config)
    end

    def load_with_config!(config)
      load_config_hash! config
      merge_config defaults_with_config(config)
    end

    def validate_config
      unless @config.has_key?(:project_name)
        raise NameError, "The project name has to be specified on the configuration file"
      end
    end


    private

    def projectfile_for_root(project_root)
      File.join project_root, 'FWProjectFile'
    end

    def defaults_with_config(conf_hash)
      d = Hash.new
      d[:target_name] = conf_hash[:target_name] || conf_hash[:project_name]
      d[:binary_name] = "#{conf_hash[:project_name]}"
      d[:tests_target_name] = conf_hash[:tests_target_name] || "#{conf_hash[:project_name]}Tests"
      d[:xcode_workspace] = "#{conf_hash[:project_name]}.xcworkspace" 
      d[:xcode_scheme] = { :dev => conf_hash[:project_name], 
                           :testing => "#{conf_hash[:project_name]}-Testing",
                           :release => "#{conf_hash[:project_name]}-Release" }
      d[:xcode_project] = "#{File.join(conf_hash[:project_name], conf_hash[:project_name])}.xcodeproj" 
      d[:source_root] = File.join conf_hash[:project_name], d[:target_name]  
      d[:tests_source_root] = File.join conf_hash[:project_name], d[:tests_target_name] 
      d[:frank_root] = File.join conf_hash[:project_name], d[:target_name], 'Frank' 
      d[:frankified_app] = File.join d[:frank_root], 'frankified_build', 'Frankified.app'
      d
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fwtoolkit-2.3.2 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.3.1 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.3.0 lib/fwtoolkit/projectfile.rb