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.4.0.2 app/lib/actions/middleware/record_fixtures.rb
katello-4.4.0.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.4.0 app/lib/actions/middleware/record_fixtures.rb
katello-4.4.0.rc2 app/lib/actions/middleware/record_fixtures.rb
katello-4.4.0.rc1 app/lib/actions/middleware/record_fixtures.rb
katello-4.2.2 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.0 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.0.rc4 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.0.rc3 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.0.rc2.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.0.rc2 app/lib/actions/middleware/record_fixtures.rb
katello-4.3.0.rc1 app/lib/actions/middleware/record_fixtures.rb
katello-4.2.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.2.0.1 app/lib/actions/middleware/record_fixtures.rb
katello-4.1.4 app/lib/actions/middleware/record_fixtures.rb
katello-4.0.3 app/lib/actions/middleware/record_fixtures.rb
katello-4.2.0.1.rc3 app/lib/actions/middleware/record_fixtures.rb
katello-3.18.5 app/lib/actions/middleware/record_fixtures.rb
katello-4.2.0.1.rc2 app/lib/actions/middleware/record_fixtures.rb