Module: Toothpick::Commands

Defined in:
lib/toothpick/commands.rb

Constant Summary collapse

TOOTHPICK_HOME =
ENV['HOME'] + "/.toothpick"

Class Method Summary collapse

Class Method Details

.init(picks_repo) ⇒ Object



11
12
13
# File 'lib/toothpick/commands.rb', line 11

def self.init(picks_repo)
  Git.clone_repo(picks_repo, TOOTHPICK_HOME)
end

.new_pickObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/toothpick/commands.rb', line 15

def self.new_pick
  abort_if_setup_not_done!
  git = Git.new(TOOTHPICK_HOME)
  git.update
  pid = Kernel.spawn("$EDITOR #{pick_file_path}")
  Process.waitpid(pid)
  if $?.success? and File.exists?(pick_file_path)
    git.commit
    git.push
  end
end

.search(string) ⇒ Object



27
28
29
30
# File 'lib/toothpick/commands.rb', line 27

def self.search(string)
  abort_if_setup_not_done!
  Search.new(TOOTHPICK_HOME, string)
end