class GitPunch::Project

Constants

EXTENSIONS

Public Class Methods

detect!() click to toggle source
# File lib/git_punch/project.rb, line 13
def self.detect!
  new in_current_directory
end
new(with_root_directory) click to toggle source
# File lib/git_punch/project.rb, line 9
def initialize with_root_directory
  @root = with_root_directory
end

Private Class Methods

in_current_directory() click to toggle source
# File lib/git_punch/project.rb, line 43
def self.in_current_directory
  File.dirname File.expand_path(__FILE__)
end

Public Instance Methods

has_guard_installed?() click to toggle source
# File lib/git_punch/project.rb, line 17
def has_guard_installed?
  not guard_command.nil?
end

Protected Instance Methods

method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/git_punch/project.rb, line 22
def method_missing name, *args
  if "#{name}" =~ /\?$/
    is_project? "#{name}".gsub(/\?/, '').to_sym
  else
    super name, args
  end
end

Private Instance Methods

guard_command() click to toggle source
# File lib/git_punch/project.rb, line 39
def guard_command
  system 'guard'
end
is_project?(name) click to toggle source
# File lib/git_punch/project.rb, line 31
def is_project? name
  raise "project type '#{name}' not supported" \
    unless EXTENSIONS.keys.include? name

  extension_matcher = EXTENSIONS[name]
  Dir[extension_matcher].any?
end