Sha256: 86ec9c7a35f84d4c5752b31e733393f72c6d0025daa92b6bab8feb1a0de9ff09

Contents?: true

Size: 1.23 KB

Versions: 20

Compression:

Stored size: 1.23 KB

Contents

#--
# Copyright (c) 2010-2012 Engine Yard, Inc.
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
# This source code is available under the MIT license.
# See the file LICENSE.txt for details.
#++

module Warbler
  module Traits
    # The NoGemspec trait is used when no gemspec file is found for a
    # jar project. It assumes a standard layout including +bin+ and
    # +lib+ directories.
    class NoGemspec
      include Trait
      include PathmapHelper
      include ExecutableHelper

      def self.detect?
        Jar.detect? && !Gemspec.detect?
      end

      def before_configure
        config.dirs = ['.']
      end

      def after_configure
        if File.directory?("lib")
          add_init_load_path(config.pathmaps.application.inject("lib") {|pm,x| pm.pathmap(x)})
        end
      end

      def update_archive(jar)
        update_archive_add_executable(jar)
      end

      def default_executable
        exes = Dir['bin/*'].sort
        unless(exe = exes.grep(/#{config.jar_name}/).first)
          exe = exes.first
          if exe
            warn "No executable matching config.jar_name found, using #{exe}"
          end
        end
        raise "No executable script found" unless exe
        exe
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
warbler-1.4.10 lib/warbler/traits/nogemspec.rb
warbler-2.0.0 lib/warbler/traits/nogemspec.rb
warbler-2.0.0.rc3 lib/warbler/traits/nogemspec.rb
warbler-2.0.0.rc2 lib/warbler/traits/nogemspec.rb
warbler-2.0.0.rc1 lib/warbler/traits/nogemspec.rb
warbler-2.0.0.pre3 lib/warbler/traits/nogemspec.rb
warbler-2.0.0.pre2 lib/warbler/traits/nogemspec.rb
warbler-1.4.9 lib/warbler/traits/nogemspec.rb
warbler-1.4.8 lib/warbler/traits/nogemspec.rb
warbler-2.0.0.pre1 lib/warbler/traits/nogemspec.rb
warbler-1.4.7 lib/warbler/traits/nogemspec.rb
warbler-1.4.6 lib/warbler/traits/nogemspec.rb
warbler-1.4.5 lib/warbler/traits/nogemspec.rb
warbler-1.4.4 lib/warbler/traits/nogemspec.rb
warbler-1.4.3 lib/warbler/traits/nogemspec.rb
warbler-1.4.2 lib/warbler/traits/nogemspec.rb
warbler-1.4.1 lib/warbler/traits/nogemspec.rb
warbler-1.4.0 lib/warbler/traits/nogemspec.rb
warbler-1.4.0.beta2 lib/warbler/traits/nogemspec.rb
warbler-1.4.0.beta1 lib/warbler/traits/nogemspec.rb