Interfaces/Default-Definitions for YAML files - interface

I have a configuration file and want to standardize the keys.
So when other developers create their own configurations, they will be validated.
When using programming languages you use interfaces.
I also know that somehow some YAML-based Tools like Ansible also have defaults/definitions to ensure you are writing your stuff correctly. But as far as I know, they also work with addons and such...
So is there are a way to achieve this kind of effect in YAML files?
I mean I could programmatically validate it somehow, but maybe there is something better.

You have two options:
Use JSON Schema. Some editors and validators offer direct YAML support, for others you need to transform the YAML to JSON first to validate (which can be done automatically). See implementations. This will restrict you to use only features available in JSON (e.g. no complex keys, anchors & aliases being resolved etc).
Use the target type as schema. YAML is a serialization language, this means that the native type in the programming language of your choice serves as schema. This obviously doesn't work well in languages with dynamic typing, like Python or JavaScript. It does work in Java (via SnakeYAML), C# (via YamlDotNet) and others. You don't get automatic editor support but you can write a small validator tool and even writing a validator tool for your favorite editor is simple today with LSP.
Ansible (and lots of other YAML-based frameworks) isn't really a good example because it uses Jinja on top of YAML and therefore is far more complex to validate.

Related

configuration management tool to automate the property files

Any configuration management tool in the market to automate the property file for the different environments, lets say i have one complete configuration files with key and values but for the other environments the values will differ so am just trying to look out if this could be done easily like template or csv or any other valuable approach.
You can use Sparrow6 automation DSL to populate configuration files using embedded templater. You can go even further and utilize Tomtit task runner that integrates with Sparrow6 and provides environments feature for these very types of tasks.
You can try https://microconfig.io
It is designed to solve the configuration problem you’re describing.
It supports properties and yaml format.

Goto definition like feature in custom (user-defined) language in notepad++

Is there any way (by means of plugins or settings) to create (by that I mean modifying, adding & deleting) custom tags in notepad++?
By tags I mean, to jump to the definition of an instance used anywhere in project (some kind of like 'goto definition' function like we have in other popular languages like C, C++, C#).
I searched for this topic but could not find satisfactory result.
My requirement:
I have created a custom language in Notepad++ (by adding keywords, coloring patterns and other rules). Now I need the way to add custom tags for this language. How can I achieve this?
With the help of tags I should be able to navigate to definition (just like goto definition in other popular languages) in the particular project (all files in project or at least opened files).
Now I need the way to add custom tags for this language. How can I achieve this?
If you're using Exuberant Ctags you can configure a new language definition using just a handful of regular expressions.
For example this link shows how to configure ctags for the Clipper language using this regexp approach:
I have just had to deal with essentially the same issue. I am using Notepad++ with a legacy codebase written in a custom markup language. Each file can contain cross references to definitions in other files, so a way of jumping to the definition would be very useful.
It has not been easy to find a solution that meets all four requirements: a goto definiton feature that works across multiple files and for a custom language in Notepad++. I found this question while searching for a solution; the answer jussij provided is good but it does not really provide a complete solution.
I ended up using the SourceCookifier plugin with a custom language definition. There is not a huge amount of guidance online about how to use it, but once installed you can use it to manually create a language definition using regex rules.
SourceCookifier will work for your language if you can configure the following:
A set of file extensions used by the language
A set of tag types (i.e. a function, class, variable)
A set of POSIX Basic Regular Expressions for locating each tag type, see this post
Once a language has been defined, you can highlight any instance of a found tag and use the shortcut Ctrl+Shift+Enter to jump to the definition of that tag. This can work across a whole codebase of files if you provide it with a list of files to inspect, it calls this a 'session'. All you need to do is drag and drop your codebase folder into the SourceCookifier sidebar window. The codebase I was working with is very large, so I am only using basic functionality, see this post for a good explination of that. The goto definition shortcut can also be added to a right-click context menu, see this post.

Manage poedit synchronization with sources for multiple languages, command-line

I am using poedit to manage gettext translations in a php project. There are many people contributing to the project and each time some new language strings are added, I need to run poedit and synchronize with source for each language available, so that translators can then translate the language files. My questions are:
a) Do I have to do this every time for each language, or is there an easier way?
b) Is there a way to do this from command-line (so I can add it to a cron job for example)?
Thanks in advance
If this is a pure Gettext project, i.e. not relying on custom extraction provided by poedit then:
Yes you do need to do this every time for each language. But you could choose to use xgettext and create a POT file. Give the POT file to translators who can then do the updates themselves. I think poedit can update from a template within the UI.
You could do this yourself on the command line using xgettext to update your POT file. Then msgmerge to update each individual language file. But then you need to communicate with your translators as they might have been translating the file that you have just updated for them.
From a translators perspective you should try to limit your string churn and create a concept of a string freeze. To have to retranslate things is quite time consuming for translators and as you've discovered for yourself.

Computer-assisted translation for GWT recommendations

We are looking for a suitable solution to translate our GWT application collaboratively. We have a bunch of constants and messages property files that need to be translated by different people. Till now we've emailed the files and manually merged the translated content back which obviously doesn't scale very well.
Is there any tool (preferably an open source project) you can recommend that does play well with the i18n support of GWT and allow for collaboratively translation?
There is a Google Language API for GWT
I hope this doesn't sound like spam, but we built Amanuens, which is a web-based tool designed exactly to solve the problems you're having.
I'm not into GWT, but I assume that you have .properties files. If so, then our solution should work fine (although it's not open source).
It doesn't look like there is a GWT optimized solution for supporting the translation process of .properties files.
We are currently evaluating Pootle. It is easy to use (especially for non-techies), supports the translation process in many ways, supports user management, is open source and lets you import and export property files easily (which is important for integrating with GWT).

any way to synchonise between Redmine(or other issue trackers) and a plain text todo list?

I would like to access a Redmine taskbase via a simple text based interface - wondering what the shortest path would be (minimum investment/development).
Right now, this boils down to 2 use cases/phases:
Import a batch of tasks into Redmine from simple, wiki-based, bulletted TODO list, ie. plain text content. This is more of a one-off task, so a quick and dirty solution would be fine.
Later, some smooth two-way synchrosation would be great.. E.g. edit loads of tasks via some friendly plain text (or XML) in an editor, or scripting where I could manipulate all of them with simple text processing; then synchronise with Redmine and commit them back.
Any ideas on the easiest way to achieve these?
I'd prefer an external solution (i.e not touching the server), especially for the one-off import case; something like a neat IDE/editor/client, or a standalone Ruby script (e.g using the RM API).
If an appropriate RM plugin would be available, I would not resist giving it a try (can get root access from our lovely IT support:)..
Current ideas:
Emacs/Org-mode, looks like a great combination of a cool task manager UI and full plain text power. It seems rich enough to capture tags, states as well. This artice looks promising Orgmode and Roundup: Bridging public bugtrackers and local tasklists, although not exactly a perfect match.
org-mode parser in Ruby, could be used in an script with redmine-api access, or - worst case(for me, right now)- in newly developed RM plugin.. This looks like a good start: org-ruby
export RM->XML, process file, import XML->RM... not sure if this is supported?
I guess it's always possible to talk to the DB directly, but I'd prefer to avoid that.
Actually, I'm also interested a similar solution for Bugzilla.
At the simplest level, you could write a RM/Rails plugin that parses an Org-Mode task list, updating corresponding issues in the RM Model.
Equally, you can build a view for Redmine (again as a Rails plugin) to generate an org list of the current (or subset of) issues.
For Bugzilla I think you would be best off using the XML-RPC interface to do your issue comparison/update sync, so you'd have to take a very different approach from Redmine.
If you have any specific questions, please update your question, it's quite broad at the moment.
Update
At the moment, there are a few plugins which will probably help you figure out your solution, for example Nick Boltons xml import and Martin Liu's Redmine CSV Import Plugin but neither of these are going to completely solve the problem for you, just give you some useful starting point.
On the other hand, If you write a script that interacts with Redmine's REST api, you don't need it to be in any specific lanugage, in fact you could do it in Emacs-lisp, if the target users of the script are all Emacs aware, then this might well be the best way to do the job. (it would certainly be the most appealing option to me.)
Maybe this can be useful: https://github.com/fukamachi/redmine-el