Class: Gill::Remove

Inherits:
Object
  • Object
show all
Includes:
Helper, Settings
Defined in:
lib/gill/remove.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#ask, #basename, #blue, #folder_empty?, #green, #parent, #red

Constructor Details

#initialize(args) ⇒ Remove

Initialize New Remove Object

Parameters:

  • args (String)

    Arguments - Path,RepoName,Category



14
15
16
17
18
19
20
# File 'lib/gill/remove.rb', line 14

def initialize(args)
  @args = args.split(/\#/)
  @category, @repo_name = @args.first, @args.last
  @category_path = File.join(Gill.config.source_path, @category)
  @repo_path = File.join(@category_path, @repo_name)
  @parent_folders = []
end

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category.



7
8
9
# File 'lib/gill/remove.rb', line 7

def category
  @category
end

#category_pathObject (readonly)

Returns the value of attribute category_path.



7
8
9
# File 'lib/gill/remove.rb', line 7

def category_path
  @category_path
end

#repo_nameObject (readonly)

Returns the value of attribute repo_name.



7
8
9
# File 'lib/gill/remove.rb', line 7

def repo_name
  @repo_name
end

#repo_pathObject (readonly)

Returns the value of attribute repo_path.



7
8
9
# File 'lib/gill/remove.rb', line 7

def repo_path
  @repo_path
end

Instance Method Details

#remove_repo(force = false) ⇒ Object

Remove Repo

Parameters:

  • force (true, false) (defaults to: false)

    Forcefully remove a repository.



27
28
29
# File 'lib/gill/remove.rb', line 27

def remove_repo(force=false)
  remove_repository_files if category_exists? && repo_exists?
end