Class: Piggy::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/piggy/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



11
12
13
# File 'lib/piggy/cli.rb', line 11

def self.source_root
  File.expand_path('../../../templates', __FILE__)
end

Instance Method Details

#event(title) ⇒ Object



36
37
38
# File 'lib/piggy/cli.rb', line 36

def event(title)
  Event.create title
end

#historyObject



41
42
43
# File 'lib/piggy/cli.rb', line 41

def history
  puts Event.all if Event.any?
end

#installObject



22
23
24
25
26
27
# File 'lib/piggy/cli.rb', line 22

def install
  copy_file "git_hook", ".git/hooks/post-commit"
  chmod ".git/hooks/post-commit", 0755
  puts "Successfully installed git hook."
  puts "Piggy is now monitoring the git commits made in this project."
end

#subscribe(subscriber) ⇒ Object



30
31
32
33
# File 'lib/piggy/cli.rb', line 30

def subscribe(subscriber)
  Subscribers.add subscriber
  puts "Piggy is now sending events to '#{subscriber}'."
end

#versionObject



16
17
18
# File 'lib/piggy/cli.rb', line 16

def version
  puts Piggy::VERSION
end