Class: Vagrant::Smartos::Zones::Util::Datasets
- Inherits:
-
Object
- Object
- Vagrant::Smartos::Zones::Util::Datasets
- Defined in:
- lib/vagrant/smartos/zones/util/datasets.rb,
lib/vagrant/smartos/zones/util/datasets/manifest.rb
Defined Under Namespace
Classes: Manifest
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
Instance Method Summary collapse
-
#initialize(env, machine = nil) ⇒ Datasets
constructor
A new instance of Datasets.
- #list ⇒ Object
- #setup_smartos_directories ⇒ Object
- #sha1(name) ⇒ Object
- #size(name) ⇒ Object
Constructor Details
#initialize(env, machine = nil) ⇒ Datasets
Returns a new instance of Datasets.
10 11 12 13 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 10 def initialize(env, machine = nil) @env = env @machine = machine end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
8 9 10 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 8 def env @env end |
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
8 9 10 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 8 def machine @machine end |
Instance Method Details
#list ⇒ Object
15 16 17 18 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 15 def list setup_smartos_directories ui.info(datasets.join("\n"), prefix: false) end |
#setup_smartos_directories ⇒ Object
20 21 22 23 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 20 def setup_smartos_directories env.setup_home_path if env.respond_to?(:setup_home_path) FileUtils.mkdir_p(dataset_dir) end |
#sha1(name) ⇒ Object
25 26 27 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 25 def sha1(name) Digest::SHA1.file(dataset_dir.join("#{name}.zfs.gz")).hexdigest end |
#size(name) ⇒ Object
29 30 31 |
# File 'lib/vagrant/smartos/zones/util/datasets.rb', line 29 def size(name) ::File.size(dataset_dir.join("#{name}.zfs.gz")) end |