Sha256: a0b622216639d2b66014b95e416600eb9488b6181bd792320218af8878f65869

Contents?: true

Size: 724 Bytes

Versions: 13

Compression:

Stored size: 724 Bytes

Contents

require 'site_hook/config'
module SiteHook
  class Methods
    def self.mklogdir
      path = SiteHook::Paths.default_logs
      if path.exist?
        # Path exists, don't do anything
      else
        FileUtils.mkpath(path.to_s)
      end
    end

    # @param [String] hook_name the hook name as defined in the projects:... directive
    def self.find_hook(hook_name)
      project_objs = SiteHook::Configs::Projects.constants
      ret_val = project_objs.detect do |obj|
        SiteHook::Configs::Projects.const_get(obj.to_s).real_key.to_s == hook_name.to_s
      end
      if ret_val.nil?
        return nil
      elsif ret_val
        return SiteHook::Configs::Projects.const_get(ret_val)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
site_hook-0.9.16 lib/site_hook/methods.rb
site_hook-0.9.15 lib/site_hook/methods.rb
site_hook-0.9.14 lib/site_hook/methods.rb
site_hook-0.9.12 lib/site_hook/methods.rb
site_hook-0.9.11 lib/site_hook/methods.rb
site_hook-0.9.10 lib/site_hook/methods.rb
site_hook-0.9.9 lib/site_hook/methods.rb
site_hook-0.9.8 lib/site_hook/methods.rb
site_hook-0.9.7 lib/site_hook/methods.rb
site_hook-0.9.6 lib/site_hook/methods.rb
site_hook-0.9.5 lib/site_hook/methods.rb
site_hook-0.9.4 lib/site_hook/methods.rb
site_hook-0.9.3 lib/site_hook/methods.rb