Sha256: 9c9fc9dbd4c1b455f36d6b2a23dcaa8bbaa4e99adbd41e9769945b7fd5e612e8

Contents?: true

Size: 549 Bytes

Versions: 29

Compression:

Stored size: 549 Bytes

Contents

require 'singleton'

module Specinfra
  module Backend
    class ShellScript < Base
      def initialize
        @lines = [ "#!/bin/sh", "" ]
        ObjectSpace.define_finalizer(self, Writer.new("spec.sh", @lines))
      end

      def run_command(cmd, opts={})
        @lines << cmd
        CommandResult.new
      end

      class Writer
        def initialize(file, lines)
          @file = file
          @lines = lines
        end

        def call(*args)
          File.write(@file, @lines.join("\n"))
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta31 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta30 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta29 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta28 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta27 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta26 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta25 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta23 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta22 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta21 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta20 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta19 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta18 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta17 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta16 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta15 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta14 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta13 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta12 lib/specinfra/backend/shellscript.rb
specinfra-2.0.0.beta11 lib/specinfra/backend/shellscript.rb