Module: Dotfu

Extended by:
Dotfu
Included in:
Dotfu
Defined in:
lib/dotfu.rb,
lib/dotfu/repos.rb,
lib/dotfu/version.rb

Defined Under Namespace

Classes: Repos

Constant Summary collapse

VERSION =
"0.2.0"

Instance Method Summary collapse

Instance Method Details

#commandsObject



43
44
45
46
# File 'lib/dotfu.rb', line 43

def commands
  spec = Gem::Specification.find_by_name("dotfu")
  return Dir["#{spec.full_gem_path}/commands/*"]
end

#config_userObject

what does the config say our user is?



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dotfu.rb', line 16

def config_user
  if !instance_variables.include? "@config_user"
    if installed?
      output = `git config github.user`.chomp!
      if output.empty?
        @config_user = nil
      else
        @config_user = output
      end
    end
  end

  return @config_user
end

#installed?Boolean

Is git installed in the system?

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
41
# File 'lib/dotfu.rb', line 32

def installed?
  if !@git_installed
    results = ENV["PATH"].split(":").map do |path|
      File.exist?("#{path}/git")
    end

    @git_installed = results.include? true
  end
  return @git_installed
end