Updates
-
やる気しない……
-
Scientific Linus だと高速加速しながら反対側から来たRMSとぶつかりそう。
-
客席?(´・ω・`)?
-
ネットイナゴやら匿名云々って枕詞からの批判は、感覚的に言うと「凶器準備集合罪を適用させる正当性がこちらにはあるのだ」という感じなんだろな。若者がたむろしてると「君らがここ座ってると客席こないんだよ!」みたいな。もちろん怖がらせようと思ってやっている人もいるしそれが根を深くしてる。
-
「モッキーナ」???
-
"愛称は「モッキーナ」「モックン」「クセ者」。" 元木大介 - Wikipedia http://t.co/tBNZ389q15 hours ago from web | Reply, Retweet, Favorite
-
日産やらせのかけあいみたいなのしてる
-
こういう丁寧な記事は「やってみよう」の敷居を下げるから、とてもすごいことだと思うんだよなー。
-
設定はよ!!
-
“nginx連載2回目: nginxのインストール - インフラエンジニアway” http://t.co/vVhbBU7y
-
とっても待ってた
-
minimalインストールはやっぱり速いなあ
-
出勤前に一台VM建てるってのも乙ですな
-
VM作り直しー
-
@tetsuro_n 「ラーメンズ、昔AppleのCM出てたじゃないですかー」って思っていましたが、片桐仁はPC側だったからWindows使っててもありな気がしてきました。
-
/Users 以下が50GBってのが解せないがそんなもんかなあ
-
もしかしてMacのアップデートってゴミ箱パンパンにしてったのかな?
-
GeekToolでローカルのVMにアクセスさせまくってたら、HDDパンパンになってもた(´・ω・`)
-
10秒間画像とにらめっこして笑ったら死亡:キニ速 http://t.co/BUIIPrWh23 hours ago from web | Reply, Retweet, Favorite
-
""Monster's sounds and boppin tracks"" Review: "Monster's sounds and boppin tracks" http://t.co/bYwizKbR23 hours ago from web | Reply, Retweet, Favorite
Posts
本来、クオリーメンとビートルズは改名しただけで同一のバンドであったが、このビートルズ時代のメンバーが存在しない再結成により発祥を共有する別バンドという位置付けが強くなった。
ジョーの死は俺にクラッシュの偉大さを実感させてくれた。俺たちは政治的なバンドで、その詞はジョーが書いたんだ。奴はあんたらが会った中でも本物の男の一人だ。奴が「俺はお前の味方だよ」と言うなら、それは100%の意味なんだってことがわかるさ。
— トッパー・ヒードン – 2002
Railsが神がかってるおかげでバックエンドの機能自体は2週間もかからずできてた気がする(シンプルすぎるサービスというのはもちろんあるが)。残りの時間はフロント、特にjavascriptでAjax作ったりエフェクトつけるのにほぼ費やしてた。それで思ったのは、好き嫌いに関わらずjsが書けないとモダンな感じのWebサービスは作れない。
Audio
Posts
前提
Scientifc Linux 6.1 + nginx / yum 起動スクリプトを流用する » # watch -d tail /var/log/ngsw.log
検証
# nginx -V 2>&1 |grep --color '\-\-pid-path.*.pid' (snip) --pid-path=/var/run/nginx/nginx.pid (snip)
# ls /var/run/nginx/nginx.pid ls: cannot access /var/run/nginx/nginx.pid: そのようなファイルやディレクトリはありません
# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
# ls /var/run/nginx/nginx.pid /var/run/nginx/nginx.pid
# ?(´・ω・`)?
# /etc/init.d/nginx status nginx が停止していますが PID ファイルが残っています
# ?(´・ω・`)?
# /etc/init.d/nginx stop nginx を停止中: [失敗]
# ??(´・ω・`)??
# ls /var/run/nginx/nginx.pid ls: cannot access /var/run/nginx/nginx.pid: そのようなファイルやディレクトリはありません
# こういうものですか?ソースみてみなきゃな話だなー。
ようやくわかった
passenger_ruby /home/USER/.rbnev/versions/1.9.3-p0/bin/ruby;
を
passenger_ruby /home/USER/.rbnev/shims/ruby;
としていたため。とりあえずベタ書きで対応。
稼動しているサーバから持ってきた設定であったが、
おそらく以下のようなdot-file設定等々に影響してるのだろうな、と。
export PATH=”$HOME/.rbenv/bin:$PATH”
eval “$(rbenv init -)”
source ~/.rbenv/completions/rbenv.bash
今気がついて、まだ直せていない
/etc/init.d/nginx で起動すると
/home/USER/.rbenv/shims/ruby: line 4: exec: rbenv: not found
がnginxのerror_logに出続けるので修正する
例えば http://exmaple.com/ にアクセスするとして
Cannot spawn application ‘/path/to/rails_root’: Could not read from the spawn server: Connection reset by peer (104)
というエラーがでる
/usr/local/nginx/sbin/nginx も /etc/init.d.nginx start も
期待通りの挙動を示していないため、passengerとの連携に問題があると言えそう。
WEBRICK単独ではsinatraさんは期待通りに動いてくれている。
最初の小細工
# yum install nginx# cp -a /etc/init.d/nginx /bkup/path/to/# yum remove nginx# cp -a /bkup/path/to/nginx{,.yum-org}# vim /bkup/path/to/nginx
config option(*1)
#https://gist.github.com/1712762./configure \--prefix=/usr/local/nginx \--conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \--pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/subsys/nginx \--user=nginx \--group=nginx \--with-http_stub_status_module \--with-http_ssl_module \--with-http_gzip_static_module \--with-http_realip_module \--http-log-path=/var/log/nginx/access.log \--http-client-body-temp-path=/var/tmp/nginx/client/ \--http-proxy-temp-path=/var/tmp/nginx/proxy/ \--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \--with-cc-opt='-Wno-error' \--add-module='/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx' \&& make
yum 版 nginx との差分
--- nginx.yum-org 2011-12-16 00:22:28.000000000 +0900+++ nginx 2012-02-01 04:10:39.447206296 +0900@@ -6,7 +6,7 @@ # processname: nginx # config: /etc/nginx/nginx.conf # config: /etc/sysconfig/nginx-# pidfile: /var/run/nginx.pid+# pidfile: /var/run/nginx/nginx.pid # description: nginx is a HTTP and reverse proxy server # ### BEGIN INIT INFO@@ -28,10 +28,10 @@ fi prog=nginx-nginx=${NGINX-/usr/sbin/nginx}+nginx=${NGINX-/usr/local/nginx/sbin/nginx} conffile=${CONFFILE-/etc/nginx/nginx.conf} lockfile=${LOCKFILE-/var/lock/subsys/nginx}-pidfile=${PIDFILE-/var/run/nginx.pid}+pidfile=${PIDFILE-/var/run/nginx/nginx.pid} SLEEPMSEC=100000 RETVAL=0
修正後の nginx 起動スクリプト
#!/bin/sh## nginx Startup script for nginx## chkconfig: - 85 15# processname: nginx# config: /etc/nginx/nginx.conf# config: /etc/sysconfig/nginx# pidfile: /var/run/nginx/nginx.pid# description: nginx is a HTTP and reverse proxy server#### BEGIN INIT INFO# Provides: nginx# Required-Start: $local_fs $remote_fs $network# Required-Stop: $local_fs $remote_fs $network# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: start and stop nginx### END INIT INFO
# Source function library.. /etc/rc.d/init.d/functions
CONFFILE="/etc/nginx/nginx.conf"
if [ -f /etc/sysconfig/nginx ]; then . /etc/sysconfig/nginxfi
prog=nginxnginx=${NGINX-/usr/local/nginx/sbin/nginx}conffile=${CONFFILE-/etc/nginx/nginx.conf}lockfile=${LOCKFILE-/var/lock/subsys/nginx}pidfile=${PIDFILE-/var/run/nginx/nginx.pid}SLEEPMSEC=100000RETVAL=0
start() { echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} ${nginx} -c ${conffile} RETVAL=$? echo [ $RETVAL = 0 ] && touch ${lockfile} return $RETVAL}
stop() { echo -n $"Stopping $prog: " killproc -p ${pidfile} ${prog} RETVAL=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}}
reload() { echo -n $"Reloading $prog: " killproc -p ${pidfile} ${prog} -HUP RETVAL=$? echo}
upgrade() { oldbinpidfile=${pidfile}.oldbin
configtest -q || return 6 echo -n $"Staring new master $prog: " killproc -p ${pidfile} ${prog} -USR2 RETVAL=$? echo /bin/usleep $SLEEPMSEC if [ -f ${oldbinpidfile} -a -f ${pidfile} ]; then echo -n $"Graceful shutdown of old $prog: " killproc -p ${oldbinpidfile} ${prog} -QUIT RETVAL=$? echo else echo $"Upgrade failed!" return 1 fi}
configtest() { if [ "$#" -ne 0 ] ; then case "$1" in -q) FLAG=$1 ;; *) ;; esac shift fi ${nginx} -t -c ${conffile} $FLAG RETVAL=$? return $RETVAL}
rh_status() { status -p ${pidfile} ${nginx}}
# See how we were called.case "$1" in start) rh_status >/dev/null 2>&1 && exit 0 start ;; stop) stop ;; status) rh_status RETVAL=$? ;; restart) configtest -q || exit $RETVAL stop start ;; upgrade) upgrade ;; condrestart|try-restart) if rh_status >/dev/null 2>&1; then stop start fi ;; force-reload|reload) reload ;; configtest) configtest ;; *) echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest}" RETVAL=2esac
exit $RETVAL
*1: –lock-path を以前のものから変更した
WordPress に Gist コードを埋め込む Embed GitHub Gist
WordPressのコード埋め込みはGistでいいんじゃないかな
これいいと思った。
WordPress › Embed GitHub Gist « WordPress Plugins
手順レベルのものを gist にぺたぺたしてるし、
なによりシンタックスハイライト系がエンティティエンティティするからもういらついていらついて。
こんな感じで VMware せこせこ作ってる
yum install readline-devel.x86_64 libyaml.x86_64 tree nkfyum install mysql mysql-server gityum install readline-devel.x86_64 libyaml.x86_64 openssl-devel.x86_64 mysql-devel.x86_64yum install gcc make zlib-devel gcc-c++
git clone git://github.com/sstephenson/rbenv.git .rbenvecho 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bashrcecho 'eval "$(rbenv init -)"' >> $HOME/.bashrcecho "source ~/.rbenv/completions/rbenv.bash" >> $HOME/.bashrccd $HOMEgit clone git://github.com/sstephenson/ruby-build.gitcd $HOME/ruby-buildsudo ./install.sh
rbenv-install 1.9.3-p0rbenv global 1.9.3-p0rbenv rehashrbenv versionsrbenv exec gem install rails pry pry-doc
cd /path/to/railsdir/
cat << EOS > Gemfilesource "http://rubygems.org"gem "rails", '~>3.2.0.rc2'EOS
bundle install --path vendor/bundlebundle exec rails new railsapp -d mysql rm -f Gemfilerm -f Gemfile.lockrm -rf .bundle
cd railsapp #Gemfile追記 gem 'therubyracer'bundle install --path vendor/bundlebundle exec rails g scaffold post title:string body:text
# sl は $releasever をベタ書きcat > /etc/yum.repos.d/nginx.repo <<'nginxREPO'[nginx]name=nginx repobaseurl=http://nginx.org/packages/rhel/6/$basearch/gpgcheck=0enabled=1nginxREPO
# ばっといれとく curl-devel は passenger あたりで言われるyum install gcc pcre* zlib* openssl* gd* libpng* libjpeg* GeoIP* curl-devel
# /etc/init.d/nginx ファイルが欲しいyum install nginxcp -a /etc/init.d/nginx /root/yum remove nginx
# rbenv 使ってるユーザで$ rbenv exec gem install rake$ rbenv exec gem install passenger
# nginx 入れるexport nginx_ver="1.1.14"export nginx_configure_script="nginx_configure_`echo ${nginx_ver}|sed -e 's/\./_/g'`.sh"mkdir /usr/local/src/NGINX/cd /usr/local/src/NGINXwget http://nginx.org/download/nginx-${nginx_ver}.tar.gztar zxvf nginx-${nginx_ver}.tar.gz
echo '#!/bin/sh
NGINX=nginx-NGINX_VERSOURCE_DIR=/usr/local/src/NGINXid nginx || sudo useradd -s /sbin/nologin -d /usr/local/nginx -M nginx cd $SOURCE_DIR/$NGINX[ -e "$SOURCE_DIR/$NGINX/Makefile" ] && make clean./configure \ --prefix="/usr/local/nginx" \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --user=nginx \ --group=nginx \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-http_gzip_static_module \ --with-http_realip_module \ --http-log-path=/var/log/nginx/access.log \ --http-client-body-temp-path=/var/tmp/nginx/client/ \ --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ --with-cc-opt="-Wno-error" \ --add-module="/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx" \&& make' | sed -e "s/NGINX_VER/${nginx_ver}/g" > /usr/local/src/${nginx_configure_script}
# でpassengerのコンパイルで使う rake を root が見つけられずで実行できないから、# /home/USER/.rbenv/shims を PATHに追加しちまったよ# このやり方賢くない……
sh /usr/local/src/${nginx_configure_script}cd /usr/local/src/NGINX/${nginx_ver}make install
# とりあえずここまで前提手順
rbenv – rails 環境作成 » # watch -d tail /var/log/ngsw.log
参考URL
nginxとPassengerでRailsアプリを動かしたよ – Umeyashikiの日記
手順
nginx Configuration options
# nginx -V
nginx: nginx version: nginx/1.1.7 nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-51) nginx: TLS SNI support disabled nginx: configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/
gem install passenger (rbenv)
$ gem install passenger
$ cd ~/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/
$ tree -a ~/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/bin
/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/bin |-- passenger |-- passenger-config |-- passenger-install-apache2-module |-- passenger-install-nginx-module |-- passenger-make-enterprisey |-- passenger-memory-stats `-- passenger-status 0 directories, 7 files
install nginx module
$ ./passenger-install-nginx-module
1st
curl-devel が足りませんでした
Welcome to the Phusion Passenger Nginx module installer, v3.0.11. This installer will guide you through the entire installation process. It shouldn't take more than 5 minutes in total. Here's what you can expect from the installation process: 1. This installer will compile and install Nginx with Passenger support. 2. You'll learn how to configure Passenger in Nginx. 3. You'll learn how to deploy a Ruby on Rails application. Don't worry if anything goes wrong. This installer will advise you on how to solve any problems. Press Enter to continue, or Ctrl-C to abort. -------------------------------------------- Checking for required software... * GNU C++ compiler... found at /usr/bin/g++ * The 'make' tool... found at /usr/bin/make * A download tool like 'wget' or 'curl'... found at /usr/bin/wget * Ruby development headers... found * OpenSSL support for Ruby... found * RubyGems... found * Rake... found at /home/USER/.rbenv/versions/1.9.3-p0/bin/rake * rack... found * Curl development headers with SSL support... not found #curl-devel がない * OpenSSL development headers... found * Zlib development headers... found Some required software is not installed. But don't worry, this installer will tell you how to install them. Press Enter to continue, or Ctrl-C to abort. <br /> <ul> <li></li> </ul> Installation instructions for required software * To install Curl development headers with SSL support: Please run yum install curl-devel as root. #curl-devel をインストールしなさいね If the aforementioned instructions didn't solve your problem, then please take a look at the Users Guide: /home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/doc/Users guide Nginx.html
yum install curl-devel.x86_64
Installed: curl-devel.x86_64 0:7.15.5-9.el5_7.4 Dependency Installed: libidn-devel.x86_64 0:0.6.5-1.1 Complete!
2nd
nginx re-install
# diff -U0 ../nginx117/nginx_configure117.sh nginx_configure1112.sh
--- ../nginx117/nginx_configure117.sh 2011-11-12 11:07:47.000000000 +0900 +++ nginx_configure1112.sh 2012-01-08 00:26:47.000000000 +0900 @@ -3,2 +3,2 @@ -NGINX=nginx-1.1.7 -SOURCE_DIR=/usr/local/src/NGINX/nginx117 +NGINX=nginx-1.1.12 +SOURCE_DIR=/usr/local/src/NGINX/nginx1112 @@ -9,0 +10 @@ + --prefix='/usr/local/nginx' \ @@ -23,0 +25,2 @@ + --with-cc-opt='-Wno-error' \ + --add-module='/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx' \
/usr/local/src/NGINX/nginx1112/nginx_configure1112.sh
- ./configure ごにょごにょ && make
#!/bin/sh NGINX=nginx-1.1.12 SOURCE_DIR=/usr/local/src/NGINX/nginx1112 id nginx || sudo useradd -s /sbin/nologin -d /usr/local/nginx -M nginx cd $SOURCE_DIR/$NGINX [ -e "$SOURCE_DIR/$NGINX/Makefile" ] &amp;&amp; make clean ./configure \ --prefix='/usr/local/nginx' \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --pid-path=/var/run/nginx/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --user=nginx \ --group=nginx \ --with-http_stub_status_module \ --with-http_ssl_module \ --with-http_gzip_static_module \ --with-http_realip_module \ --http-log-path=/var/log/nginx/access.log \ --http-client-body-temp-path=/var/tmp/nginx/client/ \ --http-proxy-temp-path=/var/tmp/nginx/proxy/ \ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ --with-cc-opt='-Wno-error' \ --add-module='/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx' \ && make
# /usr/local/nginx/sbin/nginx -s stop
# cd /usr/local/src/NGINX/nginx1112/nginx-1.1.12
# make install
# /usr/local/nginx/sbin/nginx
# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.1.12 built by gcc 4.1.2 20080704 (Red Hat 4.1.2-51) TLS SNI support disabled configure arguments: --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --with-cc-opt=-Wno-error --add-module=/home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/nginx
ここまではあんま関係ないですね。
さて rails が以下のように配置されていたとして
/path/to/rails_root |-- Gemfile |-- Gemfile.lock |-- README |-- Rakefile |-- app |-- config |-- config.ru |-- db |-- doc |-- lib |-- log |-- public |-- script |-- test |-- tmp `-- vendor
nginx の設定ファイルは以下のようにした。
/etc/nginx/conf.d/rails.conf
#rails.conf
server {
listen 80;
server_name aaa.to;
access_log /var/log/nginx/aaa.to/access.log main;
error_log /var/log/nginx/aaa.to/error.log;
location / {
root /path/to/rails_root/public;
passenger_enabled on;
index index.html index.htm;
rails_env development;
}
}
/etc/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#passenger
passenger_root /home/USER/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/passenger-3.0.11;
passenger_ruby /home/USER/.rbenv/shims/ruby;
#passenger
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name __default;
}
#include_zone
include /etc/nginx/conf.d/rails.conf;
#include_zone
}
うごいた!!
上記手順のほぼ引き写し。
rbenv以降から。
rbenv exec gem install bundler cd /path/to/railsdir/ cat << EOS > Gemfile source "http://rubygems.org" gem "rails", "3.1.3" EOS bundle install --path vendor/bundle bundle exec rails new blog -d mysql rm -f Gemfile rm -f Gemfile.lock rm -rf .bundle cd blog bundle install --path vendor/bundle bundle exec rails g scaffold post title:string body:text
なんだけど、coffee-rails のところでエラーが出てしまったのでひとまず。
課題は Bundler と Gemfile の理解
続き。
「coffee-railsでエラーがでるよ」っていうのと、
そのあとにexecjsがおかしいよっていうのとあって。
- 「coffee-railsでエラーがでるよ」ってのはGemfileのバージョン指定の問題
- execjs は以下で対応可能
だった。
Rails 3.1 execjs and Could not find a JavaScript runtime – Stack Overflow
を参考にした。
- $ diff -uw Gemfile{.org,}
--- Gemfile.org 2012-01-03 14:24:53.000000000 +0900 +++ Gemfile 2012-01-03 14:29:34.000000000 +0900 @@ -6,6 +6,7 @@ # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' +gem 'therubyracer' # Gems used only for assets and not required
と gem ‘therubyracer’ を追記。
- $ bundle install –path vendor/bundle
(略)
Installing therubyracer (0.9.9) with native extensions
(略)
となっていたのを画面で確認。
- $ bundle exec rails g scaffold post title:string body:text
invoke active_record
create db/migrate/20120103053320_create_posts.rb
create app/models/post.rb
invoke test_unit
create test/unit/post_test.rb
create test/fixtures/posts.yml
route resources :posts
invoke scaffold_controller
create app/controllers/posts_controller.rb
invoke erb
create app/views/posts
create app/views/posts/index.html.erb
create app/views/posts/edit.html.erb
create app/views/posts/show.html.erb
create app/views/posts/new.html.erb
create app/views/posts/_form.html.erb
invoke test_unit
create test/functional/posts_controller_test.rb
invoke helper
create app/helpers/posts_helper.rb
invoke test_unit
create test/unit/helpers/posts_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/posts.js.coffee
invoke scss
create app/assets/stylesheets/posts.css.scss
invoke scss
create app/assets/stylesheets/scaffolds.css.scss
やったね
まとめると
rbenv exec gem install bundler cd /path/to/railsdir/ cat << EOS > Gemfile source "http://rubygems.org" gem "rails", "3.1.3" EOS bundle install --path vendor/bundle bundle exec rails new blog -d mysql rm -f Gemfile rm -f Gemfile.lock rm -rf .bundle cd blog vi Gemfile gem 'therubyracer' #追記 bundle install --path vendor/bundle bundle exec rails g scaffold post title:string body:text
rvm implode
yum install readline-devel.x86_64 libyaml.x86_64
git clone git://github.com/sstephenson/rbenv.git .rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile echo 'eval "$(rbenv init -)"' >> .bash_profile rbenv-install 1.9.3-p0 rbenv global 1.9.3-p0 rbenv versions gem install readline gem update gem update --system gem install rails pry pry-doc
virt-clone \
--connect=qemu:///system \
-o ${sourcehost} \
-n ${clonehost} \
-f /var/lib/libvirt/images/${clonehost}.img
genkernel all だろうが起動しない。
CDboot時には /dev/sda なのに、
カーネルコンパイル終えて起動すると /dev/hda としないと、
grub がきょとんとして実行されない。
genkernel.log を涙ながらに朗読をすることで、
カーネルのご機嫌を伺おうと考えたり、
クラシック音楽をかけながら優しい言葉をかけてコンパイルしてみたりと、
ほんとうに忙しい。
grubの設定は間違ってないと思うんだ
/dev/sda3 として設定した real_root を読み込めてないのが問題くさい
そこまではわかるんだけどね
rootfstype=ext3 って grub に書きやがれってことか
書いたよ書いてみたよ祈りながらexitしてumountしてrebootかますよ
キドウシナイ
(略) ∗ Starting udevd … [ok] ∗ Populating /dev with existing devices through uevents … [ok] ∗ Waiting for uevents to be processed … (ここで完全に停止する)
泣ける……。
udev をちょっと調べてみることにする。
2011/12/20 03:47 追記
って記事を涙ながらに書いてたら起動しそうになって嬉しい。
“Waiting for uevents to be processed” は本当に文字通りなんか頑張っていたようだ。
プログレスバーないんだもん。
(略) ∗ Waiting for uevents to be processed … [ok] (ここで停止してから15分くらいか) ∗ Mounting /dev/shm ... [ok] ∗ Setting system clock using the hardware clock [UTC] [ok] (あとで直さないと) ∗ Loading module pci_hotplug ... [ok] ∗ Autoloaded 1 module(s) ∗ Checking local filesystems ... /dev/hda3: clean, 254460/3523856 files, 907507/14093968 blocks /dev/hda1 was not cleanly unmounted, check forced. /dev/hda1: |=============================== \ 70.0% (また止まっとる (´・ω・`) )
うえええ
Facebook上で zonoise さんにいろいろ教えてもらってて。
で指摘受けたところをなおそうとしてたらハマったわけです、setIntervalの挙動に。
<script type="text/javascript">
var interval = 1000
for( var num = 0 ; num < 12 ; num ++ ){
alert("1:" + num); // 1
setInterval(function(){
alert("2:" + num); // 2
},interval);
alert("3:" + num); // 3
}
</script>
でbashでいうところの
interval=1
fuction setInterval()
{
sleep $1
}
for num in `seq 0 11`
do
echo "1:${num}"
echo "2:${num}"
setInterval ${interval}
echo "3:${num}"
done
みたいなのを想像してた。
1 → 2 → setInterval(つまりsleep) → 3 → 1 → 2 → setInterval(つまりsleep) → 3 …
と実行されるだろう、という期待をしてたので、
1 → 3 → setInterval(つまりsleep) → 1 → 3 → setInterval(つまりsleep) → 1 → 3 → setInterval(つまりsleep) … → 2 → 2 → 2 → …
みたいな挙動に面食らったわけです。
で、Twitter上でotherworldyさんにもアドバイス受けたりしてようやく理解したわけですねー。
for(i=0;i<10;i++){
setInterval(function(){ action(i); },INTERVAL);}
}
action2;
ってのは、
INTERVALが過ぎないとsetIntervalで括ったfunction(){ action(i) }は、
全く実行されないんですね。
でその外側においておいた for の i++ がどんどん実行されるがために、
action の引数として利用しようと考えていたfor文由来の変数iが、
forの想定した最大値まで達しちゃうわけですねー。
「じゃあお前は結局どうしたのか?」っていうと
for文を使うのをやめました。
そもそもsetIntervalがループの役目果たしてたので、
var i=0
setInterval(function(){
action(i);
if( i >= 10 ){ action2;}
i++;
},INTERVAL);}
}
としました。すげーすっきりした。
※ちなみに action2 には “window.location.reload();” を想定していた。
MrMEEE / bumblebee – GitHub
の例とかもあるし、明日は我が身だしちょっくら気になったので。
#!/bin/sh
function atat()
{
echo atat
for i in $@
do
echo $i
done
}
function dat()
{
echo dat
for i in "$@"
do
echo $i
done
}
function ast()
{
echo ast
for i in $*
do
echo $i
done
}
function dast()
{
echo dast
for i in "$*"
do
echo $i
done
}
atat 1 2 3 "4 5 6" 7 8 9 10
echo ""
dat 1 2 3 "4 5 6" 7 8 9 10
echo ""
ast 1 2 3 "4 5 6" 7 8 9 10
echo ""
dast 1 2 3 "4 5 6" 7 8 9 10
$ sh test.sh
atat
1
2
3
4
5
6
7
8
9
10
dat
1
2
3
4 5 6
7
8
9
10
ast
1
2
3
4
5
6
7
8
9
10
dast
1 2 3 4 5 6 7 8 9 10
個人的には $”@” が意図しているものに近いかな。