lib/ios_toolchain/config.rb in ios_toolchain-0.2.2 vs lib/ios_toolchain/config.rb in ios_toolchain-0.2.3
- old
+ new
@@ -1,12 +1,16 @@
require 'yaml'
require 'bundler'
module IosToolchain
class Config
+ def project_root_path
+ Bundler.root.to_s
+ end
+
def project_file_path
- config_yaml['project-file-path']
+ absolute_path(config_yaml['project-file-path'])
end
def default_sdk
config_yaml['default-sdk']
end
@@ -34,15 +38,15 @@
def ui_test_targets
config_yaml['ui-test-targets'] || []
end
def provisioning_path
- config_yaml['provisioning-path']
+ absolute_path(config_yaml['provisioning-path'])
end
def crashlytics_framework_path
- config_yaml['crashlytics-framework-path']
+ absolute_path(config_yaml['crashlytics-framework-path'])
end
def crashlytics_installed?
File.exists?(config_file_path) && !crashlytics_framework_path.nil?
end
@@ -51,11 +55,15 @@
'.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(Bundler.root, file_name)
+ File.join(project_root_path, file_name)
end
def config_yaml
YAML.load_file(config_file_path) || {}
rescue