Class: Buildr::Settings

Inherits:
Object show all
Defined in:
lib/buildr/core/application.rb

Overview

Provide settings that come from three sources.

User settings are placed in the .buildr/settings.yaml file located in the user’s home directory. They should only be used for settings that are specific to the user and applied the same way across all builds. Example for user settings are preferred repositories, path to local repository, user/name password for uploading to remote repository.

Build settings are placed in the build.yaml file located in the build directory. They help keep the buildfile and build.yaml file simple and readable, working to the advantages of each one. Example for build settings are gems, repositories and artifacts used by that build.

Profile settings are placed in the profiles.yaml file located in the build directory. They provide settings that differ in each environment the build runs in. For example, URLs and database connections will be different when used in development, test and production environments. The settings for the current environment are obtained by calling #profile.

Instance Method Summary collapse

Constructor Details

#initialize(application) ⇒ Settings

:nodoc:



70
71
72
# File 'lib/buildr/core/application.rb', line 70

def initialize(application) #:nodoc:
  @application = application
end

Instance Method Details

#buildObject

Build settings loaded from build.yaml file in build directory.



80
81
82
# File 'lib/buildr/core/application.rb', line 80

def build
  @build ||= load_from('build')
end

#profileObject

:call-seq:

profile => hash

Returns the profile for the current environment.



93
94
95
# File 'lib/buildr/core/application.rb', line 93

def profile
  profiles[@application.environment] ||= {}
end

#profilesObject

Profiles loaded from profiles.yaml file in build directory.



85
86
87
# File 'lib/buildr/core/application.rb', line 85

def profiles
  @profiles ||= load_from('profiles')
end

#userObject

User settings loaded from setting.yaml file in user’s home directory.



75
76
77
# File 'lib/buildr/core/application.rb', line 75

def user
  @user ||= load_from('settings', @application.home_dir)
end