class PoiseLanguages::Static::Provider

The default provider for `poise_languages_static`.

@api private @since 1.0 @see Resource @provides poise_languages_static

Public Instance Methods

action_install() click to toggle source

The `install` action for the `poise_languages_static` resource.

@return [void]

# File lib/poise_languages/static/resource.rb, line 73
def action_install
  notifying_block do
    download_archive
    create_directory
    # Unpack is handled as a notification from download_archive.
  end
end
action_uninstall() click to toggle source

The `uninstall` action for the `poise_languages_static` resource.

@return [void]

# File lib/poise_languages/static/resource.rb, line 84
def action_uninstall
  notifying_block do
    delete_archive
    delete_directory
  end
end

Private Instance Methods

create_directory() click to toggle source
# File lib/poise_languages/static/resource.rb, line 93
def create_directory
  unpack_resource = unpack_archive
  directory new_resource.path do
    user 0
    group 0
    mode '755'
    notifies :unpack, unpack_resource, :immediately
  end
end
delete_archive() click to toggle source
# File lib/poise_languages/static/resource.rb, line 124
def delete_archive
  file new_resource.cache_path do
    action :delete
  end
end
delete_directory() click to toggle source
# File lib/poise_languages/static/resource.rb, line 130
def delete_directory
  directory new_resource.path do
    action :delete
    recursive true
  end
end
download_archive() click to toggle source
# File lib/poise_languages/static/resource.rb, line 103
def download_archive
  unpack_resource = unpack_archive
  remote_file new_resource.cache_path do
    source new_resource.source
    owner 0
    group 0
    mode '644'
    notifies :unpack, unpack_resource, :immediately if ::File.exist?(new_resource.path)
    retries new_resource.download_retries
  end
end
unpack_archive() click to toggle source
# File lib/poise_languages/static/resource.rb, line 115
def unpack_archive
  @unpack_archive ||= poise_archive new_resource.cache_path do
    # Run via notification from #download_archive and #create_directory.
    action :nothing
    destination new_resource.path
    strip_components new_resource.strip_components
  end
end