Class: Vimpack::Commands::Command

Inherits:
Object
  • Object
show all
Includes:
Utils::File, Utils::Git, Utils::Io, Utils::Process
Defined in:
lib/vimpack/commands/command.rb

Direct Known Subclasses

Git, Info, Init, Install, List, Search, Uninstall

Instance Attribute Summary

Attributes included from Utils::File

#bundle_path, #home_path, #pack_path, #script_path, #vim_path

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::Process

#run_process!, #run_process_and_wait!, #run_process_or_die!, #wait_for_child, #within_dir

Methods included from Utils::Io

#die!, #exit_with_error!, #say, #scream

Methods included from Utils::Git

#add_submodule, #init_repo, #init_submodule, #remove_submodule, #replace_contents, #repo_add_dot, #repo_add_remote, #repo_clone, #repo_commit, #repo_exec, #repo_pull, #repo_push, #repo_remote?, #sanitize_commands, #update_submodule

Methods included from Utils::File

#create_link, #directory_exists?, #file_exists?, #make_dir, #move_path, #remove_directory, #remove_link, #setup_paths, #symlink_exists?, #template, #template_path

Constructor Details

#initialize(options, global_options) ⇒ Command

Returns a new instance of Command.



9
10
11
12
13
14
15
16
17
18
# File 'lib/vimpack/commands/command.rb', line 9

def initialize(options, global_options)
  @options = options
  @global_options = global_options
  @commands = ARGV
  setup_paths(@options[:home_directory] || ENV['HOME'])
  initialize_environment
  initialize_global_options
  initialize_options
  initialize_commands
end

Class Method Details

.run(options = Hash.new, commands = Hash.new) ⇒ Object



40
41
42
# File 'lib/vimpack/commands/command.rb', line 40

def self.run(options = Hash.new, commands = Hash.new)
  new(options, commands).run
end

Instance Method Details

#initialize_commandsObject



33
34
# File 'lib/vimpack/commands/command.rb', line 33

def initialize_commands
end

#initialize_environmentObject



20
21
22
23
24
25
# File 'lib/vimpack/commands/command.rb', line 20

def initialize_environment
  Vimpack.environment = @global_options[:environment].to_sym
  unless Vimpack.env?('production')
    say(" * using environment #{Vimpack.environment.inspect}")
  end
end

#initialize_global_optionsObject



27
28
# File 'lib/vimpack/commands/command.rb', line 27

def initialize_global_options
end

#initialize_optionsObject



30
31
# File 'lib/vimpack/commands/command.rb', line 30

def initialize_options
end

#runObject

Raises:

  • (NotImplemented)


36
37
38
# File 'lib/vimpack/commands/command.rb', line 36

def run
  raise NotImplemented
end