Sha256: b01f16bd597b13c5e843b824bb8ad9c4fc1747f57a196b0a57b4d6c06929cee5

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

module Mina
  module DSL
    attr_reader :commands

    extend Forwardable
    def_delegators :configuration, :fetch, :set, :set?, :ensure!
    def_delegators :commands, :command, :comment

    def configuration
      Configuration.instance
    end

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

    def commands
      @commands ||= Commands.new
    end

    def reset!
      @commands = Commands.new
    end

    def run(backend)
      # @commands = Commands.new
      invoke :environment if backend == :remote
      yield
      commands.run(backend)
      @commands = Commands.new
    end

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

    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

    def deploy(&block)
      run :remote do
        command deploy_script(&block), quiet: true
      end
    end
  end
end
extend Mina::DSL

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mina-1.0.7 lib/mina/dsl.rb
mina-1.0.6 lib/mina/dsl.rb
mina-1.0.5 lib/mina/dsl.rb
mina-1.0.4 lib/mina/dsl.rb
mina-1.0.3 lib/mina/dsl.rb
mina-1.0.2 lib/mina/dsl.rb
mina-1.0.0 lib/mina/dsl.rb
mina-1.0.0.rc2 lib/mina/dsl.rb