lib/geny/actions/templates.rb in geny-2.5.0 vs lib/geny/actions/templates.rb in geny-2.5.1
- old
+ new
@@ -21,11 +21,11 @@
# @example
# templates.copy("hello.erb", "hello.txt")
# templates.copy("hello.erb", "hello.txt", locals: {name: "world"})
def copy(source, *args, **opts)
source = expand_path(source)
- context, opts = build_context(opts)
+ context, opts = build_context(**opts)
TTY::File.copy_file(source, *args, context: context, **opts)
end
# Copy a template directory. All files will be evaluated with ERB.
# All command-line options and helper methods are available in
@@ -34,11 +34,11 @@
# @example
# templates.copy_dir("boilerplate", output)
# templates.copy_dir("boilerplate", output, locals: {name: "world"})
def copy_dir(source, *args, **opts)
source = expand_path(source)
- context, opts = build_context(opts)
+ context, opts = build_context(**opts)
TTY::File.copy_dir(source, *args, context: context, **opts)
end
# Render an ERB template. All command-line options and helper
# methods are available in the template.
@@ -47,10 +47,10 @@
# templates.render("hello.erb")
# templates.render("hello.erb", locals: {name: "world"})
def render(path, **opts)
path = expand_path(path)
input = File.binread(path)
- context, _opts = build_context(opts)
+ context, _opts = build_context(**opts)
erb = ERB.new(input, nil, "-", "@output_buffer")
erb.result(context.instance_eval("binding"))
end
private