Class: Sekt::CLI::Recipe

Inherits:
Thor
  • Object
show all
Includes:
GetBottle
Defined in:
lib/sekt/cli/recipe.rb

Instance Method Summary collapse

Methods included from GetBottle

#get_bottle!

Instance Method Details

#export(id) ⇒ Object



28
29
30
# File 'lib/sekt/cli/recipe.rb', line 28

def export(id)
  File.write("#{id}.yml", get_bottle!(id).to_h.to_yaml)
end

#install(file = 'bottle.yml') ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/sekt/cli/recipe.rb', line 9

def install(file='bottle.yml')
  @cellar = Cellar.new

  bottle_yaml = YAML.load_file(file)
  bottle = @cellar.create_bottle(bottle_yaml)

  wine_tricks = bottle.wine_tricks
  wine_tricks.sandbox
  wine_tricks.install(bottle.dependencies)

  wine = bottle.wine
  bottle.inside_wine do
    wine.execute("C:\\#{get_source(bottle)}")
  end

  @cellar.update_bottle(bottle)
end