Sha256: f1cd9be66adc0ac93e1c7e3c2e2a9279c95e7c06e87b65b7e9905d73f5b1a323

Contents?: true

Size: 616 Bytes

Versions: 17

Compression:

Stored size: 616 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
        { :stdout => nil, :stderr => nil,
          :exit_status => 0, :exit_signal => nil }
      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

17 entries across 17 versions & 1 rubygems

Version Path
specinfra-0.4.1 lib/specinfra/backend/shellscript.rb
specinfra-0.4.0 lib/specinfra/backend/shellscript.rb
specinfra-0.3.2 lib/specinfra/backend/shellscript.rb
specinfra-0.3.1 lib/specinfra/backend/shellscript.rb
specinfra-0.3.0 lib/specinfra/backend/shellscript.rb
specinfra-0.2.1 lib/specinfra/backend/shellscript.rb
specinfra-0.2.0 lib/specinfra/backend/shellscript.rb
specinfra-0.1.1 lib/specinfra/backend/shellscript.rb
specinfra-0.1.0 lib/specinfra/backend/shellscript.rb
specinfra-0.0.17 lib/specinfra/backend/shellscript.rb
specinfra-0.0.16 lib/specinfra/backend/shellscript.rb
specinfra-0.0.15 lib/specinfra/backend/shellscript.rb
specinfra-0.0.14 lib/specinfra/backend/shellscript.rb
specinfra-0.0.13 lib/specinfra/backend/shellscript.rb
specinfra-0.0.12 lib/specinfra/backend/shellscript.rb
specinfra-0.0.11 lib/specinfra/backend/shellscript.rb
specinfra-0.0.10 lib/specinfra/backend/shellscript.rb