Module: Gitegnore

Defined in:
lib/gitegnore.rb,
lib/gitegnore/cli.rb,
lib/gitegnore/version.rb

Defined Under Namespace

Classes: CLI

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.fetch(name) ⇒ Object

Raises:

  • (RuntimeError)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gitegnore.rb', line 13

def self.fetch(name)
  self.check

  all_ig_names = self.all_gitignores_in_repo
  base_path = self.repo_dir

  name = "#{name}.gitignore" unless name.end_with? ".gitignore"

  all_ig_names.each do |ig_name|
    if ig_name.casecmp(name) == 0
      puts "found #{name}! copy to current directory..."
      FileUtils.cp "#{base_path}/#{ig_name}", "#{Dir.pwd}/.gitignore"
      return
    end
  end

  raise RuntimeError, "#{name}.gitignore not found"
end

.listObject



7
8
9
10
11
# File 'lib/gitegnore.rb', line 7

def self.list
  self.check

  return all_gitignores_in_repo
end