Class: BuildTool::Configuration
- Inherits:
-
Object
- Object
- BuildTool::Configuration
- Defined in:
- lib/build-tool/configuration.rb
Instance Attribute Summary collapse
-
#active_feature ⇒ Object
Returns the value of attribute active_feature.
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#features ⇒ Object
readonly
Returns the value of attribute features.
-
#modules ⇒ Object
readonly
Returns the value of attribute modules.
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
Instance Method Summary collapse
- #add_build_system(bs) ⇒ Object
- #add_environment(env) ⇒ Object
- #add_feature(feature) ⇒ Object
- #add_module(mod) ⇒ Object
- #add_repository(repo) ⇒ Object
- #add_server(server) ⇒ Object
- #add_sshkey(key) ⇒ Object
- #build_system_adjust(name, parent = nil, *args) ⇒ Object
- #build_system_defaults(name, *args) ⇒ Object
- #create_build_system(name, parent = nil, *args) ⇒ Object
- #environment(name) ⇒ Object
- #feature(name) ⇒ Object
-
#initialize(recipe = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #log_directory ⇒ Object
- #log_directory=(path) ⇒ Object
- #module(name) ⇒ Object
- #repository(name) ⇒ Object
- #server(name) ⇒ Object
- #sshkey(name) ⇒ Object
- #vcs(name) ⇒ Object
Constructor Details
#initialize(recipe = nil) ⇒ Configuration
Returns a new instance of Configuration.
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/build-tool/configuration.rb', line 87 def initialize( recipe = nil ) @recipe = recipe @server = {} @log_directory = nil @environments = {} @module = {} @modules = [] @build_system = {} @repository = {} @sshkey = {} @active_feature = nil @features = {} end |
Instance Attribute Details
#active_feature ⇒ Object
Returns the value of attribute active_feature.
24 25 26 |
# File 'lib/build-tool/configuration.rb', line 24 def active_feature @active_feature end |
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
22 23 24 |
# File 'lib/build-tool/configuration.rb', line 22 def environments @environments end |
#features ⇒ Object (readonly)
Returns the value of attribute features.
23 24 25 |
# File 'lib/build-tool/configuration.rb', line 23 def features @features end |
#modules ⇒ Object (readonly)
Returns the value of attribute modules.
21 22 23 |
# File 'lib/build-tool/configuration.rb', line 21 def modules @modules end |
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe.
20 21 22 |
# File 'lib/build-tool/configuration.rb', line 20 def recipe @recipe end |
Instance Method Details
#add_build_system(bs) ⇒ Object
150 151 152 |
# File 'lib/build-tool/configuration.rb', line 150 def add_build_system( bs ) return @build_system[bs.name] = bs end |
#add_environment(env) ⇒ Object
42 43 44 |
# File 'lib/build-tool/configuration.rb', line 42 def add_environment( env) @environments[env.name] = env end |
#add_feature(feature) ⇒ Object
50 51 52 |
# File 'lib/build-tool/configuration.rb', line 50 def add_feature( feature ) @features[feature.path] = feature end |
#add_module(mod) ⇒ Object
58 59 60 61 |
# File 'lib/build-tool/configuration.rb', line 58 def add_module( mod ) @module[mod.name] = mod @modules << mod end |
#add_repository(repo) ⇒ Object
67 68 69 |
# File 'lib/build-tool/configuration.rb', line 67 def add_repository( repo ) @repository[repo.name] = repo end |
#add_server(server) ⇒ Object
75 76 77 |
# File 'lib/build-tool/configuration.rb', line 75 def add_server( server ) @server[ server.name ] = server end |
#add_sshkey(key) ⇒ Object
83 84 85 |
# File 'lib/build-tool/configuration.rb', line 83 def add_sshkey( key ) @sshkey[key.name] = key end |
#build_system_adjust(name, parent = nil, *args) ⇒ Object
139 140 141 142 143 |
# File 'lib/build-tool/configuration.rb', line 139 def build_system_adjust( name, parent = nil, *args ) bs = create_build_system( name, parent ) bs.defaults = build_system_defaults( name ) return bs end |
#build_system_defaults(name, *args) ⇒ Object
145 146 147 148 |
# File 'lib/build-tool/configuration.rb', line 145 def build_system_defaults( name, *args ) return @build_system[name] if @build_system[name] add_build_system( create_build_system( name ) ) end |
#create_build_system(name, parent = nil, *args) ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/build-tool/configuration.rb', line 118 def create_build_system( name, parent = nil, *args ) return case name when "none" BuildTool::BuildSystem::None.new( parent, *args ) when "cmake" BuildTool::BuildSystem::CMake.new( parent, *args ) when "kdel10n" BuildTool::BuildSystem::KdeL10n.new( parent, *args ) when "qt" BuildTool::BuildSystem::Qt.new( parent, *args ) when "qmake" BuildTool::BuildSystem::QMake.new( parent, *args ) when "custom" BuildTool::BuildSystem::Custom.new( parent, *args ) when "autoconf" BuildTool::BuildSystem::AutoConf.new( parent, *args ) else raise StandardError, "Unknown Version Control System #{name}" end end |
#environment(name) ⇒ Object
38 39 40 |
# File 'lib/build-tool/configuration.rb', line 38 def environment( name ) @environments[name] end |
#feature(name) ⇒ Object
46 47 48 |
# File 'lib/build-tool/configuration.rb', line 46 def feature( name ) @features[name] end |
#log_directory ⇒ Object
26 27 28 29 |
# File 'lib/build-tool/configuration.rb', line 26 def log_directory return @log_directory if @log_directory raise BuildTool::ConfigurationError, "No log directory configured" end |
#log_directory=(path) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/build-tool/configuration.rb', line 30 def log_directory=( path ) path = Pathname.new( path.sub( /\$HOME/, '~' ) ) if path.to_s[0] != '~' and path.relative? raise ConfigurationError, "Log directory '#{path}' is relative!" end @log_directory = path. end |
#module(name) ⇒ Object
54 55 56 |
# File 'lib/build-tool/configuration.rb', line 54 def module( name ) @module[name] end |
#repository(name) ⇒ Object
63 64 65 |
# File 'lib/build-tool/configuration.rb', line 63 def repository( name ) @repository[name] end |
#server(name) ⇒ Object
71 72 73 |
# File 'lib/build-tool/configuration.rb', line 71 def server( name ) @server[name] end |
#sshkey(name) ⇒ Object
79 80 81 |
# File 'lib/build-tool/configuration.rb', line 79 def sshkey( name ) @sshkey[name] end |
#vcs(name) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/build-tool/configuration.rb', line 101 def vcs( name ) case name when "git-svn" return BuildTool::VCS::GitSvnConfiguration.new when "git" return BuildTool::VCS::GitConfiguration.new when "svn" return BuildTool::VCS::SvnConfiguration.new when "archive" return BuildTool::VCS::ArchiveConfiguration.new when "mercurial" return BuildTool::VCS::MercurialConfiguration.new else raise StandardError, "Unknown Version Control System #{name}" end end |