@@ -539,13 +539,6 @@ def self.install_ruby(app_path: , ruby_version: , stack:, arch: , metadata:, io:
539539 io . error message
540540 end
541541
542- # installs vendored gems into the slug
543- def self . install_bundler_in_app ( bundler_src_dir :, app_bundler_dir :)
544- FileUtils . mkdir_p ( app_bundler_dir )
545- Dir . chdir ( app_bundler_dir ) do |dir |
546- `cp -R #{ bundler_src_dir } /. .`
547- end
548- end
549542
550543 # default set of binaries to install
551544 # @return [Array] resulting list
@@ -931,74 +924,8 @@ def self.load_bundler_cache(cache: , metadata: , stack:, bundler_cache: , bundle
931924 metadata . write ( stack_cache , stack )
932925 end
933926
934- def self . purge_bundler_cache ( bundler_cache : , stack : nil , ruby_version : , bundler :)
935- bundler_cache . clear ( stack )
936- # need to reinstall language pack gems
937- install_bundler_in_app ( bundler_src_dir : bundler . bundler_path , app_bundler_dir : ruby_version . bundler_directory )
938- end
939-
940- # writes ERB based database.yml for Rails. The database.yml uses the DATABASE_URL from the environment during runtime.
941- def create_database_yml
942- return false unless File . directory? ( "config" )
943- return false if bundler . has_gem? ( 'activerecord' ) && bundler . gem_version ( 'activerecord' ) >= Gem ::Version . new ( '4.1.0.beta1' )
944-
945- topic ( "Writing config/database.yml to read from DATABASE_URL" )
946- File . open ( "config/database.yml" , "w" ) do |file |
947- file . puts <<~DATABASE_YML
948- <%
949-
950- require 'cgi'
951- require 'uri'
952-
953- begin
954- uri = URI.parse(ENV["DATABASE_URL"])
955- rescue URI::InvalidURIError
956- raise "Invalid DATABASE_URL"
957- end
958-
959- raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"]
960-
961- def attribute(name, value, force_string = false)
962- if value
963- value_string =
964- if force_string
965- '"' + value + '"'
966- else
967- value
968- end
969- "\# {name}: \# {value_string}"
970- else
971- ""
972- end
973- end
974-
975- adapter = uri.scheme
976- adapter = "postgresql" if adapter == "postgres"
977-
978- database = (uri.path || "").split("/")[1]
979-
980- username = uri.user
981- password = uri.password
982-
983- host = uri.host
984- port = uri.port
985-
986- params = CGI.parse(uri.query || "")
987-
988- %>
989-
990- <%= ENV["RAILS_ENV"] || ENV["RACK_ENV"] %>:
991- <%= attribute "adapter", adapter %>
992- <%= attribute "database", database %>
993- <%= attribute "username", username %>
994- <%= attribute "password", password, true %>
995- <%= attribute "host", host %>
996- <%= attribute "port", port %>
997-
998- <% params.each do |key, value| %>
999- <%= key %>: <%= value.first %>
1000- <% end %>
1001- DATABASE_YML
1002- end
927+ def purge_bundler_cache ( stack = nil )
928+ @bundler_cache . clear ( stack )
929+ bundler . install
1003930 end
1004931end
0 commit comments