Yeoman CLI tool enforce default options - yeoman

I'm using yeoman cli tool to install a custom generator, I would like to call it from a gui application where the user could choose option using a window with some options.
I want to pass this options colect from windows and pass this to the yeoman CLI in order to not having interation between the command line and the user. Or a second options in run the generation without any options forcing the generator to assume all the default values.
Who I can achive that? I'm finding for a flag to force the default value or a way to passing answers from a JSON file.

I've discovery this tool that allow us run the yeoman generator in silent mode, you could define your answers in a configuration file.
https://www.npmjs.com/package/yeoman-gen-run

Related

I want to enable 'Allowsignup' option by default in Jenkins

I have a groovy file that runs at the time of deployment to create predefined admin users for jenkins. I would like to add a logic here that would enable the allowsignup option. By default the option is disabled.
First I tried making changes in the config.xml file hoping that when I'd restart jenkins it would enable the option but that didn't work.
Now I'm suspecting that maybe I need to make changes via a groovy file using the hudson.security.HudsonPrivateSecurityRealm module, but I'm not exactly sure how to go about doing this.
I am also not sure whether this is possible or the option can only be enabled via UI.

How do I use both the --save-storage feature to save auth while using a custom setup?

On this page, Playwright recommends to use the --save-storage option with Codegen in order to save the auth state.
It also recommends just below to run a JS script instead of calling Codegen in CLI if we want to use a custom setup.
Now, I need to do both, i.e. save the auth state AND run a custom setup. But I can't find a way to do that in the documentation.

Set Jenkins build cause manually via REST API

I'm looking to update the default build cause when invoking a build via the REST API. I see that this is possible by appending the cause parameter when using the Trigger builds remotely (e.g., from scripts) option, but what about when I make a /build POST request using the normal user:apiToken format?
Essentially I'm looking to replace Started by user xxxx with a custom string. I'll also accept plugin recommendations as a fallback if this isn't possible by default.

Custom environment variable

Is it possible to set a custom environment variable, which will be accessible from any other plugin, the same way as $platform and $path works?
There is a package EnvironmentSettings by Daniele Niero, but it seems my task is simpler and therefore there is a probablity that there is no need to dive deep into its code.
In Sublime, any plugin can modify the global process environment through os.environ from the Python run time. All plugin code runs under the same process, so once one plugin sets an environment variable, any other plugin could access it. I would imagine that this is how the package that you linked to in your question modifies the environment.
A simple example of this in action can be found in Default/exec.py which you can open by using View Package File from the command palette. In the __init__ method of AsyncProcess() there is code that modifies the Sublime process environment if you pass the path argument in your sublime-build file.
A simple example that you can run from the Sublime console would be the following snippet. Once you execute that code, any plugin that you create can access os.environ["MY_VARIABLE"] to see the value.
import os
os.environ["MY_VARIBLE"]="Some Value"
With that said, in Sublime $platform is not an environment variable, it's a special variable that Sublime knows how to expand itself which is divorced from the system environment outlined above.
A complete list of such variables can be viewed by executing the following code from the Sublime console:
from pprint import pprint
pprint(window.extract_variables())
The list of variables you get and their content depends on application state (platform, whether there is currently a project open in the window, the current file, etc).
The names of the variables that this returns are hard coded in the Sublime core and can't be augmented, so if you wanted extra variables here you would need to communicate that to other plugins and they would have to be modified to know how to use them.
From the sounds of what you're trying to accomplish in the comments on your question, what you want might be a sublime-settings file that contains a setting that specifies the directory to use for file actions in your custom plugins. If they all load the settings file to get the path you can modify the location in the config and have it take effect immediately. Alternatively you could do something like a top level module variable in one plugin and import it into the others.

Set a file path from Jenkins' choice parameter

I struggled few days, But still, I could not find a solution for this.
I am trying to deploy Marathon apps with Jenkins and follow this tutorial.
https://docs.mesosphere.com/1.10/tutorials/deploy-on-marathon/
I want to configure a parameterized project for this. Eg :
Builder can select one choice out of four choices.
As an Example: Suppose the user has selected the vault option.
Then I need to change the file name(Definition File) base on what user has selected on above options.
I am using Marathon deployment plugin.
For this configs I am getting below error :
18:12:40 [Marathon] Application Definition not found:
18:12:40 [Marathon] Could not find file 'deployment_files/"($CONTAINER)".json'
18:12:40 Build step 'Marathon Deployment' changed build result to FAILURE
Could you please help me to achieve this problem or suggest a better way to do this?
When referencing a build parameter in another setting (or another parameter) the way you are trying to, I typically use the following format:
deployment_files/${CONTAINER}.json
There is some good reading to be done in the following thread on using $VAR vs ${VAR}

Resources