torba
torba copied to clipboard
Torbafile nesting
Now we can create separated Torbafile, for example, <project>/shared/Torbafile
and include it via require
directive using relative path.
In <project>/Torbafile
:
#= require shared/Torbafile
Torbafile is evaled as regular Ruby source. Why do we need comment parsing then?
This variant passes the test:
instance_eval File.read(File.expand_path("../additionally/child", __FILE__))
gh_release "trumbowyg",
source: "torba-rb/Trumbowyg",
tag: "1.1.6",
import: %w[
dist/trumbowyg.js
dist/ui/trumbowyg.css
dist/ui/images/
]
You can add add syntax sugar of course:
torbafile "additionally/child"
gh_release "trumbowyg",
source: "torba-rb/Trumbowyg",
tag: "1.1.6",
import: %w[
dist/trumbowyg.js
dist/ui/trumbowyg.css
dist/ui/images/
]
Torbafile is evaled as regular Ruby source. Why do we need comment parsing then?
This variant passes the test:
instance_eval File.read(File.expand_path("../additionally/child", FILE))
gh_release "trumbowyg", source: "torba-rb/Trumbowyg", tag: "1.1.6", import: %w[ dist/trumbowyg.js dist/ui/trumbowyg.css dist/ui/images/ ]
It looks very unclear. Would be good to have syntax sugar for including nested files.
You can add add syntax sugar of course:
torbafile "additionally/child"
gh_release "trumbowyg", source: "torba-rb/Trumbowyg", tag: "1.1.6", import: %w[ dist/trumbowyg.js dist/ui/trumbowyg.css dist/ui/images/ ]
It works? I add this and test fails. Or I need to implement this?
Including via #= require
it's more obvious way to including files – Sprockets style. Users even don't need to read documentations or look at source code to guess to use it.
It works? I add this and test fails. Or I need to implement this?
Sorry, I was unclear in my previous comment.
Yes, the method torbafile
(or whatever you'll call it) doesn't exist yet. I don't mind if you implement it in this PR.
Including via #= require it's more obvious way to including files – Sprockets style.
If you like this name, you can even override require
, since it's also a Ruby method.