Class: Rucola::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rucola/initializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



218
219
220
221
222
223
224
# File 'lib/rucola/initializer.rb', line 218

def initialize
  set_root_path!
  set_application_support_path!
  
  self.objc_frameworks              = []
  self.load_paths                   = default_load_paths
end

Instance Attribute Details

#application_support_pathObject

The path to the applications support directory ~/Library/Application Support/AppName



209
210
211
# File 'lib/rucola/initializer.rb', line 209

def application_support_path
  @application_support_path
end

#load_pathsObject

An array of additional paths to prepend to the load path. By default, all models, config, controllers and db paths are included in this list.



216
217
218
# File 'lib/rucola/initializer.rb', line 216

def load_paths
  @load_paths
end

#objc_frameworksObject

List of Objective-C frameworks that should be required



212
213
214
# File 'lib/rucola/initializer.rb', line 212

def objc_frameworks
  @objc_frameworks
end

#root_pathObject (readonly)

The applications base directory



205
206
207
# File 'lib/rucola/initializer.rb', line 205

def root_path
  @root_path
end

Instance Method Details

#environmentObject

Returns the value of RUBYCOCOA_ENV



239
240
241
# File 'lib/rucola/initializer.rb', line 239

def environment
  ::RUBYCOCOA_ENV
end

#environment_pathObject

The path to the current environment’s file (development.rb, etc.). By default the file is at config/environments/#{environment}.rb.



245
246
247
# File 'lib/rucola/initializer.rb', line 245

def environment_path
  "#{root_path}/config/environments/#{environment}.rb"
end

#set_application_support_path!Object



230
231
232
233
234
235
236
# File 'lib/rucola/initializer.rb', line 230

def set_application_support_path!
  # TODO: we might want to set this to something in test mode.
  return if RUBYCOCOA_ENV == 'test'
  
  user_app_support_path = File.join(OSX::NSSearchPathForDirectoriesInDomains(OSX::NSLibraryDirectory, OSX::NSUserDomainMask, true)[0].to_s, "Application Support")
  @application_support_path = File.join(user_app_support_path, Rucola::RCApp.app_name)
end

#set_root_path!Object



226
227
228
# File 'lib/rucola/initializer.rb', line 226

def set_root_path!
  @root_path = Pathname.new(::RUBYCOCOA_ROOT).realpath.to_s
end