class CORL::Plugin::Configuration
Public Class Methods
register_ids()
click to toggle source
# File lib/core/plugin/configuration.rb 10 def self.register_ids 11 [ :name, :directory ] 12 end
Public Instance Methods
attach(type, name, data, options = {}) { |method_config| ... }
click to toggle source
# File lib/core/plugin/configuration.rb 229 def attach(type, name, data, options = {}) 230 method_config = Config.ensure(options) 231 new_location = nil 232 233 if can_persist? 234 if extension_check(:attach, { :config => method_config }) 235 logger.info("Attaching data to source configuration") 236 237 new_location = yield(method_config) if block_given? 238 end 239 else 240 logger.warn("Can not attach data to source configuration") 241 end 242 new_location 243 end
autoload(default = false)
click to toggle source
# File lib/core/plugin/configuration.rb 85 def autoload(default = false) 86 _get(:autoload, default) 87 end
autoload=(autoload)
click to toggle source
# File lib/core/plugin/configuration.rb 89 def autoload=autoload 90 _set(:autoload, test(autoload)) 91 end
autosave(default = false)
click to toggle source
# File lib/core/plugin/configuration.rb 95 def autosave(default = false) 96 _get(:autosave, default) 97 end
autosave=(autosave)
click to toggle source
# File lib/core/plugin/configuration.rb 99 def autosave=autosave 100 _set(:autosave, test(autosave)) 101 end
cache()
click to toggle source
# File lib/core/plugin/configuration.rb 73 def cache 74 project.cache 75 end
can_persist?()
click to toggle source
# File lib/core/plugin/configuration.rb 54 def can_persist? 55 project.can_persist? 56 end
clear(options = {})
click to toggle source
Calls superclass method
# File lib/core/plugin/configuration.rb 132 def clear(options = {}) 133 super 134 save(options) if initialized? && autosave 135 end
delete(keys, options = {})
click to toggle source
Calls superclass method
# File lib/core/plugin/configuration.rb 125 def delete(keys, options = {}) 126 super(keys) 127 save(options) if initialized? && autosave 128 end
delete_attachments(type, ids, options = {}) { |method_config| ... }
click to toggle source
# File lib/core/plugin/configuration.rb 247 def delete_attachments(type, ids, options = {}) 248 method_config = Config.ensure(options) 249 locations = [] 250 251 if can_persist? 252 if extension_check(:remove_attachments, { :config => method_config }) 253 logger.info("Removing attached data from source configuration") 254 255 locations = yield(method_config) if block_given? 256 end 257 else 258 logger.warn("Can not remove attached data from source configuration") 259 end 260 locations 261 end
directory()
click to toggle source
# File lib/core/plugin/configuration.rb 67 def directory 68 project.directory 69 end
ignore(files)
click to toggle source
# File lib/core/plugin/configuration.rb 79 def ignore(files) 80 project.ignore(files) 81 end
import(properties, options = {})
click to toggle source
Calls superclass method
# File lib/core/plugin/configuration.rb 152 def import(properties, options = {}) 153 super(properties, options) 154 save(options) if autosave 155 end
load(options = {}) { |method_config, properties| ... }
click to toggle source
# File lib/core/plugin/configuration.rb 160 def load(options = {}) 161 method_config = Config.ensure(options) 162 success = false 163 164 if can_persist? 165 if extension_check(:load, { :config => method_config }) 166 logger.info("Loading source configuration") 167 168 config.clear if method_config.get(:override, false) 169 170 properties = Config.new({}, {}, true, false) 171 success = yield(method_config, properties) if block_given? 172 173 if success && ! properties.export.empty? 174 logger.debug("Source configuration parsed properties: #{properties}") 175 176 extension(:load_process, { :properties => properties, :config => method_config }) 177 config.import(properties, method_config) 178 end 179 end 180 success = cache.load if success 181 else 182 logger.warn("Loading of source configuration failed") 183 end 184 success 185 end
normalize(reload) { || ... }
click to toggle source
Calls superclass method
# File lib/core/plugin/configuration.rb 17 def normalize(reload) 18 super 19 20 logger.debug("Initializing source sub configuration") 21 init_subconfig(true) unless reload 22 23 logger.info("Setting source configuration project") 24 25 @project = CORL.project(extended_config(:project, { 26 :directory => _delete(:directory, Dir.pwd), 27 :url => _delete(:url), 28 :revision => _delete(:revision), 29 :create => _delete(:create, false), 30 :pull => true, 31 :external_ip => _delete(:external_ip, nil), 32 :internal_ip => _delete(:internal_ip, CORL.public_ip), # Needed for seeding Vagrant VMs 33 :manage_ignore => _delete(:manage_ignore, true), 34 :new => true 35 }), _delete(:project_provider, nil)) unless reload 36 37 _init(:autoload, true) 38 _init(:autosave, false) 39 40 yield if block_given? 41 42 set_location(@project) 43 end
project()
click to toggle source
# File lib/core/plugin/configuration.rb 61 def project 62 @project 63 end
remote(name)
click to toggle source
# File lib/core/plugin/configuration.rb 139 def remote(name) 140 project.remote(name) 141 end
remove(options = {}) { |method_config| ... }
click to toggle source
# File lib/core/plugin/configuration.rb 209 def remove(options = {}) 210 method_config = Config.ensure(options) 211 success = false 212 213 if can_persist? 214 if extension_check(:delete, { :config => method_config }) 215 logger.info("Removing source configuration") 216 217 config.clear 218 219 success = yield(method_config) if block_given? 220 end 221 else 222 logger.warn("Can not remove source configuration") 223 end 224 success 225 end
remove_plugin()
click to toggle source
# File lib/core/plugin/configuration.rb 47 def remove_plugin 48 CORL.remove_plugin(@project) 49 end
save(options = {}) { |method_config| ... }
click to toggle source
# File lib/core/plugin/configuration.rb 189 def save(options = {}) 190 method_config = Config.ensure(options) 191 success = false 192 193 if can_persist? 194 if extension_check(:save, { :config => method_config }) 195 logger.info("Saving source configuration") 196 logger.debug("Source configuration properties: #{config.export}") 197 198 success = yield(method_config) if block_given? 199 end 200 success = cache.save if success 201 else 202 logger.warn("Can not save source configuration") 203 end 204 success 205 end
set(keys, value = '', options = {})
click to toggle source
Calls superclass method
# File lib/core/plugin/configuration.rb 118 def set(keys, value = '', options = {}) 119 super(keys, value, true) 120 save(options) if initialized? && autosave 121 end
set_location(directory)
click to toggle source
# File lib/core/plugin/configuration.rb 105 def set_location(directory) 106 if directory && directory.is_a?(CORL::Plugin::Project) 107 logger.debug("Setting source project directory from other project at #{directory.directory}") 108 project.set_location(directory.directory) 109 110 elsif directory && directory.is_a?(String) || directory.is_a?(Symbol) 111 logger.debug("Setting source project directory to #{directory}") 112 project.set_location(directory.to_s) 113 end 114 end
set_remote(name, location)
click to toggle source
# File lib/core/plugin/configuration.rb 145 def set_remote(name, location) 146 project.set_remote(name, location) 147 end