Module: Geb::Site::Release

Included in:
Geb::Site
Defined in:
lib/geb/site/release.rb

Defined Under Namespace

Classes: SiteReleasingError

Instance Method Summary collapse

Instance Method Details

#get_site_release_output_directoryString

get the site release output directory

Returns:

  • (String)

    the site release directory



52
53
54
# File 'lib/geb/site/release.rb', line 52

def get_site_release_output_directory
  return File.join(@site_path, @site_config.output_dir, Geb::Defaults::RELEASE_OUTPUT_DIR)
end

#get_template_archive_release_pathString

get the template archive path

Returns:

  • (String)

    the template archive path within the release directory



46
47
48
# File 'lib/geb/site/release.rb', line 46

def get_template_archive_release_path
  return File.join(@site_path, @site_config.output_dir, Geb::Defaults::RELEASE_OUTPUT_DIR, Geb::Defaults::TEMPLATE_ARCHIVE_FILENAME)
end

#releaseObject

release the site

Raises:

  • SiteNotLoadedError if the site is not loaded



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/geb/site/release.rb', line 23

def release

  # make sure the site is laoded, if not, raise an error
  raise Geb::Site::SiteNotLoadedError.new("Could not release the site.") unless @loaded

  # make sure the site is not already releasing, to prevent recursive releases
  raise Geb::Site::SiteReleasingError.new if @releasing

  # set the site to releasing
  @releasing = true

  # build the site
  build();

ensure

  # set the site to not releasing
  @releasing = false

end

#released?Boolean

check if the site has been released. The site is considered released if the release directory exists and is not empty.

Returns:

  • (Boolean)

    true if the site has been released, false otherwise



59
60
61
# File 'lib/geb/site/release.rb', line 59

def released?
  return Dir.exist?(get_site_release_output_directory()) && !Dir.empty?(get_site_release_output_directory())
end