Build system for typescript using different flags - sublimetext2

I want to use different flags (sourcemap, out, target) that the typescript compiler provides. I am trying to define a build system in sublime 2 but unable to do so.
Have already read this question.
basically i want to do something like the following
tsc src/main/ts/myModule.ts --out src/main/js/myModule.js --sourcemap --target ES5

Just add them to the cmd array
{
"cmd": ["tsc","$file", "--out", "src/main/js/myModule.js"],
"file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
"selector": "source.ts",
"osx": {
"path": "/usr/local/bin:/opt/local/bin"
}
}

First of all let me say that I'm using Sublime Text 3 on Windows and Typescript 1.0.
I don't think that SublimeText2 is so much different, though...
If you're on similar conditions, take a look at my current configuration file:
{
"cmd": ["tsc", "$file"],
"file_regex": "(.*\\.ts?)\\s*\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(.+?)$",
"selector": "source.ts",
"windows": {
"cmd": ["tsc.cmd", "$file", "--target", "ES5"]
}
}
Please notice that I tweaked the regex so that it matches the TSC error format (and brings you to the line containing the error when you double click it from the error log...)
Besides of that, I think that the real command-line which gets run is the lower one: as a matter of fact I had it working only placing the options down there... (in this specific case I'm asking an ES5 compilation type, your parameters will differ).
This suppose you have a tsc.cmd avaliable on path; if not, put the full path of tsc.cmd or tsc.exe instead of "tsc.cmd" and be sure to escape backslashes \ as \\...
This works in my situation, maybe in other contexts they should also be placed on the first line...
Hope this helps :)

Related

Using jq to edit key:value in a .conf file from shell

I'm trying to write a shell script that passes an env variable into a .conf file so that I can manipulate the log_file and log_level keys programatically.
Actual file as station.conf
{
"SX1301_conf": {
"lorawan_public": true,
"clksrc": 1,
"radio_0": {
"type": "SX1257",
"rssi_offset": -166.0,
"tx_enable": true,
"antenna_gain": 0
},
"radio_1": {
"type": "SX1257",
"rssi_offset": -166.0,
"tx_enable": false
}
},
"station_conf": {
"log_file": "stderr",
"log_level": "DEBUG",
/* XDEBUG,DEBUG,VERBOSE,INFO,NOTICE,WARNING,ERROR,CRITICAL */
"log_size": 10000000,
"log_rotate": 3,
"CUPS_RESYNC_INTV": "1s"
}
}
I wanted to test manually before passing shell variables so I tried jq '".station_conf.log_level="ERROR"' station.conf, but I keep getting errors including shell quoting errors and invalid numeric literal errors (which btw, seems to be a open bug: https://github.com/stedolan/jq/issues/501)
Any tips on how to do this? Ideally I'd be able to replace log_level value with a $LOG_LEVEL from my env. Thanks!
Assuming the input is valid JSON, for robustness, you could start with:
jq '.station_conf.log_level="ERROR"' station.conf
To pass in a shell variable, consider:
jq —-arg v "$LOG_LEVEL" '
.station_conf.log_level=$v' station.conf
You are getting invalid numeric literal error because at least your example input is not valid json. As you can see, it contains /* comment */, which is not supported by jq. You have several options here.
keep using jq and make your input files valid json.
use another tool instead of jq, which support comments and/or other non-standard features.
If you choose second way, i.e. different tool, you can find some alternatives either on jq web page (https://github.com/stedolan/jq/wiki/FAQ#processing-not-quite-valid-json) or there is also scout (https://github.com/ABridoux/scout).

How can I use SublimeLinter jshint on different SyntaxDefinition?

I'm trying to write a Sublime Syntax Definition for ExtendScript but don't want to loose the possibility to use the SublimeLinter plugin. So how can I tell SublimeLinter that he should use jshint not only on scope source.js but also on my scope source.jsx?
Select Preferences->Package Settings->SublimeLinter->Settings - User and to add to it the following:
"sublimelinter_syntax_map":
{
"Python Django": "python",
"Ruby on Rails": "ruby",
"C++": "c"
"ExtendScript": "JavaScript"
}
and you should be all set. If it doesn't work, try changing JavaScript to all lowercase - the docs are a little unclear as to which is correct.

Assign syntax to a file without an extension in Sublime Text 2

I have a file Guardfile in my rails project, but appears just in plain text, so each time is opened it must be assigned the ruby syntax to display it correctly.
I cannot use Open all with current extension as... because it doesn't have an extension, but I suppose I could assign a specific syntax to a file without an extension because files like Gemfile, Capfile or Rakefile are displaying correctly.
How can I achieve this?
Menu: Preferences -> Browser Packages
Then open the file Ruby\Ruby.tmLanguage
Look up for this block:
<array>
<string>rb</string>
<string>rbx</string>
<string>rjs</string>
<string>Rakefile</string>
<string>rake</string>
<string>cgi</string>
<string>fcgi</string>
<string>gemspec</string>
<string>irbrc</string>
<string>capfile</string>
<string>Gemfile</string>
</array>
Add the new entry:
<string>Guardfile</string>
Install facelessuser / ApplySyntax. It has a built in rule for Guardfiles. It is also good for other random files that should be set as a certain syntax. For example, here is one I set up for a random file that should have Bash syntax.
"syntaxes": [
{
"name": "ShellScript/Shell-Unix-Generic",
"rules": [
{"file_name": ".*random$"}
]
}
]
The name value is the path to the tmLanguage file from Packages. ShellScript is the name of the Packages folder that the tmLanguage file is in. Shell-Unix-Generic is the tmLanguage file name.
For Sublime 3:
Commmand + Shift + p: set syntax ruby
Preference -> Settings - Syntax Specific
Add syntax like following:
{
"extensions": [
"Gemfile",
"Gemfile.lock",
"Podfile",
"Podfile.lock",
"Manifest.lock",
"Fastfile_helper",
"Fastfile",
"Appfile"
]
}
What really bad is that the syntax does not support fuzzy match, regex thing. This means you must list all the files.

Pry in SublimeREPL

Has anyone had any luck using swapping irb out for pry in SublimeREPL? I'm close, I think. I don't get an error however I don't get a response when I enter a command either. It behaves like the buffer is being reset each time I hit return.
I'm using rbenv and have set my SublimeREPL PATH as follows:
"default_extend_env": {"PATH": "{HOME}/.rbenv/bin:{HOME}/.rbenv/shims:{PATH}"}
Try putting Pry.config.auto_indent = false to your .pryrc
Besides Setting PATH in default_extend_env, you have to set GEMPATH as well. Here is my SublimeREPL setting:
{
"default_extend_env": {
"PATH": "{HOME}/.rbenv/shims:{PATH}",
"GEM_PATH": "{HOME}/.rbenv/shims"}
}
You can add the following code at the beginning of pry_repl.py to print out the PATH to check if your setting is in effect.
puts "PATH:#{ENV['PATH']}"
puts "GEM_PATH:#{ENV['GEM_PATH']}"
I use RVM and Ruby 2.1.2. I changed /Users/[my name]/Library/Application Support/Sublime Text 3/Packages/User/SublimeREPL.sublime-settings to:
default_extend_env":
{
"PATH": "/usr/local/bin/:{PATH}",
"GEM_PATH": "{HOME}/.rvm/gems/ruby-2.1.2/"
}
To get your GEM_PATH, type gem env and get path from "INSTALLATION DIRECTORY:" or go into pry and type ENV['GEM_PATH']

dpkg-shlibdeps: error: no dependency information found for

I'm compiling a deb package and when I run dpkg-buildpackage I get:
dpkg-shlibdeps: error: no dependency information found for /usr/local/lib/libopencv_highgui.so.2.3
...
make: *** [binary-arch] Error 2
This happens because I installed the dependency manually. I know that the problem will be fixed if I install the dependency (or use checkinstall), and I want to generate the package anyway because I'm not interested on dependency checking. I know that I can give to dpkg-shlibdeps the option --ignore-missing-info which prevents a fail if dependency information can't be found. But I don't know how to pass this option to dpkg-shlibdeps since I'm using dpkg-buildpackage and dpkg-buildpackage calls dpkg-shlibdeps...
I have already tried:
sudo dpkg-buildpackage -rfakeroot -d -B
And with:
export DEB_DH_MAKESHLIBS_ARG=--ignore-missing-info
as root.
Any ideas?
use:
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
if your rule file hasn't the dh_shlibdeps call in it. That's usually the case if you've
%:
dh $#
as only rule in it ... in above you must use a tab and not spaces in front of the dh_shlibdeps
If you want it to just ignore that flag, change the debian/rules line from:
dh_shlibdeps
to:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
Yet another way, without modifying build scripts, just creating one file.
You can specify local shlib overrides by creating debian/shlibs.local with the following format: library-name soname-version dependencies
For example, given the following (trimmed) ldd /path/to/binary output
libevent-2.0.so.5 => /usr/lib/libevent-2.0.so.5 (0x00007fc9e47aa000)
libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007fc9e4161000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fc9e3b1a000)
The contents of debian/shlibs.local would be:
libevent-2.0 5 libevent-2.0
libgcrypt 20 libgcrypt
libpthread 0 libpthread
The "dependencies" list (third column) doesn't need to be 100% accurate - I just use the library name itself again.
Of course this isn't needed in a sane debian system which has this stuff defined in /var/lib/dpkg/info (which can be used as inspiration for these overrides). Mine isn't a sane debian system.
Instead of merely ignoring the error, you might also want to fix the source of the error, which is usually either a missing or an incorrect package.shlibs or package.symbols file in package which contains the shared library triggering the error.
[1] documents how dpkg-shlibdeps uses the package.shlibs resp. package.symbols, files, [2] documents the format of the package.shlibs and package.symbols files.
[1] https://manpages.debian.org/jessie/dpkg-dev/dpkg-shlibdeps.1.en.html
[2] https://www.debian.org/doc/debian-policy/ch-sharedlibs.html
You've just misspelled your export. It should be like this:
export DEB_DH_SHLIBDEPS_ARGS_ALL=--dpkg-shlibdeps-params=--ignore-missing-info
dpkg-buildpackage uses make to process debian/rules. in this process, dpkg-buildpackage it might call dpkg-shlibdeps.
thus, the proper way to pass modify a part of the package building process is to edit debian/rules.
it's hard to give you any more hints, without seeing the actual debian/rules.
Finally I did it in the brute way:
I edited the script /usr/bin/dpkg-shlibdeps, changing this :
my $ignore_missing_info = 0;
to
my $ignore_missing_info = 1;
You can use this:
dh_makeshlibs -a -n
exactly after dh_install