Module: Mina::DSL

Extended by:
Forwardable
Defined in:
lib/mina/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands


3
4
5
# File 'lib/mina/dsl.rb', line 3

def commands
  @commands
end

Instance Method Details

#configurationObject


9
10
11
# File 'lib/mina/dsl.rb', line 9

def configuration
  Configuration.instance
end

#deploy(&block) ⇒ Object


50
51
52
53
54
55
56
# File 'lib/mina/dsl.rb', line 50

def deploy(&block)
  run :remote do
    set(:deploy_block, true)
    command deploy_script(&block), quiet: true
    set(:deploy_block, false)
  end
end

#in_path(path, indent: nil) ⇒ Object


42
43
44
45
46
47
48
# File 'lib/mina/dsl.rb', line 42

def in_path(path, indent: nil)
  real_commands = commands
  @commands = Commands.new
  yield
  real_commands.command(commands.process(path), quiet: true, indent: indent)
  @commands = real_commands
end

#invoke(task, *args) ⇒ Object


13
14
15
16
# File 'lib/mina/dsl.rb', line 13

def invoke(task, *args)
  Rake::Task[task].invoke(*args)
  Rake::Task[task].reenable
end

#on(stage) ⇒ Object


36
37
38
39
40
# File 'lib/mina/dsl.rb', line 36

def on(stage)
  old_stage, commands.stage = commands.stage, stage
  yield
  commands.stage = old_stage
end

#reset!Object


22
23
24
# File 'lib/mina/dsl.rb', line 22

def reset!
  @commands = Commands.new
end

#run(backend) ⇒ Object


26
27
28
29
30
31
32
33
34
# File 'lib/mina/dsl.rb', line 26

def run(backend)
  error! "Can't use run block inside another run block. #{caller[2]}" if set?(:run_bock)
  set(:run_bock, true)
  invoke :"#{backend}_environment"
  yield
  commands.run(backend)
  @commands = Commands.new
  set(:run_bock, nil)
end