SanshouSichimiYa

備忘録の為のブログ

Automatorでフォルダアクションが効かない時に確認すること

Automatorでフォルダアクションが効かない状況になったのを直した時の備忘録。

  1. Spotlightからフォルダアクション設定を検索
  2. 開くフォルダアクション設定の中で赤くなっているのがあったら削除

f:id:sanshou-shichimi:20161025153259p:plain

f:id:sanshou-shichimi:20161025153527p:plain

できるようになりました。

MacOS Sierraでcapybara-webkitを動かす

Sierraでcapybara-webkitを動かしたので、その備忘録です。ざっくり。

注意

これは2016年10月02日現在の方法です。

参照

capybara-webkitwikiそのまんまです。詳しくはこちらで確認してください。

Installing Qt and compiling capybara webkit · thoughtbot/capybara-webkit Wiki · GitHub

Qt 5.5をインストール

以下のURLからqt-opensource-mac-x64-clang-5.5.1.dmgをダウンロードしてきてdefaultオプションでインストールする。

https://download.qt.io/archive/qt/5.5/5.5.1/

default_pre.prfを編集

[Qt_install_folder]/[Qt_version](/clang_64 || )/mkspecs/features/mac/default_pre.prf15行目を以下に書き換える

isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \

capybara-webkitをインストールする

Gemfileへgem 'capybara-webkit'を記述して

PATH=$PATH:/Users/your_user_name/Qt5.5.1/5.5/clang_64/bin bundle install

テストを実行…できるまで

テストを実行

bundle exec rake test

エラーが発生

    Sorry, you can’t use byebug without Readline. To solve this, you need to
    rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
    install libreadline-dev` and then reinstall your Ruby.
rake aborted!

rubyを削除して、再インストールを行う

$ rbenv uninstall 2.3.1
$ rbenv install 2.3.1

テストを実行するとまたエラーが発生。

ただ、テストそのものは動いてる模様。

objc[78787]: Class ObjCTimerObject is implemented in both /Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI (0x1117d7c58) and /Library/Internet Plug-Ins/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer (0x111835008). One of the two will be used. Which one is undefined.
objc[78787]: Class AdobePDFProgressView is implemented in both /Library/Internet Plug-Ins/AdobePDFViewerNPAPI.plugin/Contents/MacOS/AdobePDFViewerNPAPI (0x1117d7ac8) and /Library/Internet Plug-Ins/AdobePDFViewer.plugin/Contents/MacOS/AdobePDFViewer (0x1118350a8). One of the two will be used. Which one is undefined.
2016-10-02 19:21:09.285 webkit_server[78787:1318059] Cannot find executable for CFBundle 0x7fb5c4c7af90 </Library/Internet Plug-Ins/Disabled Plug-Ins> (not loaded)

adobeのサイトを参照して、2つのプラグインを削除

Safari プラグインの問題に関するトラブルシューティング(Macintosh 版 Acrobat X/Adobe Reader X)

2016-10-02 19:21:09.285 webkit_server[78787:1318059] Cannot find executable for CFBundle 0x7fb5c4c7af90 </Library/Internet Plug-Ins/Disabled Plug-Ins> (not loaded)

このエラーは残っており、調べてもいまいち解決できなかった事やテストは動いているのでひとまずこれで終了。


その場しのぎ的です。

libEGL warning: DRI2: failed to open swrast

CentOS7.2でcapybara-webkitを動かす際に以下のエラー発生

libEGL warning: DRI2: failed to open swrast (search paths /usr/lib64/dri)

driverが足りない?ググってmesa-dri-driversをいれました。

$ sudo yum install mesa-dri-drivers

うごいた。


参考

http://www.theshell.guru/install-cutycapt-centos-7-2/

CentOS7.2でMariaDBを削除してMySQLをいれた後に出たエラーの対処

rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem ‘mysql2’.
Gem Load Error is: Incorrect MySQL client library version! This gem was compiled for 5.5.50-MariaDB but the client library is 5.6.33.

mysql2のgemを一度消して、再度いれれば良さそう。

$ bundle exec gem uninstall mysql2
$ bundle

動きました。

プロンプト(黒い画面)の表示を変更する

VagrantDebianCentOSを立ち上げた時にプロンプトの表示を変更したのでその備忘録。

VagrantではIPがわかった方が色々便利なので表示させてます。

f:id:sanshou-shichimi:20161002063359p:plain

Debian

export THEIP=$(/sbin/ifconfig eth0 | grep 'inet addr' | cut -c 21-34 | sed 's/  //g')
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\H\033[32m\][$THEIP]\[\033[00m\]:\W\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\]\$ '

CentOS

git-prompt.shgit-completion.bashfind / -name git-completion.bashなどで探してください。

source /usr/share/doc/git-1.8.3.1/contrib/completion/git-prompt.sh
source /usr/share/doc/git-1.8.3.1/contrib/completion/git-completion.bash
export THEIP=$(/sbin/ifconfig eth0 | grep -E 'inet ' | cut -c 14-25 | sed 's/  //g')
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\H\033[32m\][$THEIP]\[\033[00m\]:\W\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\]\$ '

便利になりました。


参照

プルリクエスト画面からMergeできない時の対処方法

Issueを引き継いだ際にコンフリクトが起こっており、githubのpull request画面でmergeボタンが押せない状態でした。

これを解消したのでその備忘録。

対象のpull requestをローカルの開発環境にもってくる

$ git fetch origin pull/ID/head:BRANCHNAMEで、もってこれます。

今回は#2710add_cover_in_haunted_placesをもってきたかったので以下。

git fetch origin pull/2710/head:add_cover_in_haunted_places

コンフリクトの解消をする

前提条件としてmasterは最新の状態です。

$ git checkout add_cover_in_haunted_places
$ git merge master

コンフリクトが発生したら、それぞれ解決してください。

$ git add .
$ git commit -m "競合を解決"
$ git push origin add_cover_in_haunted_places

以上です。


参照元

RailsアプリにBasic認証をかける

開発中のプロジェクトでBasic認証をかける必要がでてきたので調べて実装の備忘録。

いや、ほぼ参照元まんまなんですが。

Heroku上のRailsアプリにBasic認証をかける - Qiita

application_controller.rbに追記

※個別に認証をかけたい場合はそれぞれのcontrollerへどうぞ

http_basic_authenticate_with name: ENV['BASIC_AUTH_USERNAME'], password: ENV['BASIC_AUTH_PASSWORD'] if Rails.env.production?

Herokuへ環境変数を追加

$ heroku config:add BASIC_AUTH_USERNAME="admin" BASIC_AUTH_PASSWORD="password"

便利です。

便利です。 privateの中にかいた方がよかったのかもと思いましたが、今回はこれで。

privateの中にかく場合は下を参照してください。