Skip to content

Instantly share code, notes, and snippets.

View mtrense's full-sized avatar

Max Trense mtrense

  • Frankfurt, Germany
View GitHub Profile
class Test
def initialize(attributes = {})
attributes.each do |name, value|
send "#{name}=".to_sym, value
end
end
attr :test1, :test2
@mtrense
mtrense / Rakefile
Last active November 10, 2022 18:37
Dynamically create Rake tasks for all Dockerfiles (following the convention "<name>.Dockerfile") in the current directory
require 'rake/file_list'
IMAGES = Rake::FileList['*.Dockerfile'].collect {|f| f[/.+(?=\.Dockerfile)/] }
namespace :images do
IMAGES.each do |name|
desc "Build image '#{name}'"
task "build_#{name}" do
sh "docker build -f #{name}.Dockerfile -t mtrense/#{name} ."
end