Sha256: b81c4b51233f74b05e4fe4fefa465ffdc8fb5b84e2b17096482e72d4f885dd1d

Contents?: true

Size: 1.53 KB

Versions: 7

Compression:

Stored size: 1.53 KB

Contents

require 'yaml'
require 'bundler'

module IosToolchain
  class Config
    def project_root_path
      Bundler.root.to_s
    end

    def project_file_path
      absolute_path(config_yaml['project-file-path'])
    end

    def default_sdk
      config_yaml['default-sdk']
    end

    def default_scheme
      config_yaml['default-scheme']
    end

    def default_32bit_test_device
      config_yaml['default-32bit-test-device']
    end

    def default_64bit_test_device
      config_yaml['default-64bit-test-device']
    end

    def app_targets
      config_yaml['app-targets']
    end

    def test_targets
      config_yaml['test-targets'] || []
    end

    def ui_test_targets
      config_yaml['ui-test-targets'] || []
    end

    def provisioning_path
      absolute_path(config_yaml['provisioning-path'])
    end

    def crashlytics_framework_path
      absolute_path(config_yaml['crashlytics-framework-path'])
    end

    def crashlytics_installed?
      File.exists?(config_file_path) && !crashlytics_framework_path.nil?
    end

    def file_name
      '.ios_toolchain.yml'
    end

  private

    def absolute_path(path)
      (Pathname.new(project_root_path) + Pathname.new(path)).to_s unless path.nil?
    end

    def config_file_path
      File.join(project_root_path, file_name)
    end

    def config_yaml
      YAML.load_file(config_file_path) || {}
    rescue
      puts "\033[1;33m"
      puts "WARNING: no #{file_name} config file found."
      puts 'Run `rake toolchain:bootstrap`.'
      puts "\033[0m"
      exit
      {}
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ios_toolchain-0.3.3 lib/ios_toolchain/config.rb
ios_toolchain-0.3.2 lib/ios_toolchain/config.rb
ios_toolchain-0.3.1 lib/ios_toolchain/config.rb
ios_toolchain-0.3.0 lib/ios_toolchain/config.rb
ios_toolchain-0.2.6 lib/ios_toolchain/config.rb
ios_toolchain-0.2.4 lib/ios_toolchain/config.rb
ios_toolchain-0.2.3 lib/ios_toolchain/config.rb