adamralph / scriptcs-nancy

Nancy Script Pack for scriptcs
MIT License
34 stars 5 forks source link

Find module files by convention #13

Open adamralph opened 11 years ago

adamralph commented 11 years ago
modules
  foo.csx
  Bar.dll
views
  ...
nancy.csx

Require<NancyPack>().Host(); picks up and registers the modules.

Conventions, including host prefix etc., can be overridden/extended with nancy.yml.

Think > rails server/> scriptcs nancy :wink:.

Goodbye IIS and windows services, hello write code and xcopy.

adamralph commented 11 years ago

Depends on https://github.com/scriptcs/scriptcs/issues/243

glennblock commented 11 years ago

We need to think if we really want to do this. This is going to take a lot of rework.

glennblock commented 11 years ago

What we could do, which we do not today is allow you to dynamically inject script / files from a script pack. Then you could implement in the script pack your own convention based scanning logic, find the files you want by reading your yml file and matching on conventions. Then you can pass in those filenames similar to the way you pass references or using statements.

Would that work for you?

glennblock commented 11 years ago

I prefer to do it this way and not bake any convention based mechanism in.

adamralph commented 11 years ago

I never thought this would be something for scriptcs... This would be something purely existing within the nancy script pack. All I need is for https://github.com/scriptcs/scriptcs/issues/243 to implemented

adamralph commented 11 years ago

I.e. exactly what you said two comments back

glennblock commented 11 years ago

OK, I guess the snippets were throwing me off.

so I think what we could do is expose a collection of scripts on the script pack context. The collection could either be filenames or loose script.

Then during initialization when we import the usings and add references we also merge in the scripts.

It would just be a flat merge in that case as you can add references and usings programatically.

Does that work?

adamralph commented 11 years ago

Moved the thread to https://github.com/scriptcs/scriptcs/issues/243#issuecomment-17783108