Sha256: 83e33e09131e2526a71be499b3cb0d870dbaa416af598cdab733de8f7057912e

Contents?: true

Size: 955 Bytes

Versions: 6

Compression:

Stored size: 955 Bytes

Contents

require 'warbler'
require 'warbler/traits/furoshiki'

module Furoshiki
  class Jar
    # @param [Furoshiki::Shoes::Configuration] config user configuration
    def initialize(config)
      @furoshiki_config = config

      unless config.valid?
        raise Furoshiki::ConfigurationError, "Invalid configuration.\n#{config.error_message_list}"
      end

      @config = @furoshiki_config.to_warbler_config
    end

    def package(dir = default_dir)
      Dir.chdir working_dir do
        jar = Warbler::Jar.new
        jar.apply @config
        package_dir = dir.relative_path_from(working_dir)
        package_dir.mkpath
        path = package_dir.join(filename).to_s
        jar.create path
        File.expand_path path
      end
    end

    def default_dir
      working_dir.join 'pkg'
    end

    def filename
      "#{@config.jar_name}.#{@config.jar_extension}"
    end

    def working_dir
      @furoshiki_config.working_dir
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
furoshiki-0.6.1 lib/furoshiki/jar.rb
furoshiki-0.6.0 lib/furoshiki/jar.rb
furoshiki-0.5.0 lib/furoshiki/jar.rb
furoshiki-0.4.0 lib/furoshiki/jar.rb
furoshiki-0.3.1 lib/furoshiki/jar.rb
furoshiki-0.3.0 lib/furoshiki/jar.rb