Sha256: 2e590713ee6b413bdb6ec7ffe896cf306ffa60dce1bf77d36fb65b00fd74880b

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require 'base64'
module Popito
  class ConfigPayload
    attr_accessor :project_path, :build_path, :deploy_path, :stages, :build_config, :project_token, :included_files

    def initialize(project_path:, project_token:, stages: [], build_config: {}, included_files: [])
      self.project_path = File.expand_path(project_path)
      self.build_path = File.expand_path("#{project_path}/#{Popito::BUILD_DIR_NAME}")
      self.deploy_path = File.expand_path("#{project_path}/#{Popito::DEPLOY_DIR_NAME}")
      self.stages = stages
      self.project_token = project_token
      self.build_config = build_config
      self.included_files = included_files
    end

    def included_files_payload
      included_files.map do |file|
        { encoding: 'base64', path: file, content: Base64.encode64(File.read("#{project_path}/#{file}")) }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
popito-0.0.1.alpha lib/popito/deployer/config/config_payload.rb