Class: Egads::Extract

Inherits:
Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/egads/command/extract.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Group

exit_on_failure?

Instance Attribute Details

#seed_pathObject

Returns the value of attribute seed_path.



9
10
11
# File 'lib/egads/command/extract.rb', line 9

def seed_path
  @seed_path
end

#seed_shaObject

Returns the value of attribute seed_sha.



9
10
11
# File 'lib/egads/command/extract.rb', line 9

def seed_sha
  @seed_sha
end

Instance Method Details

#extractObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/egads/command/extract.rb', line 15

def extract
  if should_extract?
    # Download_patch
    do_download(sha, File.join(patch_dir, "#{sha}.tar.gz"), 'patch')

    do_extract patch_path

    # If the seed path exists, the patch was build w/ egads <= 4.0
    # Newer patch files include the seed
    seed_pointer = Pathname.new(patch_dir).join("egads-seed")
    if seed_pointer.exist?
      # Download seed
      self.seed_sha = seed_pointer.read.strip
      self.seed_path = File.join(RemoteConfig.seed_dir, "#{seed_sha}.tar.gz")
      do_download(seed_sha, seed_path, 'seed')

      do_extract seed_path

      apply_patch
    else
      say_status :done, 'Patch tarball is complete, no seed to extract.'
    end

    finish_extraction
  else
    say_status :done, "#{sha} already extracted. Use --force to overwrite"
  end
end

#setup_environmentObject



11
12
13
# File 'lib/egads/command/extract.rb', line 11

def setup_environment
  RemoteConfig.setup_environment
end