ormprog / rails_ama

Ruby/Rails - Ask Me Anything
MIT License
2 stars 0 forks source link

I have an Issue to open credential file using atom text editor #129

Closed ansary14-zz closed 3 years ago

ansary14-zz commented 3 years ago

My rails version is 6.0.3.4

In my new application(Finance Tracker) I need to open config/credentials.yml.enc encrypted file. In my tutorial, They open the credential file with vs code editor by using EDITOR="code --wait" rails credentials:edit this command.

I am using atom as a text editor reference: https://stackoverflow.com/questions/52370065/issue-to-open-credentials-file I run EDITOR="atom --wait" rails credentials:edit this command But it didn't open the credential file

ansary14-zz commented 3 years ago

Here is the outcome of EDITOR="atom --wait" rails credentials:edit

ayub@ayub:~/rails-project/finance-tracker$ EDITOR="atom --wait" rails credentials:edit
File encrypted and saved.
ansary14-zz commented 3 years ago

Here is the outcome of EDITOR="atom --wait" bin/rails credentials:edit

ayub@ayub:~/rails-project/finance-tracker$ EDITOR="atom --wait" bin/rails credentials:edit
File encrypted and saved.
ansary14-zz commented 3 years ago

Here is the outcome of rails credentials:edit

ayub@ayub:~/rails-project/finance-tracker$ rails credentials:edit
No $EDITOR to open file in. Assign one like this:

EDITOR="mate --wait" bin/rails credentials:edit

For editors that fork and exit immediately, it's important to pass a wait flag,
otherwise the credentials will be saved immediately with no chance to edit.
wasifhossain commented 3 years ago

might be related with atom installation in your system. could you tell us how did you install it?

(got the hint from https://github.com/atom/atom/issues/20368)

ansary14-zz commented 3 years ago

How did I install atom Reference link https://flight-manual.atom.io/getting-started/sections/installing-atom/#debian-and-ubuntu-debapt

I run the following commands line by line wget -qO - https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -

sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'

sudo apt-get update

Install Atom by run below command

sudo apt-get install atom

wasifhossain commented 3 years ago

okay let's approach in a different way:

which shell are you using btw? echo $0 would tell you that

ansary14-zz commented 3 years ago
ayub@ayub:~/rails-project/finance-tracker$ echo $0
-bash
ansary14-zz commented 3 years ago

In the mean time I am opening the credential file by sublime text editor Using EDITOR="subl --wait" bin/rails credentials:edit this command

wasifhossain commented 3 years ago
ayub@ayub:~/rails-project/finance-tracker$ echo $0
-bash

okay. if you set the variable in .bashrc, then you won't have to prefix it before the rails command anymore. open it using subl ~/.bashrc and append the following line:

export EDITOR='atom --wait'

(the file would be ~/.zshrc in case you are using the ZSH shell)

next save the file and open a new terminal. try rails credentials:edit

check if atom now waits for you to close. if not, close all running instances of atom and try again.