久々にRailsを使ったら
久々にRailsを使おうと思い、Rubymineでプロジェクトを作ったら、さっそく怒られた。。
Error:[rake --tasks] Warning: You're using Rubygems 2.0.14 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance.
ということでrubygems自体のアップデートを行った
$ gem update --system
Updating rubygems-update
Fetching: rubygems-update-2.4.8.gem (100%)
Successfully installed rubygems-update-2.4.8
Parsing documentation for rubygems-update-2.4.8
Installing ri documentation for rubygems-update-2.4.8
Installing darkfish documentation for rubygems-update-2.4.8
Done installing documentation for rubygems-update after 3 seconds
Installing RubyGems 2.4.8
RubyGems 2.4.8 installed
Parsing documentation for rubygems-2.4.8
Installing ri documentation for rubygems-2.4.8
meteor使ってみた3
Discover Meteor のRoutingの章で
$ mrt add iron-router
は古いので、0.9以上では
$ meteor add iron:router
とする。
CentOS6.4 64bitにgitサーバー構築
# yum install git git-daemon git-all xinetd
# chkconfig xinetd on
# /etc/init.d/xinetd start
xinetd を起動中: [ OK ]
git-daemonファイルを作成
# vi /etc/xinetd.d/git-daemon
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# default: off
# description: The git dæmon allows git repositories to be exported using \
# the git:// protocol.
service git
{
disable = no # <- 変更
socket_type = stream
wait = no
user = nobody
server = /usr/libexec/git-core/git-daemon
server_args = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose
log_on_failure += USERID
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
保存して再起動
# /etc/init.d/xinetd restart
レポジトリ作成
# cd /var/lib/git
# mkdir repos
# mkdir repos/test.git
# cd repos/test.git/
# git --bare init --shared
Initialized empty shared Git repository in /var/lib/git/repos/test.git/
テスト用のファイル作成
$ cd
$ mkdir git_test
$ cd git_test
$ echo "Git Test." > test.txt
このディレクトリ内にローカルリポジトリを作成
$ git init
Initialized empty Git repository in /home/nabe/git_test/.git/
ファイルをローカルリポジトリに追加し、コミットする。
$ git add test.txt
$ git commit -m "First Commit"
リモートリポジトリの登録(登録名test)
登録名を省略するとデフォルトでorigin になる。
$ git remote add test ssh://localhost/var/lib/git/repos/test.git
$ git push test master The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is eb:23:b3:23:4e:d1:f8:fa:90:10:62:a5:9b:ac:d7:9a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
nabe@localhost's password:
Counting objects: 3, done.
Writing objects: 100% (3/3), 227 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://localhost/var/lib/git/repos/test.git
* [new branch] master -> master
リモートリポジトリから Pull
$ git pull test master
nabe@localhost's password:
From ssh://localhost/var/lib/git/repos/test
* branch master -> FETCH_HEAD
Already up-to-date.
meteor使ってみた2
meteorのサイトのtutorialに従って、いろいろいじってみると、
7.Running on mobileの
Running on an Android emulatorの
✓ Found Android bundle
✓ A JDK is installed
✓ Found Android Platform tools
✓ Found Android Build Tools
✗ 32-bit libraries not found
✓ Found Android 19 API
✓ Found suitable Android x86 image
✓ 'meteor' android virtual device (AVD) found
✗ Android emulator acceleration is not installed
(The Android emulator will be very slow without acceleration)
Platform requirements not yet met
Please follow the instructions here:
https://github.com/meteor/meteor/wiki/Mobile-Dev-Install:-Android-on-Linux#libs32
となって、32bitライブラリが入ってないので、でつまずいた。
(マシンはCentOS 6.5 64bit)
指示されたurlをみると、JDK1.7と32bitライブラリが必要とのことなので、wikiに書いてある通りに、インストールした。
$ sudo yum install -y java-1.7.0-openjdk-devel
は成功したが
sudo yum install -y glibc.i686 zlib.i686 libstdc++.i686 ncurses-libs.i686
が
エラー: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:
1. You have an upgrade for libstdc++ which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of libstdc++ of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
--exclude libstdc++.otherarch ... this should give you an error
message showing the root cause of the problem.
2. You have multiple architectures of libstdc++ installed, but
yum can only see an upgrade for one of those arcitectures.
If you don't want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.
3. You have duplicate versions of libstdc++ installed already.
You can use "yum check" to get yum show these errors.
...you can also use --setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).
Protected multilib versions: libstdc++-4.4.7-11.el6.i686 != libstdc++-4.4.7-4.el6.x86_64
となってインストールできず。原因がよく分からないので、一個ずつインストールしていくと
$ sudo yum install libgcc.i686
をおこなうと、同じエラーがでるので、こいつがインストールできないらしい。
メッセージの2番を試してみる。
現在インストールされているlibstdc++依存関係を整理する。
$ sudo yum update libstdc++ --exclude libstdc++.otherarch
...中略
依存性を更新しました:
cpp.x86_64 0:4.4.7-11.el6 gcc.x86_64 0:4.4.7-11.el6
gcc-c++.x86_64 0:4.4.7-11.el6 libgomp.x86_64 0:4.4.7-11.el6
libstdc++-devel.x86_64 0:4.4.7-11.el6
となって依存性が解決されたらしいので、再び
$ sudo yum install libgcc.i686
とやると、うまくインストールされた。
つぎに、/dev/kvm が無いので、kvmがインストールされているか調べた
$ lsmod | grep kvm
で何も表示されないので、kvmをインストールする
$ yum -y install qemu-kvm libvirt virt-install bridge-utils
kvmがロードされているか再び調べる
$ lsmod | grep kvm
kvm 317376 0
kvm_intelの表示が無いが、多分OKということで、最初の
$ meteor install-sdk android
を再びやってみる。
✓ Found Android bundle
✓ A JDK is installed
✓ Found Android Platform tools
✓ Found Android Build Tools
✓ Found Android 19 API
✓ Found suitable Android x86 image
✓ 'meteor' android virtual device (AVD) found
✓ Android emulator acceleration is installed
でうまくいったようだ。
次にemulatorを動かしてみる
$ meteor add-platform android
ライセンス条項にYesをし、
$ meteor run android
かなり遅いが、emulatorが立ち上がる。しかし、アプリケーションはインストールされている様子はないので、
を見習って、一度ctrl-cでmeteor run androidを止めて、emulatorはそのままにしておき、再び
$ meteor run android
を行うと、見事、androidネイティブでアプリケーションが立ち上がった。
しかも、ブラウザで開いているアプリケーションと同期
している!なんとすばらしい!
次に実際のデバイスでも動かしてみる。
XperiaをUSBデバッグモードにして、USBでPCとつなぎ
$ meteor run android-device
Could not start the app on your device. Is it plugged in?
Try running again with the --verbose option.
Instructions for running your app on an Android device:
https://github.com/meteor/meteor/wiki/How-to-run-your-app-on-an-Android-device
とつながれていないというようなメッセージ。
$ /home/nabe/.meteor/android_bundle/android-sdk/platform-tools/adb devices
List of devices attached
???????????? no permissions
となっている。どうも認識されていないようだ。
指示されたURLをみて、usbの接続ルールが無いようなので、さっそく作る。
$ cd /etc/udev/rules.d
$ vi 51-android.rules
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
UBSYSTEM=="usb", SYSFS{idVendor}=="502", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0b05", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="489", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04c5", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04c5", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="091e", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="109b", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="24000", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="2116", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="482", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="17ef", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="409", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="2080", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="955", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="2257", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="10a9", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="1d4d", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="471", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04da", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="05c6", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="1f53", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="400000000", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="054c", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="2340", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="930", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", SYSFS{idVendor}=="19d2", SYMLINK+="android_adb",MODE="0666", GROUP="plugdev"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
その後
$ /home/nabe/.meteor/android_bundle/android-sdk/platform-tools/adb kill-server
$ /home/nabe/.meteor/android_bundle/android-sdk/platform-tools/adb start-server
もう一度、
$ /home/nabe/.meteor/android_bundle/android-sdk/platform-tools/adb devices
List of devices attached
???????????? no permissions
同じ結果だ。
ちなみに
$ lsusb
Bus 002 Device 034: ID 0fce:5178 Sony Ericsson Mobile Communications AB
だと、つながってる。
しかし、何度かやってるうちに
$ /home/nabe/.meteor/android_bundle/android-sdk/platform-tools/adb devices
List of devices attached
CB5A1LK24G device
認識された。時間がかかるのであろうか?
再び
$ meteor run android-device
無事Xperia上で動いた!
meteor使ってみた
- インストール
$ curl https://install.meteor.com/ | sh
Meteor 1.0.2.1 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
To get started fast:
$ meteor create ~/my_cool_app
$ cd ~/my_cool_app
$ meteor
Or see the docs at:
docs.meteor.com
バージョンを確認してみる
$ meteor --version
Meteor 1.0.2.1
さっそくアプリケーションを作成してみる
$ mkdir Meteorprojects
$ cd Meteorprojects
$ meteor create hello
hello: created.
To run your new app:
cd hello
meteor
メッセージ通りやってみる
$ cd hello
$ meteor
[[[ ~/Meteorprojects/hello ]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
meteor.comにデプロイして、公開してみる
$ meteor deploy crossedge-hello.meteor.com
To instantly deploy your app on a free testing server, just enter your email
address!
Email: xxx@xxxxxx.xx
Deploying to crossedge-hello.meteor.com.
Now serving at http://crossedge-hello.meteor.com
ブラウザで上記アドレスを指定すると、確かに見える。
入力したメールアドレスにアカウント作成のメールがくるので、クリックしてアカウントを作成する。
コードを修正してみる
$ vi hello.html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
こんにちは、Meteor!
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
保存して、ブラウザをリロードせずにそのまま待つと、反映された!(localhost:3000)
rbenv + ruby-buildでruby環境の構築
rbenvのインストール
[nabe@centos ~]$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
環境設定
# PATH に追加
[nabe@centos ~]$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
# .bash_profile に追加
[nabe@centos ~]$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# 上記設定の再読み込み
[nabe@centos ~]$ exec $SHELL -l
# 確認
[nabe@centos ~]$ rbenv -v
rbenv 0.4.0-129-g7e0e85b
# ruby-buildのインストール
[nabe@centos ~]$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
# .rbenvのpluginsディレクトリに入れた場合は、innstall.shをする必要なし。
#インストール可能なRubyのパッケージを確認する。
[nabe@centos ~]$ rbenv install -l
Available versions:
1.8.6-p383
1.8.6-p420
...
...
といくつもリストアップされる。
2.0.0-p598をインストールする
[nabe@centos ~]$ rbenv install 2.0.0-p598
インストール後
[nabe@centos ~]$ rbenv rehash
インストール済みのRubyパッケージを確認
[nabe@centos ~]$ rbenv versions
2.0.0-p598
*system (set by /home/nabe/.rbenv/version)
バージョンの切り替え
[nabe@centos ~]$ rbenv global 2.0.0-p598
バージョンの確認
[nabe@centos ~]$ rbenv version
2.0.0-p598 (set by /home/nabe/.rbenv/version)
[nabe@centos ~]$ ruby -v
ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-linux]
元のシステムのデフォルトに戻すには
[nabe@centos ~]$ rbenv global system
[nabe@centos ~]$ rbenv version
system (set by /home/nabe/.rbenv/version)
[nabe@centos ~]$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
yoemanインストール
オライリーのAngularJSアプリケーション開発ガイドをみて、yeomanインストールしようとしたけど、どうもバージョンが新しくなったのか?うまくできなかった。
[nabe@centos angular]$ yo init angular
Error init angular
You don't seem to have a generator with the name init installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
なんかいろいろgeneratorとかに分かれたようで、とりあえずググって
以下のコマンドでインストール
[nabe@centos ~]$ npm install -g bower grunt-cli yo
generator-angularのインストール
[nabe@centos ~]$ npm install -g generator-angular
mkdir sampleapp
cd sampleapp
[nabe@centos sampleapp]$ yo angular
サーバーの立ち上げ
[nabe@centos sampleapp]$ grunt serve
ブラウザーでlocalhost:9000 でapp/index.htmlのページが表示される
angulraJSとrequireJSの統合版は
[nabe@centos ~]$ npm install -g generator-angular-require
でインストールできた。
確認
[nabe@centos ~]$ yo --help
Usage: yo GENERATOR [args] [options]
General options:
-h, --help # Print generator's options and usage
-f, --force # Overwrite files that already exist
Please choose a generator below.
Angular
angular:app
angular:common
angular:constant
angular:controller
angular:decorator
angular:directive
angular:factory
angular:filter
angular:main
angular:provider
angular:route
angular:service
angular:value
angular:view
Angular-require
angular-require:app
angular-require:constant
angular-require:controller
angular-require:decorator
angular-require:directive
angular-require:factory
angular-require:filter
angular-require:provider
angular-require:route
angular-require:service
angular-require:value
angular-require:view
Karma
karma:app
Karma-require
karma-require:app
Mocha
mocha:app
Webapp
webapp:app
となったので、yo angular-require で生成すればよいと思う