Class: Vimpack::Commands::Git

Inherits:
Command
  • Object
show all
Defined in:
lib/vimpack/commands/git.rb

Constant Summary collapse

SUB_COMMANDS =
%w{ publish }

Instance Attribute Summary

Attributes included from Utils::File

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

Instance Method Summary collapse

Methods inherited from Command

#initialize, #initialize_environment, #initialize_global_options, #initialize_options, run

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

This class inherits a constructor from Vimpack::Commands::Command

Instance Method Details

#git_execObject



22
23
24
25
26
27
# File 'lib/vimpack/commands/git.rb', line 22

def git_exec
  say(" * running git #{@subcommand} #{@commands.join(' ')}")
  command = Vimpack::Models::Repo.git_exec(@subcommand, @commands)
  say("command complete!")
  say(command.message, :default)
end

#git_publishObject



16
17
18
19
20
# File 'lib/vimpack/commands/git.rb', line 16

def git_publish
  say(" * publishing vimpack repo")
  Vimpack::Models::Repo.publish!(@options[:message])
  say("vimpack repo published!")
end

#initialize_commandsObject



6
7
8
9
# File 'lib/vimpack/commands/git.rb', line 6

def initialize_commands
  die!("git requires at least one argument") if @commands.size < 1
  @subcommand = @commands.shift
end

#runObject



11
12
13
14
# File 'lib/vimpack/commands/git.rb', line 11

def run
  return git_exec unless SUB_COMMANDS.include?(@subcommand)
  send("git_#{@subcommand}".to_sym)
end