torba icon indicating copy to clipboard operation
torba copied to clipboard

Torbafile nesting

Open N0xFF opened this issue 6 years ago • 3 comments

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

N0xFF avatar Aug 28 '18 01:08 N0xFF

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/
  ]

nashbridges avatar Aug 28 '18 08:08 nashbridges

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.

N0xFF avatar Aug 29 '18 07:08 N0xFF

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.

nashbridges avatar Aug 29 '18 07:08 nashbridges