Class: GitShizzle::QuickGit

Inherits:
Object
  • Object
show all
Defined in:
lib/git_shizzle.rb

Instance Method Summary collapse

Constructor Details

#initialize(git = Git::Git.new(Dir.pwd)) ⇒ QuickGit

Returns a new instance of QuickGit.



11
12
13
14
15
# File 'lib/git_shizzle.rb', line 11

def initialize(git = Git::Git.new(Dir.pwd))
  @git = git
  @commands = GitShizzle::Dsl::CommandCollection.new
  @commands.load
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



24
25
26
# File 'lib/git_shizzle.rb', line 24

def method_missing(sym, *args)
  run(sym, *args)
end

Instance Method Details

#run(command, *indexes) ⇒ Object



17
18
19
20
21
22
# File 'lib/git_shizzle.rb', line 17

def run(command, *indexes)
  cmd = @commands.find command
  files = changes_for(indexes, cmd)

  cmd.invoke @git, files
end