Sha256: b9879bdce476e3e9eeeb4226b4816d325e471bf36446c6af2b370f9e6439c24c

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require "fileutils"

module Roger::Release::Finalizers
  # Finalizes the release into a directory in target_path
  #
  # The directory name will have the format PREFIX-VERSION
  #
  class Dir < Base
    # @option options :prefix Prefix to put before the version (default = "html")
    def call(release, call_options = {})
      options = {
        prefix: "html",
        target_path: release.target_path
      }.update(@options)
      options.update(call_options) if call_options

      name = [options[:prefix], release.scm.version].join("-")

      target_dir = Pathname.new(options[:target_path])
      FileUtils.mkdir_p(target_dir) unless target_dir.exist?

      target_path = target_dir + name

      release.log(self, "Finalizing release to #{target_path}")

      if File.exist?(target_path)
        release.log(self, "Removing existing target #{target_path}")
        FileUtils.rm_rf(target_path)
      end

      FileUtils.cp_r release.build_path, target_path
    end
  end
end

Roger::Release::Finalizers.register(:dir, Roger::Release::Finalizers::Dir)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
roger-1.6.4 lib/roger/release/finalizers/dir.rb
roger-1.6.3 lib/roger/release/finalizers/dir.rb
roger-1.6.2 lib/roger/release/finalizers/dir.rb
roger-1.6.1 lib/roger/release/finalizers/dir.rb
roger-1.6.0 lib/roger/release/finalizers/dir.rb
roger-1.5.0 lib/roger/release/finalizers/dir.rb
roger-1.4.6 lib/roger/release/finalizers/dir.rb