class FunWith::Gems::Validator

Public Class Methods

new( gem_const ) click to toggle source
# File lib/fun_with/gems/validator.rb, line 8
def initialize( gem_const )
  @gem_const = gem_const
end
validate( gem_const ) click to toggle source
# File lib/fun_with/gems/validator.rb, line 4
def self.validate( gem_const )
  self.new( gem_const ).validate
end

Public Instance Methods

fun_gem_errors() click to toggle source
# File lib/fun_with/gems/validator.rb, line 36
def fun_gem_errors
  @fun_gem_errors
end
git_up_to_date?( filepath ) click to toggle source
# File lib/fun_with/gems/validator.rb, line 40
def git_up_to_date?( filepath )
  # On branch master
  #         Your branch is ahead of 'origin/master' by 1 commit.
  #           (use "git push" to publish your local commits)
  #
  #         nothing to commit, working directory clean
  #
end
validate() click to toggle source

should be available via the gem itgem_const?

# File lib/fun_with/gems/validator.rb, line 13
def validate
  @fun_gem_errors = []
  
  if @gem_const.respond_to?(:root)
    if @gem_const.root.is_a?( FunWith::Files::FilePath )
      @fun_gem_errors << ".root() doesn't exist"                unless @gem_const.root.directory?
      @fun_gem_errors << "VERSION file doesn't exist"           unless @gem_const.root("VERSION").file?
      @fun_gem_errors << "CHANGELOG.markdown doesn't exist"     unless @gem_const.root("CHANGELOG.markdown")
      @fun_gem_errors << "lib directory doesn't exist"          unless @gem_const.root("lib").directory?
    else
      @fun_gem_errors << ".root() doesn't give a filepath"
    end
  else
    @fun_gem_errors << "doesn't respond to .root()"
  end
  
  if ! @gem_const.respond_to?(:version)
    @fun_gem_errors << "doesn't respond to .version()"
  end
  
  @fun_gem_errors
end