Module: GemGit

Defined in:
lib/gem_git.rb,
lib/gem-git/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.clone_git(repo_path, directory) ⇒ Object



16
17
18
19
# File 'lib/gem_git.rb', line 16

def self.clone_git(repo_path, directory)
  cmd = "cd #{directory} && git clone #{repo_path}"
  Kernel.system(cmd)
end

.install(repo_path) ⇒ Object

Install a ruby gem from git path



5
6
7
8
9
10
11
12
13
14
# File 'lib/gem_git.rb', line 5

def self.install(repo_path)
  temp_dir = Dir.mktmpdir
  begin
    clone_git(repo_path, temp_dir)
    install_gem(temp_dir)
  ensure
    # remove the directory.
    FileUtils.remove_entry_secure temp_dir
  end
end

.install_gem(directory) ⇒ Object



21
22
23
24
25
26
# File 'lib/gem_git.rb', line 21

def self.install_gem(directory)
  cd = "cd #{directory}/* && "

  Kernel.system("#{cd} gem build *.gemspec")
  Kernel.system("#{cd} gem install *.gem")
end