motion/cdq/config.rb in cdq-1.0.8 vs motion/cdq/config.rb in cdq-2.0.0
- old
+ new
@@ -1,8 +1,7 @@
module CDQ
-
# = Configure the CDQ Stack
#
# This class wraps the YAML configuration file that will allow you to
# override the names used when setting up the database file and finding the
# model file. This file is named <tt>cdq.yml</tt> and must be found at the
@@ -12,23 +11,21 @@
# [database_dir] The root name for the database directory (NSDocumentDirectory or NSApplicationSupportDirectory)
# [database_name] The root name for the database file (relative to the database_dir)
# [model_name] The root name for the model file (relative to the bundle directory)
# [app_group_id] The app group id set in iTunes member center (group.com.mycompany.myapp)
# [app_group_container_uuid] WORKAROUND: The app group's UUID for iOS Simulator 8.1 which doesn't return an app group container path from the id
- # [icloud] If it's true, CDQ works with iCloud.
- # [icloud_container] Set id of iCloud container if you use iCloud. If it's nil, use first container listed in the com.apple.developer.ubiquity-container-identifiers entitlement array.
#
# Using the config file is not necessary. If you do not include it, the bundle display name
# will be used. For most people with a new app, this is what you want to do, especially if
# you are using ruby-xcdm schemas. The only case where using the config file is required
# is when you want to use CDQManagedObject-based models with a custom model or database, because
# class loading order of operations makes it impossible to configure from within your
# AppDelegate.
#
class CDQConfig
- attr_reader :config_file, :database_name, :database_dir, :model_name, :name, :icloud, :icloud_container, :app_group_id, :app_group_container_uuid
+ attr_reader :config_file, :database_name, :database_dir, :model_name, :name, :app_group_id, :app_group_container_uuid
def initialize(config_file)
h = nil
case config_file
when String
@@ -48,18 +45,9 @@
@database_dir = search_directory_for h['database_dir'] || h[:database_dir]
@database_name = h['database_name'] || h[:database_name] || name
@model_name = h['model_name'] || h[:model_name] || name
@app_group_id = h['app_group_id'] || h[:app_group_id]
@app_group_container_uuid = h['app_group_container_uuid'] || h[:app_group_container_uuid]
- @icloud = begin
- case h['icloud'] || h[:icloud]
- when true, 1
- true
- else
- false
- end
- end
- @icloud_container = h['icloud_container'] || h[:icloud_container]
end
def database_url
if app_group_id.nil?
dir = NSSearchPathForDirectoriesInDomains(database_dir, NSUserDomainMask, true).last