Class: Spackle::Commandline
- Inherits:
-
Object
- Object
- Spackle::Commandline
- Defined in:
- lib/spackle/commandline.rb
Class Method Summary collapse
Class Method Details
.install(mod) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/spackle/commandline.rb', line 8 def install(mod) case mod.to_sym when :vim src = File.join(File.dirname(__FILE__), "/../../support/vim/spackle.vim") dest = File. "~/.vim/plugin" raise "No such directory #{dest} -- cannot install Vim plugin" unless File.directory?(dest) FileUtils.copy src, dest puts "spackle.vim installed in #{dest}" else raise "Unrecognized module '#{mod}' -- cannot install" end end |
.parse(options) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/spackle/commandline.rb', line 25 def parse() opts = OptionParser.new do |opts| opts. = "Usage: spackle --install vim\n" + " spackle [rubyscript] [args_for_script]" opts.separator " " opts.separator "Options:" opts.on("-i", "--install MODULE", "Install a Spackle module.", "Choices: vim") do |mod| install(mod) end opts.on("-h", "--help", "-?", "this help screen") do puts opts exit end end if .empty? puts opts else opts.parse!() end raise "Spackle's wrapper mode is not yet implement" unless .empty? end |
.show_error(message) ⇒ Object
21 22 23 |
# File 'lib/spackle/commandline.rb', line 21 def show_error() puts end |