Sha256: 4ce2f5dca927d07f912011970928437bfe5f9d3113e81dddcfd034f2a0ee6a35

Contents?: true

Size: 1.39 KB

Versions: 60

Compression:

Stored size: 1.39 KB

Contents

class Jets::Builders
  class RackPackager < RubyPackager
    def finish
      return unless gemfile_exist?

      super

      symlink_gems
      copy_rackup_wrappers
      rack_symlink
    end

    def symlink_gems
      ruby_folder = Jets::Gems.ruby_folder
      # IE: @full_app_root: /tmp/jets/demo/stage/code/rack
      dest = "#{@full_app_root}/vendor/gems/ruby/#{ruby_folder}"
      FileUtils.mkdir_p(File.dirname(dest))
      FileUtils.ln_sf("/opt/ruby/gems/#{ruby_folder}", dest)
    end

    def copy_rackup_wrappers
      # IE: @full_app_root: /tmp/jets/demo/stage/code/rack
      rack_bin = "#{@full_app_root}/bin"
      %w[rackup rackup.rb].each do |file|
        src = File.expand_path("./rackup_wrappers/#{file}", File.dirname(__FILE__))
        dest = "#{rack_bin}/#{file}"
        FileUtils.mkdir_p(rack_bin) unless File.exist?(rack_bin)
        FileUtils.cp(src, dest)
        FileUtils.chmod 0755, dest
      end
    end

    # Moves folder to a stage folder and create a symlink its place
    # that links from /var/task to /tmp. Example:
    #
    #   stage/code/rack => /tmp/rack
    #
    def rack_symlink
      src = @full_app_root
      return unless File.exist?(src)

      dest = "#{stage_area}/rack"
      dir = File.dirname(dest)
      FileUtils.mkdir_p(dir) unless File.exist?(dir)
      FileUtils.mv(src, dest)

      # Create symlink
      FileUtils.ln_sf("/tmp/rack", src)
    end
  end
end

Version data entries

60 entries across 60 versions & 2 rubygems

Version Path
jets-1.5.7 lib/jets/builders/rack_packager.rb
jets-1.5.6 lib/jets/builders/rack_packager.rb
jets-1.5.5 lib/jets/builders/rack_packager.rb
jets-1.5.4 lib/jets/builders/rack_packager.rb
jets-1.5.3 lib/jets/builders/rack_packager.rb
jets-1.5.2 lib/jets/builders/rack_packager.rb
jets-1.5.1 lib/jets/builders/rack_packager.rb
jets-1.5.0 lib/jets/builders/rack_packager.rb
jets-1.4.11 lib/jets/builders/rack_packager.rb
jets-1.4.10 lib/jets/builders/rack_packager.rb
jets-1.4.9 lib/jets/builders/rack_packager.rb
jets-1.4.8 lib/jets/builders/rack_packager.rb
jets-1.4.7 lib/jets/builders/rack_packager.rb
jets-1.4.6 lib/jets/builders/rack_packager.rb
jets-1.4.5 lib/jets/builders/rack_packager.rb
jets-1.4.4 lib/jets/builders/rack_packager.rb
jets-1.4.3 lib/jets/builders/rack_packager.rb
jets-1.4.2 lib/jets/builders/rack_packager.rb
jets-1.4.1 lib/jets/builders/rack_packager.rb
jets-1.4.0 lib/jets/builders/rack_packager.rb