Sha256: 6e9244928abed8b47f171ad28261126915a44ecaf2114af53ad2f54114475bfa

Contents?: true

Size: 1002 Bytes

Versions: 10

Compression:

Stored size: 1002 Bytes

Contents

module Subspace
  module Commands
    module Ansible
      def ansible_playbook(*args)
        args.push "--diff"
        ansible_command("ansible-playbook", *args)
      end

      def ansible_command(command, *args)
        update_ansible_cfg
        retval = false
        Dir.chdir "config/subspace" do
          say ">> Running #{command} #{args.join(' ')}"
          retval = system(command, *args, out: $stdout, err: $stderr)
          say "<< Done"
        end
        retval
      end

      private

      def update_ansible_cfg
        if ENV["DISABLE_MITOGEN"]
          puts "Mitogen explicitly disabled.  Skipping detection. "
        elsif `pip show mitogen 2>&1` =~ /^Location: (.*?)$/m
          @mitogen_path = $1
          puts "πŸŽπŸš€πŸš…Mitogen found at #{@mitogen_path}.  WARP 9!....ENGAGE!πŸš€"
        else
          puts "Mitogen not detected.  Ansible will be slow.  Run `pip install mitogen` to fix."
        end
        template! "ansible.cfg"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
subspace-3.0.12 lib/subspace/commands/ansible.rb
subspace-3.0.11 lib/subspace/commands/ansible.rb
subspace-3.0.10 lib/subspace/commands/ansible.rb
subspace-3.0.9 lib/subspace/commands/ansible.rb
subspace-3.0.6 lib/subspace/commands/ansible.rb
subspace-3.0.5 lib/subspace/commands/ansible.rb
subspace-3.0.4 lib/subspace/commands/ansible.rb
subspace-3.0.3 lib/subspace/commands/ansible.rb
subspace-3.0.2 lib/subspace/commands/ansible.rb
subspace-3.0.0 lib/subspace/commands/ansible.rb