Class: Packit::Config
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Packit::Config
- Defined in:
- lib/packit/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize(*args) ⇒ Config
constructor
A new instance of Config.
- #validate ⇒ Object
Constructor Details
#initialize(*args) ⇒ Config
Returns a new instance of Config.
12 13 14 15 |
# File 'lib/packit/config.rb', line 12 def initialize(*args) super(*args) validate end |
Class Method Details
.load(path) ⇒ Object
6 7 8 9 10 |
# File 'lib/packit/config.rb', line 6 def self.load(path) fail "Config file #{path} doesn't exist" unless File.exists?(path) config = YAML.load(File.read(path)) self.new(config) end |
Instance Method Details
#get_binding ⇒ Object
33 34 35 |
# File 'lib/packit/config.rb', line 33 def get_binding binding() end |
#validate ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/packit/config.rb', line 17 def validate fail "No build strategy provided" unless strategy fail "No name was provided" unless name fail "No version was provided" unless version case strategy when 'simple' fail 'No globs for where to find artifacts was provided. Tell me what to package.' unless globs fail "Globs should be an Array of glob strings, but you gave me a #{globs.class}" unless globs.is_a?(Array) when 'pbuilder' else "Build strategy #{strategy} is not supported" end end |