Sha256: 983faa15e0c15a1a2deebedcb6a73344a054d81602c39f22dce263a324951612

Contents?: true

Size: 872 Bytes

Versions: 19

Compression:

Stored size: 872 Bytes

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 Rack trait adds config.ru to a Rack-based war project.
    class Rack
      include Trait

      def self.detect?
        !Rails.detect? && (File.exist?("config.ru") || !Dir['*/config.ru'].empty?)
      end

      def self.requirements
        [ Traits::War ]
      end

      def before_configure
        config.webxml.booter = :rack
        config.webinf_files += [FileList['config.ru', '*/config.ru'].detect {|f| File.exist?(f)}]
        config.webxml.rack.env = ENV['RACK_ENV'] || 'production'
      end

      def after_configure
        config.init_contents << "#{config.warbler_templates}/rack.erb"
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
warbler_updated-2.1.0 lib/warbler/traits/rack.rb
warbler-2.0.5 lib/warbler/traits/rack.rb
warbler-2.0.4 lib/warbler/traits/rack.rb
warbler-1.4.10 lib/warbler/traits/rack.rb
warbler-2.0.3 lib/warbler/traits/rack.rb
warbler-2.0.2 lib/warbler/traits/rack.rb
warbler-2.0.1 lib/warbler/traits/rack.rb
warbler-2.0.0 lib/warbler/traits/rack.rb
warbler-2.0.0.rc3 lib/warbler/traits/rack.rb
warbler-2.0.0.rc2 lib/warbler/traits/rack.rb
warbler-2.0.0.rc1 lib/warbler/traits/rack.rb
warbler-2.0.0.pre3 lib/warbler/traits/rack.rb
warbler-2.0.0.pre2 lib/warbler/traits/rack.rb
warbler-1.4.9 lib/warbler/traits/rack.rb
warbler-1.4.8 lib/warbler/traits/rack.rb
warbler-2.0.0.pre1 lib/warbler/traits/rack.rb
warbler-1.4.7 lib/warbler/traits/rack.rb
warbler-1.4.6 lib/warbler/traits/rack.rb
warbler-1.4.5 lib/warbler/traits/rack.rb