Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagemaru committed Nov 15, 2024
1 parent 1d16472 commit 1b9cacd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
5 changes: 3 additions & 2 deletions .docker/00-prepare-for-prod-dump.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CREATE DATABASE decidim_luzern_production;
CREATE ROLE postgres;
CREATE ROLE app;
CREATE DATABASE app;
CREATE ROLE postgres WITH LOGIN SUPERUSER PASSWORD 'postgres';
CREATE ROLE app WITH LOGIN SUPERUSER PASSWORD 'app';
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ GEM
cells-rails (0.1.5)
actionpack (>= 5.0)
cells (>= 4.1.6, < 5.0.0)
charlock_holmes (0.7.7)
charlock_holmes (0.7.9)
chef-utils (18.4.2)
concurrent-ruby
childprocess (4.1.0)
Expand Down Expand Up @@ -1052,4 +1052,4 @@ RUBY VERSION
ruby 3.0.6p216

BUNDLED WITH
2.5.5
2.5.23
47 changes: 28 additions & 19 deletions bin/bundle-binstub
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# this file is here to facilitate running it.
#

require "rubygems"
require 'rubygems'

m = Module.new do
module_function
Expand All @@ -18,45 +18,47 @@ m = Module.new do
end

def env_var_version
ENV["BUNDLER_VERSION"]
ENV.fetch('BUNDLER_VERSION', nil)
end

def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`

bundler_version = nil
update_index = nil
ARGV.each_with_index do |a, i|
if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
bundler_version = a
end
bundler_version = a if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
bundler_version = $1

bundler_version = Regexp.last_match(1)
update_index = i
end
bundler_version
end

def gemfile
gemfile = ENV["BUNDLE_GEMFILE"]
return gemfile if gemfile && !gemfile.empty?
gemfile = ENV.fetch('BUNDLE_GEMFILE', nil)
return gemfile if gemfile

File.expand_path("../Gemfile", __dir__)
File.expand_path('../Gemfile', __dir__)
end

def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
when 'gems.rb' then gemfile.sub(/\.rb$/, '.locked')
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
end

def lockfile_version
return unless File.file?(lockfile)

lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/

Regexp.last_match(1)
end

Expand All @@ -76,21 +78,30 @@ m = Module.new do
end

def load_bundler!
ENV["BUNDLE_GEMFILE"] ||= gemfile
ENV['BUNDLE_GEMFILE'] ||= gemfile

activate_bundler
end

def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
gem 'bundler', bundler_requirement
end
return if gem_error.nil?

require_error = activation_error_handling do
require "bundler/version"
require 'bundler/version'
end
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
return
end
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"

warn <<~WARN
Activating bundler (#{bundler_requirement}) failed:
#{gem_error.message}
To install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`
WARN
exit 42
end

Expand All @@ -104,6 +115,4 @@ end

m.load_bundler!

if m.invoked_as_script?
load Gem.bin_path("bundler", "bundle")
end
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ services:
- 5432:5432
volumes:
- pg-data:/var/lib/postgresql/data
#- ./.docker/00-prepare-for-prod-dump.sql:/docker-entrypoint-initdb.d/00-prepare-for-prod-dump.sql
#- ./.docker/database-init.sql:/docker-entrypoint-initdb.d/database-init.sql
- ./.docker/00-prepare-for-prod-dump.sql:/docker-entrypoint-initdb.d/00-prepare-for-prod-dump.sql
# - ./.docker/database-init.sql:/docker-entrypoint-initdb.d/database-init.sql
cache:
image: memcached:1.5-alpine
command: [ memcached, -l, '0.0.0.0', -p, '11211' ]
Expand Down

0 comments on commit 1b9cacd

Please sign in to comment.