LoginSignup
3
0

More than 3 years have passed since last update.

AtomのRemote-FTPを使ってファイル保存と同時にアップロード

Posted at

テキストエディタ(Atom)を使って、ローカルでファイル保存と同時にサーバーに自動アップロードする手順です。

・macOS Mojave 10.14.5
・Atome 1.38.2
・remore-ftp 2.2.2

1. 「Atom」のインストール

2. 「Remote-FTP」のインストール

メニューバーから Atom > Preferences > Install の順に進み、Search packages (検索窓)から「remote-ftp」を検索します。
「remote-ftp」のインストール.png
インストール完了後はAtomを再起動します。
ちなみに、起動の度にWelcome画面が出てくるので、「Show Welcome Guide when opening Atom」のチェックを外しておくとよいかもです。

3. Projectフォルダの追加

メニューバーから File > Add Project Folder の順に進み、Projectフォルダを選択します。
個人的にProjectフォルダはFTPのホスト名にしてプロジェクトを管理しています。

4. 設定ファイルの作成

続けて接続に必要な設定ファイルを作成します。メニューバーから Packages > Remote FTP の順に進み、 「Create FTP config file」または「Create SFTP config file」を選択します。

※ FTPは暗号化されていないため、運用には注意しましょう。

5.「.ftpconfig」の更新

FTP設定

{
    "protocol": "ftp",
    "host": "example.com",
    "port": 21,
    "user": "user",
    "pass": "pass",
    "promptForPass": false,
    "remote": "/",
    "local": "",
    "secure": false,
    "secureOptions": null,
    "connTimeout": 10000,
    "pasvTimeout": 10000,
    "keepalive": 10000,
    "watch": [],
    "watchTimeout": 500
}

SFTP接続の場合

{
    "protocol": "sftp",
    "host": "example.com",
    "port": 22,
    "user": "user",
    "pass": "pass",
    "promptForPass": false,
    "remote": "/",
    "local": "",
    "agent": "",
    "privatekey": "",
    "passphrase": "",
    "hosthash": "",
    "ignorehost": true,
    "connTimeout": 10000,
    "keepalive": 10000,
    "keyboardInteractive": false,
    "keyboardInteractiveForPass": false,
    "remoteCommand": "",
    "remoteShell": "",
    "watch": [],
    "watchTimeout": 500
}

6. サーバーに接続

メニューバーから Packages > Remote FTP > Connect の順に進みます。
Connected.png
画面右上に「Connected」の表示が出れば接続OKです。接続できない場合は「.ftpconfig」を見直します。

7. ダウンロード

remote.png
ダウンロードする場合は、Packages > Remote FTP > Toggleの順で表示します。
Toggleを選択すると画像の赤枠に「Project(ローカル)」と「Remore(サーバー)」のタブが出現するので、「Remore」タブに切り替えてサーバーのディレクトリにアクセスします。
右クリックで対象ファイルをダウンロードすると、FTPのユーザーディレクトリ構成でダウンロードされます。

8. アップロード

「Project」タブに切り替え、任意のファイルを更新して保存すると自動でアップロードされます。
または、右クリックで「Upload」を選択してもOKです。

9. 自動でアップロードしたくないとき

メニューバーの Atom > Preferences > Packages の順に進み、「remote-ftp」のSettings(歯車)をクリックします。
「Auto Upload On Save」がデフォルトで「always」になっているため、「never」に変更します。

 

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0