Sha256: 86dc4c243575c53cf4b4fd97e9f569d4913ad54f0a037d59a1a976c8b4a685d6

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true
class Shoes
  module Swt
    class Packager
      attr_accessor :gems

      def initialize(dsl)
        @dsl  = dsl
        @gems = []
        @packages = []
      end

      def options
        OptionParser.new do |opts|
          opts.on('--jar', 'Package as executable JAR file') do
            @packages << :jar
          end

          opts.on('--mac', 'Package as OS X application') do
            @packages << :mac
          end

          opts.on('--windows', 'Package as Windows application') do
            @packages << :windows
          end

          opts.on('--linux', 'Package as Linux application') do
            @packages << :linux
          end
        end
      end

      def run(path)
        if @packages.empty?
          puts "You must select at least one packaging format.\n\n#{::Shoes::UI::CLI::PackageCommand.new.help}"
          return
        end

        begin
          require 'shoes/package'
          require 'shoes/package/configuration'
          config = ::Shoes::Package::Configuration.load(path)
          config.gems.concat(@gems)
        rescue Errno::ENOENT => e
          abort "shoes: #{e.message}"
        end

        @packages.each do |package_type|
          puts "Packaging #{package_type}..."
          packager = ::Shoes::Package.create_packager(config, package_type)
          packager.package
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre12 lib/shoes/swt/packager.rb