Skip to content

Commit

Permalink
upgrade ruby and platform-api
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishad Trivedi committed Apr 26, 2021
1 parent 4bcc0ae commit 4a4e848
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.10
2.4.10
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source 'https://rubygems.org'
ruby "2.1.10"
ruby '2.4.10'

gem 'platform-api'
gem 'pg'
Expand Down
48 changes: 31 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
domain_name (0.5.24)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
excon (0.45.3)
heroics (0.0.14)
erubis (~> 2.7.0)
excon (0.80.1)
heroics (0.1.2)
erubis (~> 2.0)
excon
moneta
multi_json (>= 1.9.2)
netrc
http-cookie (1.0.2)
webrick
http-accept (1.7.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
mime-types (2.5)
moneta (0.8.0)
multi_json (1.11.0)
netrc (0.10.3)
pg (0.18.1)
platform-api (0.2.0)
heroics (~> 0.0.10)
rest-client (1.8.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
moneta (1.0.0)
multi_json (1.15.0)
netrc (0.11.0)
pg (1.2.3)
platform-api (3.3.0)
heroics (~> 0.1.1)
moneta (~> 1.0.0)
rate_throttle_client (~> 0.1.0)
rate_throttle_client (0.1.2)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unf_ext (0.0.7.7)
webrick (1.7.0)

PLATFORMS
ruby
Expand All @@ -35,3 +43,9 @@ DEPENDENCIES
pg
platform-api
rest-client

RUBY VERSION
ruby 2.4.10p364

BUNDLED WITH
2.2.16
22 changes: 17 additions & 5 deletions bin/forkbak
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module Forkbak
end

def self.create_database
database_to_fork = heroku.config_var.info(ENV.fetch('FORK_FROM_APP'))['DATABASE_URL']
database_to_fork = heroku.config_var.info_for_app(ENV.fetch('FORK_FROM_APP'))['DATABASE_URL']
heroku.addon.create(ENV['APP'], {
plan: "heroku-postgresql:standard-5",
config: {
Expand All @@ -26,10 +26,10 @@ module Forkbak
end

def self.database_url(db_name)
return unless addon = heroku.addon.list(ENV['APP']).find {|a| a['name'] == db_name }
return unless addon = heroku.addon.list_by_app(ENV['APP']).find {|a| a['name'] == db_name }
return unless config_var = addon['config_vars'].first

heroku.config_var.info(ENV.fetch('APP'))[config_var]
heroku.config_var.info_for_app(ENV.fetch('APP'))[config_var]
end

def self.wait_for_database(db_name)
Expand Down Expand Up @@ -97,7 +97,7 @@ module Forkbak
end

def self.destroy_databases
heroku.addon.list(ENV.fetch('APP')).select do |addon|
heroku.addon.list_by_app(ENV.fetch('APP')).select do |addon|
addon['addon_service']['name'] == 'heroku-postgresql'
end.each do |addon|
heroku.addon.delete(ENV.fetch('APP'), addon['name'])
Expand Down Expand Up @@ -150,7 +150,7 @@ module Forkbak
end
end

def run
def run_old_method
start = Time.now
puts "Cleaning up leftover DBs"
Forkbak.destroy_databases
Expand All @@ -172,4 +172,16 @@ def run
end
end

def run
puts 'Testing heroku api'
h = Forkbak.heroku

database_to_fork = h.config_var.info_for_app(ENV.fetch('FORK_FROM_APP'))['DATABASE_URL']
puts "Database to fork: #{database_to_fork}"

addons = h.addon.list_by_app(ENV['APP'])
puts "List addons for #{ENV['APP']}"
puts addons
end

run

0 comments on commit 4a4e848

Please sign in to comment.