Sha256: b3b25c479a3bcdeb4d5cd0b2a961da77737b10c6f37a2da1c357e2962530e36c

Contents?: true

Size: 1.75 KB

Versions: 28

Compression:

Stored size: 1.75 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) && @config.has_key?(:class_prefix)
        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

28 entries across 28 versions & 1 rubygems

Version Path
fwtoolkit-2.2.4 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.2.3 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.2.2 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.2.1 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.2.0 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.10 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.9 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.8 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.7 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.6 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.5 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.4 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.3 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.1.1 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.0.7 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.0.6 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.0.5 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.0.4 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.0.3 lib/fwtoolkit/projectfile.rb
fwtoolkit-2.0.2 lib/fwtoolkit/projectfile.rb