Sha256: 30401d8e9f50b7754974eaeffe049f25f560aedb16985669caf67bce540438fb

Contents?: true

Size: 772 Bytes

Versions: 248

Compression:

Stored size: 772 Bytes

Contents

module Actions
  module Middleware
    class RecordFixtures < Dynflow::Middleware
      def run(*args)
        pass(*args)
      ensure
        dump(:input)
        dump(:output)
      end

      private

      def dump(variant)
        fail unless [:input, :output].include? variant
        File.write(log_file(variant), YAML.dump(action.send(variant)))
      end

      def log_base
        File.join(Rails.root, 'log', 'dynflow')
      end

      def log_subdirs
        action.class.name.underscore
      end

      def log_file(variant)
        dir = File.join(log_base, log_subdirs)
        FileUtils.mkdir_p(dir)
        timestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S-%L")
        return File.join(dir, "#{timestamp}-#{variant}.yaml")
      end
    end
  end
end

Version data entries

248 entries across 248 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/actions/middleware/record_fixtures.rb
katello-4.15.0 app/lib/actions/middleware/record_fixtures.rb
katello-4.15.0.rc2 app/lib/actions/middleware/record_fixtures.rb
katello-4.15.0.rc1 app/lib/actions/middleware/record_fixtures.rb
katello-4.14.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.14.0 app/lib/actions/middleware/record_fixtures.rb
katello-4.14.0.rc3 app/lib/actions/middleware/record_fixtures.rb
katello-4.14.0.rc2 app/lib/actions/middleware/record_fixtures.rb
katello-4.14.0.rc1.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.14.0.rc1 app/lib/actions/middleware/record_fixtures.rb
katello-4.13.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.13.0 app/lib/actions/middleware/record_fixtures.rb
katello-4.12.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.13.0.rc1 app/lib/actions/middleware/record_fixtures.rb
katello-4.12.0 app/lib/actions/middleware/record_fixtures.rb
katello-4.12.0.rc3 app/lib/actions/middleware/record_fixtures.rb
katello-4.12.0.rc2 app/lib/actions/middleware/record_fixtures.rb
katello-4.12.0.rc1 app/lib/actions/middleware/record_fixtures.rb
katello-4.11.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.11.0 app/lib/actions/middleware/record_fixtures.rb