Module: Cylons

Defined in:
lib/cylons.rb,
lib/cylons/rpc.rb,
lib/cylons/agent.rb,
lib/cylons/config.rb,
lib/cylons/errors.rb,
lib/cylons/remote.rb,
lib/cylons/logging.rb,
lib/cylons/railtie.rb,
lib/cylons/service.rb,
lib/cylons/version.rb,
lib/cylons/interface.rb,
lib/cylons/attributes.rb,
lib/cylons/connection.rb,
lib/cylons/associations.rb,
lib/cylons/remote_schema.rb,
lib/cylons/local_registry.rb,
lib/cylons/remote_registry.rb,
lib/cylons/service_manager.rb,
lib/cylons/registry_adapter.rb,
lib/cylons/remote_discovery.rb,
lib/cylons/remote_pagination.rb,
lib/cylons/active_record_extensions.rb

Defined Under Namespace

Modules: ActiveRecordExtensions, Associations, Attributes, Logging, RPC, Remote, RemotePagination Classes: Agent, Config, Connection, CouldNotConnectToRegistry, CylonsConfigurationError, CylonsError, CylonsRecordNotFound, CylonsRemoteError, CylonsRemoteProxyError, CylonsRemoteServiceNotFound, HowDoYouKillThatWhichHasNoLife, Interface, InvalidRegistryAdapter, LocalRegistry, Railtie, RegistryAdapter, RemoteDiscovery, RemoteNamespaceNotSet, RemoteRegistry, RemoteSchema, Service, ServiceManager

Constant Summary collapse

VERSION =
"0.0.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject Also known as: config

Returns the value of attribute configuration.



61
62
63
# File 'lib/cylons.rb', line 61

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



67
68
69
70
71
72
73
# File 'lib/cylons.rb', line 67

def configure
  yield(configuration) if block_given?

  @logger = configuration.logger

  ::ActiveSupport.run_load_hooks(:cylons, self)
end

.connect?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/cylons.rb', line 32

def self.connect?
  !!ENV["RPC"]
end

.load_modelsObject



36
37
38
39
40
# File 'lib/cylons.rb', line 36

def self.load_models
  ::Dir.glob(model_paths).each{ |file|
      puts "loading #{file}"
     load file }
end

.loggerObject



76
77
78
# File 'lib/cylons.rb', line 76

def logger
  ::Cylons.config.logger
end

.model_pathsObject



42
43
44
45
46
47
48
49
50
# File 'lib/cylons.rb', line 42

def self.model_paths
  if configuration.model_paths
    return configuration.model_paths
  elsif defined?(::Rails)
    [::Rails.root.join('app', 'models', "*.rb"), ::Rails.root.join('app', 'models', "**", "*.rb")]
  else
    []
  end
end

.silence?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/cylons.rb', line 56

def self.silence?
  skip_cylons? || (defined?(Rails) && Rails.env == "test")
end

.skip_cylons?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/cylons.rb', line 52

def self.skip_cylons?
  !connect?
end