Sha256: 9e972a68ee701364a5d150b43ba6829c6c80262b4ff9dd336269b0716fb565b3
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module Hobo module Lib module Seed class Seed def initialize(seed_path, url) @seed_path = seed_path @url = url end def export path path = File.expand_path(path) FileUtils.mkdir_p path Dir.chdir @seed_path do Hobo::Helper.shell "git archive master | tar -x -C #{path.shellescape}" end end def update FileUtils.mkdir_p @seed_path if File.exists? File.join(@seed_path, 'HEAD') Dir.chdir @seed_path do Hobo::Helper.shell 'git', 'fetch', '--all' end else Hobo::Helper.shell 'git', 'clone', @url, @seed_path, '--mirror' end end def vm_ip [ 10, [*0..255].sample, [*0..255].sample, [*2..255].sample ].join('.') end def version Dir.chdir @seed_path do Hobo::Helper.shell 'git', 'rev-parse', '--short', 'HEAD', :capture => true end end class << self def name_to_url name name.match(/\./) ? name : "git@github.com:inviqa/hobo-seed-#{name}" end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hobo-inviqa-0.0.4 | lib/hobo/lib/seed/seed.rb |
hobo-inviqa-0.0.3 | lib/hobo/lib/seed/seed.rb |