Module: Ironfan::CookbookRequirements::ClassMethods

Defined in:
lib/ironfan/cookbook_requirements.rb

Instance Method Summary collapse

Instance Method Details

#cookbook_req(name, constraint) ⇒ Object


149
150
151
# File 'lib/ironfan/cookbook_requirements.rb', line 149

def cookbook_req(name, constraint)
  default_cookbook_reqs << new_req(name, constraint)
end

#default_cookbook_reqsObject


145
146
147
# File 'lib/ironfan/cookbook_requirements.rb', line 145

def default_cookbook_reqs
  @default_cookbook_reqs ||= []
end

#new_req(name, constraint) ⇒ Object


137
138
139
140
141
142
143
# File 'lib/ironfan/cookbook_requirements.rb', line 137

def new_req(name, constraint)
  if constraint.start_with?('>=') && require_strict_versioning?
    raise StandardError.new("Please don't use >= constraints. They're too vague!")
  else
    Ironfan::Plugin::CookbookRequirement.new(name: name, constraint: constraint)
  end
end

#require_strict_versioning(choice) ⇒ Object


133
134
135
# File 'lib/ironfan/cookbook_requirements.rb', line 133

def require_strict_versioning choice
  @require_strict = choice
end

#require_strict_versioning?Boolean

Returns:

  • (Boolean)

128
129
130
131
# File 'lib/ironfan/cookbook_requirements.rb', line 128

def require_strict_versioning?
  @require_strict = true if @require_strict.nil?
  @require_strict
end