Module: Filemaker

Defined in:
lib/filemaker.rb,
lib/filemaker/api.rb,
lib/filemaker/error.rb,
lib/filemaker/model.rb,
lib/filemaker/layout.rb,
lib/filemaker/record.rb,
lib/filemaker/script.rb,
lib/filemaker/server.rb,
lib/filemaker/version.rb,
lib/filemaker/database.rb,
lib/filemaker/resultset.rb,
lib/filemaker/model/field.rb,
lib/filemaker/model/fields.rb,
lib/filemaker/configuration.rb,
lib/filemaker/core_ext/hash.rb,
lib/filemaker/model/builder.rb,
lib/filemaker/metadata/field.rb,
lib/filemaker/model/criteria.rb,
lib/filemaker/model/findable.rb,
lib/filemaker/model/optional.rb,
lib/filemaker/model/relations.rb,
lib/filemaker/model/components.rb,
lib/filemaker/model/pagination.rb,
lib/filemaker/model/selectable.rb,
lib/filemaker/model/persistable.rb,
lib/filemaker/store/layout_store.rb,
lib/filemaker/store/script_store.rb,
lib/filemaker/store/database_store.rb,
lib/filemaker/model/relations/proxy.rb,
lib/filemaker/api/query_commands/dup.rb,
lib/filemaker/api/query_commands/new.rb,
lib/filemaker/api/query_commands/edit.rb,
lib/filemaker/api/query_commands/find.rb,
lib/filemaker/api/query_commands/view.rb,
lib/filemaker/model/relations/has_many.rb,
lib/filemaker/api/query_commands/delete.rb,
lib/filemaker/api/query_commands/findall.rb,
lib/filemaker/api/query_commands/findany.rb,
lib/filemaker/model/relations/belongs_to.rb,
lib/filemaker/model/relations/has_portal.rb,
lib/filemaker/api/query_commands/findquery.rb

Defined Under Namespace

Modules: Api, Error, Metadata, Model, Store Classes: Configuration, Database, HashWithIndifferentAndCaseInsensitiveAccess, Layout, Record, Resultset, Script, Server

Constant Summary collapse

VERSION =
'0.0.7'

Class Method Summary collapse

Class Method Details

.load!(path, environment = nil) ⇒ Object

Based on the environment, register the server so we only ever have one instance of Filemaker::Server per named session. The named session will be defined at the filemaker.yml config file.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/filemaker.rb', line 30

def load!(path, environment = nil)
  sessions = YAML.load(ERB.new(File.new(path).read).result)[environment.to_s]
  fail Error::ConfigurationError, 'Environment wrong?' if sessions.nil?

  sessions.each_pair do |key, value|
    registry[key] = Filemaker::Server.new do |config|
      config.host = value.fetch('host') do
        fail Error::ConfigurationError, 'Missing config.host'
      end

      config. = value.fetch('account_name') do
        fail Error::ConfigurationError, 'Missing config.account_name'
      end

      config.password = value.fetch('password') do
        fail Error::ConfigurationError, 'Missing config.password'
      end

      config.ssl = value['ssl'] if value['ssl']
      config.log = value['log'] if value['log']
      config.endpoint = value['endpoint'] if value['endpoint']
    end
  end
end

.registryObject



55
56
57
# File 'lib/filemaker.rb', line 55

def registry
  @registry ||= {}
end