LoginSignup
14
8

More than 5 years have passed since last update.

噂のwlinuxでidea動かしてscalaでhelloworldする。

Last updated at Posted at 2018-09-26

window側で必要な要素です

計 ¥1,580

wlinux後の初期設定とかいろいろ

※ Hyperを利用してwlinux.exeを叩くと失敗するので注意です。

(少なくとも初期設定のWindow\bash.exeから叩いたらGUIの立ち上がりに失敗しました)→できたので追記しました。

  1. X410を起動します。
  2. wlinuxを起動します。
  3. user, passwordを設定します。

    • ※WSLと同じ仕様なら再変更が非常に面倒くさいので、一発で決めてください。
  4. user, passwordの設定以降は次のように行いました

cd $HOME

# 誤入力・Tab補完時にうるさいベル音の削除(重要)
sudo sed -i "s/# set bell-style none/set bell-style none/" /etc/inputrc

# aptでinstallするものとか(結構時間がかかります)
sudo apt install openjdk-8-jdk gedit bash-completion -y

# git flow avhのインストール
wget --no-check-certificate -q https://raw.githubusercontent.com/petervanderdoes/gitflow-avh/develop/contrib/gitflow-installer.sh && sudo bash gitflow-installer.sh install stable; rm gitflow-installer.sh

# completion(tab補完の調整)
wget https://raw.githubusercontent.com/bobthecow/git-flow-completion/master/git-flow-completion.bash -O $HOME/.git-flow-completion.bash
cat >>$HOME/.bashrc <<EOF
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
EOF
cat >>$HOME/.bashrc <<EOF
if [ -f $HOME/.git-flow-completion.bash ]; then
. $HOME/.git-flow-completion.bash
fi
EOF

#git config
git config user.name "xxxxx"
git config user.email  "xxxxx@example.com"

#github系の調整
mkdir -p $HOME/.ssh/github/
ssh-keygen -t rsa -b 4096 -C "xxxxx@example.com" # ${HOME}/.ssh/github/id_rsa を絶対パスで指定
cat >>$HOME/.ssh/config <<EOF
Host github.com
HostName github.com
IdentityFile ~/.ssh/github/id_rsa
User git
EOF
chmod 600 $HOME/.ssh/github/id_rsa
chmod 600 $HOME/.ssh/config
gedit $HOME/.ssh/github/id_rsa # pbcopy無いのでコピペ
# githubのアカウントにsshkeyを追加する部分は省略

# giboのインストールも省略

ideaの設定編

お好みのjetbrainsのLinux版を拾ってきて展開してideaを起動する。

tar zxvf ideaIU-2018.2.4.tar.gz
./idea-IU-182.4505.22/bin/idea.sh

!動く!
run-idea.png

右下からpluginの設定を行って再起動

とりあえず、scalaとsbt。
install-plugin2.png
install-plugin1.png

create projectして、hello-worldを書く、テストも書く!

ウェーィ

HelloWorld.scala
class HelloWorld() {
  def main (): Int ={
    println("Hello World")
    0
  }
}
HelloWorldSpec.scala
import org.specs2.mutable.Specification
class HelloWorldTest extends Specification{
  "HelloWorld#main" should {
    "return 0" in {
      val helloWorld = new HelloWorld
      helloWorld.main mustEqual 0
    }
  }
}

「LinuxのWindow」にコピペできるの素敵

spec2を利用したいので、build.sbtに追記
windowsのchrome→wlinuxのx401のideaへコピペ

  • コピペができる!!!

copy-on-windows-chrome.png
paste-to-wlinux-idea-window.png

WindowsとLinuxを行き来するプログラムは大概コピペが最初できなくてつらみがあるので、これはうれしい。
なんて言っても、試しのコーディングの際にササッとコピペできるのがいい。

sbt shell, test run, debugが一通り動くことを確認

run-main-from-sbt.png
run-test.png
run-test-result.png
run-debug.png

githubで適当にリポジトリを作ってPush

省略。

動作中のメモリとか

16GBの約10%で1.6GBほどの消費。
プロジェクト作成時にscala本体のsource codeも持ってきたのでそれのせいで重くなってしまった感。

before:

not-run-idea-yet.png

after:

runned-idea.png

感想・総評

昔のWindowsのcmdからじゃ考えられないくらいに開発環境(パッケージ管理・UNIXコマンド・パイプ処理・UX)してる。
desktopで動かしたので、オーバーヘッドによる速度の低下も(aptからの展開時を除けば)余り気にならなかった。
人権のないノートブックからでもコマンドライン操作はほぼ気にならないと思う。
WebServer立ててないので、IP周り(というかファイヤーウォール周り)がどうなってるのかがわからないのでまだ様子見ではある。
1.5kなら電子小物代にもならないので、少しでも気になる人は買っておくと吉かもしれない。
後々7kで口に指をくわえることになるくらいなら、今買ったほうが絶対得。
(↑7k高すぎてlinux入れとけばいいやってなりがち)
chrome bookのOP1も気になってたけど、こんだけWindowsで動くなら割とどっちでもいい気がしてきた。

その他

今回作ったリポジトリ

追記:Hyper.jsの設定方法

shellとshellArgsを変更する

{
    shell: 'wlinux.exe',
    shellArgs: []
}

参考

参考

14
8
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
14
8