Module: Cupper::Config
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.all_sensibles ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cupper/config/config.rb', line 49 def self.all_sensibles sensibles = Array.new unless sensible_files env = Cupper::ENVIRONMENT File.open("#{env.root_path}/.sensibles").each do |line| sensibles.push line.chomp unless line.strip.chomp.match /^#.*/ or line.chomp.empty? end end sensibles end |
.configure ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cupper/config/config.rb', line 24 def self.configure self.config do parameter :native_configured parameter :sensible_files parameter :allow_downgrade parameter :sourceless_packages parameter :package_version native_configured true end # TODO: raise stuff if mandatory stuff is not defined in cupperfile end |
Instance Method Details
#config(&block) ⇒ Object
37 38 39 |
# File 'lib/cupper/config/config.rb', line 37 def config(&block) instance_eval &block end |
#load(cupperfile) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/cupper/config/config.rb', line 41 def load(cupperfile) Kernel.load cupperfile result = Cupper::Config puts "Configuration loaded successfully, finalizing and returning" return result end |
#parameter(*names) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cupper/config/config.rb', line 10 def parameter(*names) names.each do |name| attr_accessor name # For each given symbol we generate accessor method that sets option's # value being called with an argument, or returns option's current value # when called without arguments define_method name do |*values| value = values.first value ? self.send("#{name}=", value) : instance_variable_get("@#{name}") end end end |