www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dub. Mercurial (bitbucket.org). Projects deployment

reply "Uranuz" <neuranuz gmail.com> writes:
I have web-application project in D language hosted on 
bitbucket.org. So I using Mercurial repository. I exactly have 
two *logical* projects but currently they are in one repo. The 
first is my library that includes not only D code, but also some 
resources like HTML-page templates (not compiled vibe's diet 
templates), CSS and also some JavaScript code. The second project 
is website itself. It also has D sources, images, CSS's, js's, 
etc.

1. My goal is to separate this REPO into two: library and website 
that depends on library. Bitbucket has option for having several 
private repos for user, that are visible only to users from the 
list of invited users. I want to publish the library under some 
free license. But I don't want to publish web-site repository. 
It's offtopic question, but can you give some advice how I could 
handle this? May be someone read some pages in bitbucket doc and 
has link :)

2. For some time I used rdmd and some small shell script for 
building my web-site. And also I haven't built any ddoc coments 
but I faced with it's necessity now. rdmd takes only one input 
file and then search for all import directives recursively to 
find all other files to compile. Problem is that I want to pass 
some *.ddoc file with some DDOC macro to dmd but I don't' whether 
it's possible, because I can pass only 1 file to rdmd. How it 
could be solved?

3. Then I was thinking about using dub as long as it can 
automatically manage dependencies and it's higher level tool. And 
I can maybe pass *.ddoc file with general macro with 
*sourceFiles* (I'm not sure about this). But I think that dub 
doesn't support Mercurial and working with private repos. I can 
download project manually from Bitbucket. But it would be good to 
automate this. Not all programmers working with github and even 
git)) May be it should be solved somehow. I could participate in 
it but haven't contributed anything to D yet((. And also I don't 
know Mercurial and Bitbucket's API.

4. Another question about dub is how project structure looks like 
when I use some subprojects or libraries in my project. Examples 
in dub repository are very very simple and don't show advantages 
of dub over plain using of dmd or rdmd. So for now I don't 
understand the idea of this tool. Maybe some examples of *big and 
complicated* project would help. It would be better if it uses 
different sources for dependencies. I would like to see source 
from bitbucket.org, github.org, using binary libraries, local 
sources - all in one dub project)) This will show that this 
system is useful and tasty))

5. Also I would like to use dub for deployment some small 
projects: copy come files, create some folder structure, make 
some symbolic links, run *.css, *.js processing and minification 
tools, run some service daemon apps, etc. May be it can be 
handled with *preBuildCommands*, *postBuildCommands* directives 
for now and using some shell scripts or running deployment 
application on D))

P.S. It would be a plesure to see answers for all the items if 
possible, not only discussion around))
Jun 10 2014
parent reply "Uranuz" <neuranuz gmail.com> writes:
Also I have additional question to this post.
6. If I would convert my repo to git, but use anather hosting 
that github.org for example my own local server or bitbucket.org. 
How could I specify source for loading dependencies? This is 
unclear from dub documentation. Is it a tool for working with 
concrete web-repository?

7. Also I have a question about structure of folders that dub 
creates. I tried to implement example from vibed.org and created 
test web-server using dub. As I see dub is loading dependencies 
into ~/.dub (on Linux). In my application I have some resources 
that used by application at runtime. These are static data like 
*.html, *.css, images, *.js and other files that included in 
library tha I want to use in my application. What is a good 
approach? Create a separate working folder where I will copy all 
resource files or create symbolic links to folders or write paths 
to this library inside ~/.dup. This is all about general 
organization of project that is not considered very well in 
articles. And I don't know how it can be solved for projects on D 
language.
Jun 10 2014
parent "Uranuz" <neuranuz gmail.com> writes:
Thanks for all the answers)

8. I have another more simple question about rdmd utility. It 
takes one *.d file and searches for all dependencies. What if I 
need to pass independent *.d file or *.ddoc file directly to dmd 
compiler? How could I do that using dmd? I have no idea how I 
could include *.ddoc file with set of DDOC macroses. I have tried 
to use string mixin.

mixin(import("mysettings.ddoc"));

But I haven't succeed. My be compiler strips all the comments 
before mixing in or I doing something wrong. Another way is to 
use dmd.conf but I don't like this, because it's brutal way of 
doing so and as I think it's not compiler independent.
Jun 13 2014