Symfony 2 : Change the Target Directory in generate:bundle - symfony

Where is the file to change the config about the Target Directory?
When i create a bundle, it want to put it in app/cache instead of src. I'd like to configurate it to not have to change it everytime.
Sorry for my english.
Thanks for any answer.

As far as i know there is no config file for SensioGeneratorBundle.
Maybe you want to create a wrapper around the GenerateBundleCommand?
You could either create a custom Command in one of your bundles with a configuration option for the target directory and call generate:bunlde --dir=$directory inside YourCustomCommand::execute() or create a simple shell script.

Related

How to create tailwind.config.js in custom directory instead of root folder with init command

I am using below npx command to generate tailwind.config.js file, it is creating this file in root directory by default. I want to create it in custom /config folder. Could anyone please guide me.
Also wanted to know what all changes are needed for tailwind to work with config residing in custom folder.
npx tailwindcss init
Thanks in advance.
init command may accept one of these flags - -f to create full tailwind config and -p to create it with additional postcss.config.js. You may change directory and create config file there - not sure is it good for you or not
cd config && npx tailwindcss init
Every path within your config file is relative so pay attention at content section. Also your compiler as well must have correct path to config file, for example require('tailwindcss')('./config/tailwind.config.js') - but it depends in a way you compile styles

Devstack: tempest.conf file

I am new to devstack and was trying to understand the way it works. I have one question regarding generation of tempest.conf file. I can not understand how this file gets generated and which part of the code generates it.
Is it always generated into /opt/stack/tempest/etc/ directory. What if I have a different folder structure and I want to generate my tempest.conf file in suppose /opt/stack/new/tempest/etc/ directory.
Any help is appreciated, thanks.
First of all, Tempest framework in the OpenStack is works for openstack development. You can find it in github.
the tempest.conf file is the configuration file of Tempest, from the README.rst, you can know:
To start you need to create a configuration file. The easiest way to create a configuration file is to generate a sample in the etc/ directory
$ cd $TEMPEST_ROOT_DIR
$ oslo-config-generator --config-file \
tempest/cmd/config-generator.tempest.conf \
--output-file etc/tempest.conf
You can just modify the output file path in the --output-file param.

Installing Capistrano with a specific config dir

I have a Symfony2 application that I would like to deploy using Capistrano3. Performing cap install creates a config directory in the projectroot. To keep my project clean, I would like it to install the config dir into something like app\config\capistrano. Is this possible? I cannot find any hints in the documentations.
Found the anwser in a pull request on Github.
Enter the following two lines to your Capfile, before capistrano\setup beign called.
set :deploy_config_path, 'app/config/deploy.rb'
set :stage_config_path, 'app/config/deploy'
`
It is implemented in the 3.1.x branch
Look at your Capfile and change the path to the config file. This should be enough.

Create a File with Touch on a specific Directory

I want a create a file with a specific extension(.done). I am using the command touch. Something Like:
touch `basename $UNZIPFILE`".done"
It's creating the file but in current directory. I want to create this file in a specific directory. Is there a option to provide the directory ?
I checked : http://ss64.com/bash/touch.html , but could not figure out.
I can think of one option is before this command I can do a cd requiredDIR
Is there any other way, I can specify the Directory on the same command, so that I dont have to change the Directory?
Simply prepend the directory variable to the file you are touching.
touch "$MYDIR/$(basename $UNZIPFILE).done"
If the directory doesn't exist, you need to create it.
mkdir -p "$MYDIR" && touch "$MYDIR/$(basename $UNZIPFILE).done"
(It's also better to use $(command) syntax instead of backticks for command substitution.)

Location of configuration in unix program

I want to write a unix/linux program, that will use a configuration file.
My problem is, where should I put the location of the file?
I could "hardcode" the location (like /etc) into the program itself.
However, I would like it, if the user without privileges could install it (through make) somewhere else, like ~.
Should the makefile edit the source code? Or is it usually done in a different way?
Create some defaults:
/etc/appname
~/.appname
Then if you want to allow these to be overridden have your application inspect an environment variable. e.g.
$app_userconfig
$app_config
Which would contain an override path/filename.
Lastly add a command line option that allows a config to be specified at runtime, e.g.
-c | --config {filename}
It is common to use a series of places to get the location:
Supplied by the user as a command line argument (i.e. ./program -C path/to/config/file.cfg).
From an environment variable (char *path_to_config = getenv("PROGRAMCONFIG");).
Possibly look for a user specific or local version (stat("./program.cfg") or build up a strig to specify either "$HOME/.program/config.cfg" or "$HOME/.program.cfg" and stat that).
Hardcoded as a backup (stat("/etc/program/config.cfg",...)).
keeping a global config file under /etc/prgname is a standard. Also allowing a .local config file for individual users that will override the global settings would allow each user to personalize the program to their preference.
As skaffman says, the canonical locations for things like config files are specified in FHS. There appears to be a convention that a program will read a config file from the directory from which it is run as an alternative to the one in the hard-coded location. You may wish to consider adding a command-line switch that allows a user to specify an alternative config file location, as well.
The makefile shouldn't modify the source directly, but it can pass a folder path/name to the compiler through the -D option. One way to handle it would be to #define something like DEFAULT_PATH to be the default installation path. If the user wants to define a path, the makefile would add -DUSER_PATH=whatever to the compiler options. You would write your code to use USER_PATH if it exists, and DEFAULT_PATH otherwise.

Resources