sublime text build system for jekyll - ruby

I'm trying to get a build system for the Jekyll gem in sublime text. In my sublime-project I have the following:
"build_systems":
[
{
"name":"jekyll",
"cmd":"/Users/kaass/.rvm/gems/ruby-1.9.3-p327/bin/jekyll",
"shell":true,
"path":"/Users/kaass/.rvm/bin/rvm-auto-ruby",
"working_dir":"$project_path"
}
]
I have tried playing around with env as well as different options above, but always get some sort of error pertaining to ruby or jekyll not found or env: ruby_noexec_wrapper not found
I'm running 10.8.2 and my path :
kaass:~ kaass$ echo $PATH
/Users/kaass/.rvm/gems/ruby-1.9.3-p327/bin:/Users/kaass/.rvm/gems/ruby-1.9.3-p327#global/bin:/Users/kaass/.rvm/rubies/ruby-1.9.3-p327/bin:/Users/kaass/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/bin:/usr/X11R6/bin
Everything I'm trying to call is already in my path.

I had a similar problem running rake within the correct rvm environment.
This is the sublime-project file I ended up with:
{
"folders":
[
{
"path": "data"
}
],
"build_systems":
[
{
"name": "rake",
"cmd": "source ~/.rvm/environments/ruby-1.9.3-p194#mygemset && rake",
"shell": true,
"path": "/bin:/usr/bin:/usr/local/bin:~/.rvm/bin",
"working_dir": "$project_path"
}
]
}
The trick was to add ~/.rvm/bin to the path and to source the environment of the rvm gemset.
Then I can even use the "rake" command without specifying a full path.
The rest is straight-forward.

Related

Chef::Exceptions::nginx didn't start when installing nginx-1.16.1 from source

I am trying to install nginx from source , My requirement is to install specific version of nginx i.e., 1.16.1 because of which i am downloading from source.
After running installNginx.rb , i see nginx.conf file got updated with default nginx configs , but nginx -v says command not found.
below is my configuration -
installNginx.rb
include_recipe 'nginx::source'
begin
t = resources(:template => 'nginx.conf')
t.source 'nginx.conf'
t.cookbook 'my_nginx'
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "Could not find template nginx.conf to modify"
end
service 'nginx' do
action :restart
end
attributes/Source.rb
node.default['nginx']['source']['version'] = '1.16.1'
node.default['nginx']['source']['url'] = 'http://nginx.org/download/nginx-1.16.1.tar.gz'
node.default['nginx']['source']['checksum'] = 'f11c2a6dd1d3515736f0324857957db2de98be862461b5a542a3ac6188dbe32b'
metadata.rb
depends 'nginx'
After analysing what I observed on cookbook logs is: The source version I gave is 1.16.1 but for some reason, the nginx::source recipe is pulling in 1.12.1 and nginx is not starting
"nginx": {
"version": "1.12.1",
"package_name": "nginx",
"port": "80",
"dir": "/etc/nginx",
"script_dir": "/usr/sbin",
"log_dir": "/var/log/nginx",
"log_dir_perm": "0750",
"binary": "/opt/nginx-1.12.1/sbin/nginx",
"default_root": "/var/www/nginx-default",
"ulimit": "1024",
"cleanup_runit": true,
"repo_source": "nginx",
"install_method": "package",
"user": "webadmin",
"upstart": {
"runlevels": "2345",
"respawn_limit": null,
"foreground": true
}
"init_style": "init",
"source": {
"version": "1.16.1",
"prefix": "/opt/nginx-1.12.1",
"conf_path": "/etc/nginx/nginx.conf",
"sbin_path": "/opt/nginx-1.12.1/sbin/nginx",
"default_configure_flags": [
"--prefix=/opt/nginx-1.12.1",
"--conf-path=/etc/nginx/nginx.conf",
"--sbin-path=/opt/nginx-1.12.1/sbin/nginx",
"--with-cc-opt=-Wno-error"
],
"url": "http://nginx.org/download/nginx-1.16.1.tar.gz",
"checksum": "f11c2a6dd1d3515736f0324857957db2de98be862461b5a542a3ac6188dbe32b",
"modules": [
"nginx::http_ssl_module",
"nginx::http_gzip_static_module"
],
INFO: remote_file[nginx source] created file /var/chef/runs/58bffee4-b5aa-4632-97cd-0eeacc4ebd4c/local-mode-cache/cache/nginx-1.16.1.tar.gz
INFO: remote_file[nginx source] updated file contents /var/chef/runs/58bffee4-b5aa-4632-97cd-0eeacc4ebd4c/local-mode-cache/cache/nginx-1.16.1.tar.gz
I am unable to figure out where the issue is, any help is appreciated.
The attributes file in the nginx cookbook refers to the default version in multiple places. For example, it uses the default version to define the directory where nginx is installed to as well as download URL for the nginx sources as
default['nginx']['source']['prefix'] = "/opt/nginx-#{node['nginx']['source']['version']}"
default['nginx']['source']['url'] = "http://nginx.org/download/nginx-#{node['nginx']['source']['version']}.tar.gz"
Thus, if you later update the version attribute in your own cookbook, the download URL will not automatically be updated with the new version since it has no reference to it anymore.
To resolve this, you have two options
You can manually set all related attributes in your cookbook. This is likely error-prone and may lead to inconsistencies as you have seen.
You can reload the default nginx attributes file after having set the overridden attributes. This can look like this in your attributes file:
override['nginx']['version'] = '1.16.1'
override['nginx']['source']['checksum'] = 'f11c2a6dd1d3515736f0324857957db2de98be862461b5a542a3ac6188dbe32b'
# Reload nginx::source attributes with our updated version
node.from_file(run_context.resolve_attribute('nginx', 'source'))
Note that the nginx cookbook maintains two nginx versions: node['nginx']['version'] and node['nginx']['source']['version'], with the latter value being set to the former value by default.
In your ohai output, you have only seen the node['nginx']['version'] attribute (which you have not overridden).
By overriding this attribute and reloading the attributes/source.rb file as shown about, things should be consistent again.

How do I setup YAML linting in Arcanist?

I can't figure out how to do custom linting pre-diff in Arcanist (YAML, specifically). The instructions don't explain how to integrate a new linter into my existing .arclint configuration.
I figured this out on my own, and thought I'd share here in case anyone else has this issue.
The following .arclint file does the trick:
{
"linters": {
"yaml": {
"type": "script-and-regex",
"script-and-regex.script": "yamllint",
"script-and-regex.regex": "/^(?P<line>\\d+):(?P<offset>\\d+) +(?P<severity>warning|error) +(?P<message>.*) +\\((?P<name>.*)\\)$/m",
"include": "(\\.yml$)",
"exclude": [ ]
}
}
}
I haven't extensively tried out that regex, but it works for my purposes so far.
You can configure Yamllint by populating a .yamllint file in the repository root.

Brew available files for different macOS version

Take install Python for example.
==> Installing opencv dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.tar.gz
The brew SW download the one that's matched with my current macOS version as default. (In this case, it's for high_sierra (10.13.x) macOS).
But I'd like to get other build version for previous macOS version (e.g. 10.10.x).
I notice that the SW that's all downloaded from https://homebrew.bintray.com/bottles/.
But unfortunately, I can't view the available files under the https://homebrew.bintray.com/bottles/ path.
Is there a command to view available files (e.g. Python) for different macOS version ?
You can use either brew info --json=v1 <formula> or Homebrew’s public JSON API:
$ brew info --json=v1 python | jq .
[
{
"name": "python",
"desc": "Interpreted, interactive, object-oriented programming language",
"homepage": "https://www.python.org/",
// ...
"bottle": {
"stable": {
// ...
"files": {
"high_sierra": {
"url": "https://linuxbrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz",
"sha256": "7e0fc1b078b51d9478ab08660d5df01611976a7af0f6c24054bda58264bb506c"
},
"sierra": {
"url": "https://linuxbrew.bintray.com/bottles/python-3.6.5.sierra.bottle.1.tar.gz",
"sha256": "2fe5ca9be0f1596798927c4aa1d4d187ca7f83adc4681483cec2cc52d7c95386"
},
"el_capitan": {
"url": "https://linuxbrew.bintray.com/bottles/python-3.6.5.el_capitan.bottle.1.tar.gz",
"sha256": "bccf50de973644608af29652f2660124d033f3213d422fe44a7f012a47643a95"
}
}
}
},
// ...
]
Using jq:
$ brew info --json=v1 python | jq -r '.[]|.bottle.stable.files[]|.url'
https://linuxbrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.el_capitan.bottle.1.tar.gz
Note it works with multiple formulae:
$ brew info --json=v1 python git | jq -r '.[]|.bottle.stable.files[]|.url'
https://linuxbrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.sierra.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/python-3.6.5.el_capitan.bottle.1.tar.gz
https://linuxbrew.bintray.com/bottles/git-2.17.1.high_sierra.bottle.tar.gz
https://linuxbrew.bintray.com/bottles/git-2.17.1.sierra.bottle.tar.gz
https://linuxbrew.bintray.com/bottles/git-2.17.1.el_capitan.bottle.tar.gz

Message appears when running scsslint

I am following the step by step on https://www.npmjs.com/package/grunt-scss-lint
I have installed everything, and seems to be working fine when I type in Terminal 'scss-lint'.
However I want this to be running in Grunt
Gruntfile:
scsslint: {
allFiles: [
'src/scss/**/*.scss',
],
options: {
bundleExec: true,
config: '.scss-lint.yml',
reporterOutput: 'scss-lint-report.xml',
colorizeOutput: true
}
},
grunt.registerTask('default', ['js', 'html', 'scsslint',]);
so I type in grunt in terminal which will run the tasks and in terminal - this pops up:
Running "scsslint:allFiles" (scsslint) task
Running scss-lint on allFiles
Please make sure you have ruby installed: ruby -v
Install the scss-lint gem by running:
gem update --system && gem install scss-lint
Running through grunt does not work but typing scss-lint in terminal works.
I did the following message but this message does not disappear
Your problem is related to the bundleExec parameter. If you set it to true, the plugin will expect the gem to be installed via bundler.
Set it to false, and it will work.
scsslint: {
allFiles: [
'src/scss/**/*.scss',
],
options: {
bundleExec: false,
config: '.scss-lint.yml',
reporterOutput: 'scss-lint-report.xml',
colorizeOutput: true
}
},
grunt.registerTask('default', ['js', 'html', 'scsslint',]);

How can I make a Sublime Text project file to only show certain folders?

SublimeText has a project-settings file that includes a folder_include_patterns option.
I have a folder called (my app name).project-settings (which according to some research, is the correct name for the file) in the top level of my project. I am trying to make Sublime not show all the files under node_modules except my-module:
{
"folders": [
{
"path": "node_modules",
"folder_include_patterns": [
"my-module"
]
}
]
}
However SublimeText still shows all the files under node_modules. How can I make a Sublime Text project file to only show certain folders?
I assume you don't want to ignore all the other modules in node_modules.
You could ignore your node_modules directory and include your module as another folder.
{
"folders":
[
{
"folder_exclude_patterns":
[
"node_modules",
],
"path": "."
},
{
"path": "node_modules/mymodule"
},
]
}
My syntax is correct, but making the file isn't enough to make a dir into a project.
Since there is no 'new project' button in Sublime, you can make a folder with:
Open the folder in Sublime.
Click Project > Save Project As
This makes:
your_project.sublime-project
{
"folders": [
{
"path": "."
},
{
"path": "node_modules",
"folder_include_patterns": [
"my-module"
]
}
]
}
your_project.sublime-workspace (left as defaults)
Additionally: you must open the project from the Project menu (otherwise it will still be a folder and ignore the .sublime-project file).

Resources