No commit activity in last 3 years
No release in over 3 years
Exchanges original sshkit dsl against a custom dsl. This DSL does not change the scope of the blocks.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
= 3.0.0

Runtime

 Project Readme

Build Status Coverage Status Code Climate Gem Version

SSHKit::Custom::DSL

Exchanges original sshkit dsl against a custom dsl. This DSL does not change the scope of the blocks. Furthor more it uses Rake::Threadpool, to handle parallel requests. Keep in mind Runner::Parallel and Runner::Group execute all blocks in parallel threads, so do it thread save.

Installation

Add this line to your application's Gemfile:

gem 'sshkit-custom-dsl'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sshkit-custom-dsl

Usage

require 'sshkit/custom/dsl'

extend SSHKit::Custom::DSL
require 'delegate'
# require 'sshkit/dsl' <= switch to see the different

SSHKit.configure do |sshkit|
  sshkit.format = :pretty
  sshkit.output_verbosity = :debug
  sshkit.default_env = {}
  sshkit.backend = SSHKit::Backend::Netssh
  sshkit.backend.configure do |backend|
    backend.pty =false
    backend.connection_timeout = 5
    backend.ssh_options = {user: 'deploy'}
  end
end

class TestScope < SimpleDelegator
  def data
    {msg: "12345"}
  end

  def call_it

    on %w{localhost 127.0.0.1}, in: :sequence, wait: 0 do
      within "/tmp" do
        with rails_env: :production do
          execute "echo", data.fetch(:msg)
        end
      end
    end
    
  end
end


# new dsl not included in sshkit
default_runner_opts {in: :groups, limit: 9999}

data = {msg: "ABCD"}

TestScope.new(self).call_it

on %w{localhost 127.0.0.1}, in: :sequence, wait: 0 do
  within "/tmp" do
    with rails_env: :production do
      execute "echo", data.fetch(:msg)
    end
  end
end

# thread_count is a new config option for parallel runner
# is used for Rake::ThreadPool
on %w{localhost 127.0.0.1}, thread_count: 10 do
  within "/tmp" do
    with rails_env: :production do
      execute "env", "|sort"
    end
  end
end

on %w{localhost 127.0.0.1} do
  within "/tmp" do
    with rails_env: :production do
      execute do |backend|
        puts backend.inspect
        ["env", "|sort"]
      end
    end
  end
end

It should work like the original one, I hope.

Contributing

  1. Fork it ( https://github.com/faber-lotto/sshkit-custom-dsl/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request