Class: Vim::Jar::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/vim-jar/cli.rb

Instance Method Summary collapse

Instance Method Details

#editObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vim-jar/cli.rb', line 24

def edit
  check!
  editor = [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
  if editor
    command = "#{editor} #{config.bundle_file_path}"
    success = system(command)
    raise ::Vim::Jar::InstallError.new "Could not run '#{command}'" unless success
  else
    ::Vim::Jar::InstallError.new("To open BundleFile, set $EDITOR or $BUNDLER_EDITOR")
  end
end

#initObject



10
11
12
13
14
# File 'lib/vim-jar/cli.rb', line 10

def init 
  check!
  done
  exit 0
end

#installObject



17
18
19
20
21
# File 'lib/vim-jar/cli.rb', line 17

def install
  check!
  loader = ::Vim::Jar::Loader.new
  loader.execute
end

#installedObject



38
39
40
# File 'lib/vim-jar/cli.rb', line 38

def installed
  STDOUT.puts ::Vim::Jar::Plugin.installed.join("\n")
end

#uninstall(name) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/vim-jar/cli.rb', line 51

def uninstall(name)
  check!
  if ::Vim::Jar::Plugin.installed.include?(name)
    ::Vim::Jar::Plugin.uninstall(name)
    STDOUT.puts "plugin #{name} has been already remove from #{config.bundle_home.join(name)}"
  else
    STDERR.puts "You didn't install plugin named #{name}"
  end
  
end

#updateObject



43
44
45
46
47
48
# File 'lib/vim-jar/cli.rb', line 43

def update
  check!
  if ::Vim::Jar::Plugin.update 
    STDOUT.puts "All your plugin is up to date."
  end
end