Rails 5.2 Can't open rails credentials with Sublime Text - sublimetext3

I am using Windows Subsystem for Linux with Rails 5.2 and Sublime Text 3.
When i do
EDITOR="subl --wait" rails credentials:edit
It says "New credentials encrypted and saved." but does not open the file to be edited with Sublime Text 3.
Also when trying Visual Studio Code with
EDITOR="code --wait" rails credentials:edit
Visual Studio Code opens but it is empty.
I can only edit the file with VIM and the command
EDITOR="vim" rails credentials:edit
The thing is i do not want to edit the file with vim.
What is the problem so it does not open the file to be edited with Sublime or VS Code?
I am using Rails 5.2
Thanks a lot in advance

On macOS, you would run this command to edit the credentials in Sublime. When you are done, save and close the file in Sublime:
EDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" bin/rails credentials:edit

I am on windows 7x64 and stumbled upon this issue this morning.Solved it by adding atom to my system variable Path(so cmd & powershell & bash all know about it) and by adding powershell to my environment.I use separate environment for ruby & rails.
So now when I type set EDITOR=atom --wait && rails credentials:edit in cmd or
1st $env:EDITOR="atom --wait", 2nd rails credentials:editin powershell or
EDITOR="atom --wait" rails credentials:edit in bash,
I get the desired result wich is to open credentials and edit them :).. Hope this helps
PS. I didn't need to use --wait flag when setting the editor to subl or notepad!
EDITOR is just a temporary variable for the current session, meaning for the cmd,powershell or bash window that is opened at the moment!

By default Sublime Text Editor is not configured to be run directly from the command line. You're trying to set the EDITOR variable to "subl --wait", but the command line doesn't know what "subl" is! Try this post which goes into detail on setting up a "subl" alias for starting up sublime on the command line, then try again!
Open Sublime Text from Terminal in macOS
EDIT: Noticed you are on Ubuntu and not MacOS, but that post should still work as long as you're using bash, which is the default shell on Ubuntu.

I have succeeded my following this
SET EDITOR="full_path to sublime"
rails credentials:edit
after closing sublime only i am getting new credentials saved response.
Hope it helps

Related

How can I launch gitahed from terminal?

I enjoy using gitahed, and I would like to add a shortcut to lauch it, with github desktop I use github-desktop, but I can do the same with GA?
How can I launch gitahed from terminal?
GitAhead has a Terminal panel at Tools->Options. It has a button to install command line tools. It really just creates a symlink to the GitAhead binary in /usr/local/bin. If that doesn't work for some reason, you can create the symlink yourself or an alias. See command line options by running with the --help flag. There are only a few at the moment.

How do I continue work on a django project I created with cmd and using sublime text?

How do I continue work on a django project after I switched off my laptop. I'm using sublime text to edit and my command prompt to runserver. I have created a virtual environment and also activate it at the beginning of my work.
First, CD into the directory in your command prompt where your project is.
Second, activate the virtual environment again.
Third, start the dev server.
Fourth, make changes to the code and make cool projects!

How to change the text of the command to run an app in Linux?

I use Arch. For example, in order to run Google Chrome in terminal you have to run the long command google-chrome-stable. How can I change this command to make it more concise (chrome, for example)? I run this browser often from the terminal because it's more convenient for web-development when you write some html/css code in text editor and run it using the browser to see how it works.
Thank you! And sorry for my English, it's not my first language.
The problem is solved. I've just added the line alias chrome="google-chrome-stable" to my ~/.bashrc file and reboot the system.

How to get a node or cmd terminal in sublime?

Is there a way to run npm commands from Sublime?
For instance, if I wanted to run npm install angular-ui-grid on the current folder in Sublime, how would I do that?
I've looked at posts that say I can build with Node in Sublime, but I don't think that means I can run npm install as if I was in a terminal.
I know you can run a Python terminal from Sublime with Ctrl+`, and you can open a command window at the current location, but is there any way to combine the two?
NOTE: Looking for a Windows cmd or powershell terminal.
I guess, you are looking for TerminalView
This is a Linux/macOS plugin for Sublime Text 3 that allows for terminals inside editor views. The plugin uses a pseudo-terminal to start the underlying shell which means it supports
Interactive applications
Auto-completion
Terminal shortcuts (ctrl+c, etc.)
Password prompt etc.
You can get this package here,
https://packagecontrol.io/packages/TerminalView
Hope this helps!

How to run a program in Atom Editor?

I found Atom editor as good free alternative to Sublime text editor. Not able to find a straightforward way to run a program in Atom editor. In my case, I am trying to run a java program. Please let me know if it's possible? If yes, please describe the steps to follow.
I find the Script package useful for this. You can download it here.
Once installed you can run scripts in many languages directly from Atom using cmd-i on Mac or shift-ctrl-b on Windows or Linux.
Click on Packages --> Commmand Palette --> Select Toggle.
Type Install Packages and Themes.
Search for Script and then install it.
Press Command + I to run the code (on Mac)
You can go settings, select packages and type atom-runner there if your browser can't open this link.
To run your code do Alt+R if you're using Windows in Atom.
For C/C++ programs there's very good package gpp-compiler.
Shortcuts:
To compile and run: F5
To debug: F6
If you know how to launch your program from the command line then you can run it from the platformio-ide-terminal package's terminal. See platformio-ide-terminal provides an embedded terminal within the Atom text editor. So you can issue commands, including commands to run your Java program, from within it. To install this package you can use APM with the command:
$ apm install platformio-ide-terminal --no-confirm
Alternatively, you can install it from the command palette with:
Pressing Ctrl+Shift+P. I am assuming this is the appropriate keyboard shortcut for your platform, as you have dealt ith questions about Ubuntu in the past.
Type Install Packages and Themes.
Search for the platformio-ide-terminal.
Install it.
This package in Atom can run scripts.
Atom script package
press Alt+X for the running script.
For running javascript you need to install 'node js'
Also pressing ctrl+shift+i in atom gives developer option like chrome
you can test javascript code side by side in atom editor.
In order to get this working properly on Windows, you need to manually set the path to the JDK (...\jdk1.x.x_xx\bin) in the system environment variables.
You can try to use the runner in atom
Hit Ctrl+R (Alt+R on Win/Linux) to launch the runner for the active window.
Hit Ctrl+Shift+R (Alt+Shift+R on Win/Linux) to run the currently selected text in the active window.
Hit Ctrl+Shift+C to kill a currently running process.
Hit Escape to close the runner window
You can run specific lines of script by highlighting them and clicking shift + ctrl + b
You can also use command line by going to the root folder and writing:
$ node nameOfFile.js

Resources