Class: BuildTool::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/build-tool/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recipe = nil) ⇒ Configuration

Returns a new instance of Configuration.



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/build-tool/configuration.rb', line 83

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_featureObject

Returns the value of attribute active_feature.



24
25
26
# File 'lib/build-tool/configuration.rb', line 24

def active_feature
  @active_feature
end

#environmentsObject (readonly)

Returns the value of attribute environments.



22
23
24
# File 'lib/build-tool/configuration.rb', line 22

def environments
  @environments
end

#featuresObject (readonly)

Returns the value of attribute features.



23
24
25
# File 'lib/build-tool/configuration.rb', line 23

def features
  @features
end

#modulesObject (readonly)

Returns the value of attribute modules.



21
22
23
# File 'lib/build-tool/configuration.rb', line 21

def modules
  @modules
end

#recipeObject (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



146
147
148
# File 'lib/build-tool/configuration.rb', line 146

def add_build_system( bs )
    return @build_system[bs.name] = bs
end

#add_environment(env) ⇒ Object



38
39
40
# File 'lib/build-tool/configuration.rb', line 38

def add_environment( env)
    @environments[env.name] = env
end

#add_feature(feature) ⇒ Object



46
47
48
# File 'lib/build-tool/configuration.rb', line 46

def add_feature( feature )
    @features[feature.path] = feature
end

#add_module(mod) ⇒ Object



54
55
56
57
# File 'lib/build-tool/configuration.rb', line 54

def add_module( mod )
    @module[mod.name] = mod
    @modules << mod
end

#add_repository(repo) ⇒ Object



63
64
65
# File 'lib/build-tool/configuration.rb', line 63

def add_repository( repo )
    @repository[repo.name] = repo
end

#add_server(server) ⇒ Object



71
72
73
# File 'lib/build-tool/configuration.rb', line 71

def add_server( server )
    @server[ server.name ] = server
end

#add_sshkey(key) ⇒ Object



79
80
81
# File 'lib/build-tool/configuration.rb', line 79

def add_sshkey( key )
    @sshkey[key.name] = key
end

#build_system_adjust(name, parent = nil, *args) ⇒ Object



135
136
137
138
139
# File 'lib/build-tool/configuration.rb', line 135

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



141
142
143
144
# File 'lib/build-tool/configuration.rb', line 141

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



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/build-tool/configuration.rb', line 114

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



34
35
36
# File 'lib/build-tool/configuration.rb', line 34

def environment( name )
    @environments[name]
end

#feature(name) ⇒ Object



42
43
44
# File 'lib/build-tool/configuration.rb', line 42

def feature( name )
    @features[name]
end

#log_directoryObject



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
# File 'lib/build-tool/configuration.rb', line 30

def log_directory=( path )
    @log_directory = Pathname.new( File.expand_path( path, "~" ) )
end

#module(name) ⇒ Object



50
51
52
# File 'lib/build-tool/configuration.rb', line 50

def module( name )
    @module[name]
end

#repository(name) ⇒ Object



59
60
61
# File 'lib/build-tool/configuration.rb', line 59

def repository( name )
    @repository[name]
end

#server(name) ⇒ Object



67
68
69
# File 'lib/build-tool/configuration.rb', line 67

def server( name )
    @server[name]
end

#sshkey(name) ⇒ Object



75
76
77
# File 'lib/build-tool/configuration.rb', line 75

def sshkey( name )
    @sshkey[name]
end

#vcs(name) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/build-tool/configuration.rb', line 97

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