Railsでグラフを作成したかったので、Open Flash Chartをインストールしようとした。
他のサイトを真似して、
$ ruby script/plugin install git://github.com/pullmonkey/open_flash_chart.git
のコマンドを打ったが、
ruby: No such file or directory -- script/plugin (LoadError)
と言われて、インストールできない。
どうやら、コマンドの使い方がバージョンアップで変わったとのこと。
【旧】
$ ruby script/plugin install git://github.com/pullmonkey/open_flash_chart.git
【新】
$ rails plugin install git://github.com/pullmonkey/open_flash_chart.git
【新】の方でインストールできた。
しかし、警告が新たに出ている。
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released.
置き場所が悪いか、Open Flash Chartが古いよ。
と言われているが、コレは後で考えよう。
ドキュメントは、ちゃんと読まんといかんな〜。
http://railsdoc.com/rails
しかも、Open Flash Chartは動かなかったので、
http://t-taira.hatenablog.com/entry/20101123/1290519039
を参考にGooglechartsをインストール。
環境:
Mac OS 10.6.8
$ rails -v
Rails 3.2.8
2012年8月28日火曜日
2012年8月20日月曜日
VirtualBoxのLinuxGuestAdditionalをCUIで
VirtualBoxのGuestAdditionalを、CUIでインストールする手順。
# mkdir /mnt/cdrom
# mount /dev/cdrom /mnt/cdrom
# cd /mnt/cdrom/
# ./VBoxLinuxAdditions.run
動作環境、ホスト=Win7、ゲスト=CentOS6.2.
# mkdir /mnt/cdrom
# mount /dev/cdrom /mnt/cdrom
# cd /mnt/cdrom/
# ./VBoxLinuxAdditions.run
動作環境、ホスト=Win7、ゲスト=CentOS6.2.
2012年8月5日日曜日
UbuntuでRubyOnRailsインストール手順簡易メモ
2012/08/05
この手順でHello World!は動いたが、
よく見ればrubyのバージョンが1.8.7で入っていた。
手持ちのテキスト推奨の1.9.2にしたいのだが、どうしたものか・・・。
============
開発環境は、Ubuntu 11.10
============
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
============
rubyのインストール
============
$ gem -v
プログラム 'gem' は以下のパッケージで見つかりました:
* ruby1.9.1
* rubygems
次の操作を試してください: sudo apt-get install <選択したパッケージ>
$ sudo apt-get install rubygems ruby1.9.1
:
略
:
============
railsのインストール
============
$ sudo gem install rails
Fetching: i18n-0.6.0.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.7.gem (100%)
:
略
:
Installing RDoc documentation for railties-3.2.7...
Installing RDoc documentation for bundler-1.1.5...
Installing RDoc documentation for rails-3.2.7...
$ rails -v
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Rails 3.2.7
============
サンプルアプリの作成(sqlite3が入っていないので失敗している)
============
$ rails new railbook
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
create
create README.rdoc
create Rakefile
:
略
:
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Enter your password to install the bundled RubyGems to your system:
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
:
略
:
Gem files will remain installed in /home/-----/.bundler/tmp/9013/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/-----/.bundler/tmp/9013/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
============
sqlite3のインストール
============
$ sudo apt-get install sqlite3
:
略
:
$ sudo apt-get install libsqlite3-dev
:
略
:
============
railsの実行(gemspecで日付形式が正しくないためエラーが出ている)
============
$ cd railbook
$ rails server
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Could not find tilt-1.3.3 in any of the sources
Run `bundle install` to install missing gems.
============
gemspecの書き換え
============
$sudo vi /var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec
$sudo vi /var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec
$sudo vi /var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec
$sudo vi /var/lib/gems/1.8/specifications/mail-2.4.4.gemspec
$sudo vi /var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec
$sudo vi /var/lib/gems/1.8/specifications/libv8-3.3.10.4-x86-linux.gemspec
各ファイルで、上から10行目くらいに【2011-08-25 00:00:00.000000000Z】という記述がある。
< s.date = %q{2011-08-25 00:00:00.000000000Z}
これを【2011-08-25】に書き換える。
> s.date = %q{2011-08-25}
この例では、【2011-08-25】であるが、日付はファイルごとに異なる。
日付は変えずに【 00:00:00.000000000Z】を削除する事。
============
railsの実行(JavaScriptのランタイムが見つからないので動かない)
============
$ rails server
/var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs.rb:5
from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
:
略
:
============
JavaScriptランタイムの設定
============
$vi Gemfile
ファイルの最後に下記の記述を追加する。
gem 'therubyracer'
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
:
略
:
============
railsの実行
============
$ rails server
=> Booting WEBrick
=> Rails 3.2.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-08-05 12:26:15] INFO WEBrick 1.3.1
[2012-08-05 12:26:15] INFO ruby 1.8.7 (2011-06-30) [i686-linux]
[2012-08-05 12:26:20] INFO WEBrick::HTTPServer#start: pid=21496 port=3000
動いた!
============
動作確認
============
http://localhost:3000
にブラウザアクセスすると、下のメッセージが表示されるはず。
Welcome aboard
You’re riding Ruby on Rails!
About your application’s environment
この手順でHello World!は動いたが、
よく見ればrubyのバージョンが1.8.7で入っていた。
手持ちのテキスト推奨の1.9.2にしたいのだが、どうしたものか・・・。
============
開発環境は、Ubuntu 11.10
============
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
============
rubyのインストール
============
$ gem -v
プログラム 'gem' は以下のパッケージで見つかりました:
* ruby1.9.1
* rubygems
次の操作を試してください: sudo apt-get install <選択したパッケージ>
$ sudo apt-get install rubygems ruby1.9.1
:
略
:
============
railsのインストール
============
$ sudo gem install rails
Fetching: i18n-0.6.0.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.7.gem (100%)
:
略
:
Installing RDoc documentation for railties-3.2.7...
Installing RDoc documentation for bundler-1.1.5...
Installing RDoc documentation for rails-3.2.7...
$ rails -v
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Rails 3.2.7
============
サンプルアプリの作成(sqlite3が入っていないので失敗している)
============
$ rails new railbook
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
create
create README.rdoc
create Rakefile
:
略
:
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Enter your password to install the bundled RubyGems to your system:
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
:
略
:
Gem files will remain installed in /home/-----/.bundler/tmp/9013/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/-----/.bundler/tmp/9013/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
============
sqlite3のインストール
============
$ sudo apt-get install sqlite3
:
略
:
$ sudo apt-get install libsqlite3-dev
:
略
:
============
railsの実行(gemspecで日付形式が正しくないためエラーが出ている)
============
$ cd railbook
$ rails server
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec]: invalid date format in specification: "2012-03-19 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec]: invalid date format in specification: "2012-04-03 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z"
Could not find tilt-1.3.3 in any of the sources
Run `bundle install` to install missing gems.
============
gemspecの書き換え
============
$sudo vi /var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec
$sudo vi /var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec
$sudo vi /var/lib/gems/1.8/specifications/jquery-rails-2.0.2.gemspec
$sudo vi /var/lib/gems/1.8/specifications/mail-2.4.4.gemspec
$sudo vi /var/lib/gems/1.8/specifications/sass-rails-3.2.5.gemspec
$sudo vi /var/lib/gems/1.8/specifications/libv8-3.3.10.4-x86-linux.gemspec
各ファイルで、上から10行目くらいに【2011-08-25 00:00:00.000000000Z】という記述がある。
< s.date = %q{2011-08-25 00:00:00.000000000Z}
これを【2011-08-25】に書き換える。
> s.date = %q{2011-08-25}
この例では、【2011-08-25】であるが、日付はファイルごとに異なる。
日付は変えずに【 00:00:00.000000000Z】を削除する事。
============
railsの実行(JavaScriptのランタイムが見つからないので動かない)
============
$ rails server
/var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /var/lib/gems/1.8/gems/execjs-1.4.0/lib/execjs.rb:5
from /var/lib/gems/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
:
略
:
============
JavaScriptランタイムの設定
============
$vi Gemfile
ファイルの最後に下記の記述を追加する。
gem 'therubyracer'
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
:
略
:
============
railsの実行
============
$ rails server
=> Booting WEBrick
=> Rails 3.2.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-08-05 12:26:15] INFO WEBrick 1.3.1
[2012-08-05 12:26:15] INFO ruby 1.8.7 (2011-06-30) [i686-linux]
[2012-08-05 12:26:20] INFO WEBrick::HTTPServer#start: pid=21496 port=3000
動いた!
============
動作確認
============
http://localhost:3000
にブラウザアクセスすると、下のメッセージが表示されるはず。
Welcome aboard
You’re riding Ruby on Rails!
About your application’s environment
登録:
投稿 (Atom)