Class: Powify::Utils

Inherits:
Object
  • Object
show all
Extended by:
Powify
Defined in:
lib/powify/utils.rb

Constant Summary collapse

AVAILABLE_METHODS =
%w(install reinstall uninstall remove help)

Constants included from Powify

POWPATH, VERSION

Class Method Summary collapse

Methods included from Powify

config, current_path, extension

Class Method Details

.installObject Also known as: reinstall

Install powify.dev



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

def install
  uninstall
  $stdout.puts "Cloning powify.dev from github and bundling powify.dev..."
  %x{git clone -q https://github.com/sethvargo/powify.dev.git powify && cd powify && bundle install --deployment && cd .. && mv powify "#{config['hostRoot']}"}
  $stdout.puts "Done!"
end

.run(args = []) ⇒ Object



10
11
12
13
14
# File 'lib/powify/utils.rb', line 10

def run(args = [])
  method = args[0].to_s.downcase
  raise "The command `#{args.first}` does not exist for `powify utils`!" unless Powify::Utils::AVAILABLE_METHODS.include?(method)
  self.send(method)
end

.uninstallObject Also known as: remove

Uninstall powify.dev



26
27
28
29
# File 'lib/powify/utils.rb', line 26

def uninstall
  %x{rm -rf "#{config['hostRoot']}/powify"}
  $stdout.puts "Successfully removed powify.dev"
end