1
1

More than 5 years have passed since last update.

`padrino g` で activesupport のバージョンエラーが出る

Last updated at Posted at 2014-01-31

Padrino 0.11.4

チュートリアルの最初、プロジェクトの作成でいきなりずっこけてしまった。
* http://www.padrinorb.com/guides/blog-tutorial


$ padrino g project sample_blog -t shoulda -e haml -c sass -s jquery -d activerecord -b

/Users/tmd45/.rbenv/versions/1.9.3-p448/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:2064:in `raise_if_conflicts': Unable to activate padrino-core-0.11.4, because activesupport-4.0.0 conflicts with activesupport (< 4.0, >= 3.1) (Gem::LoadError)
...

別途 Rails 4 をインストールしてたことで gem に activesupport 4.0 が入ってたのだけど、Padrino が、自分が対応してるバージョン 3.x じゃなくて 4.0 の方を見に行っちゃってるっぽい。


$ gem list -l

...
activesupport (4.0.0, 3.2.16, 3.2.13)
...

すでに issue は対応されてて、 Padrino 0.12 からは activesupport 4 も使えるようになるらしい。
* https://github.com/padrino/padrino-framework/issues/1450
* https://github.com/padrino/padrino-framework/pull/1414

対策

gem のソースに手を入れてもいいのだけど、ひとまず Gemfile に自分でバージョン書いて bundle を使う。

source 'https://rubygems.org'

gem 'padrino', '0.11.4'
gem 'activesupport', '3.2.16'

$ bundle install

Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Enter your password to install the bundled RubyGems to your system:
Using i18n (0.6.9)
Installing multi_json (1.8.4)
Using activesupport (3.2.16)
Using bundler (1.3.5)
Using rack (1.5.2)
Using url_mount (0.2.1)
Using http_router (0.11.0)
Installing mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Installing rack-protection (1.5.2)
Using tilt (1.4.1)
Using sinatra (1.4.4)
Using thor (0.17.0)
Using padrino-core (0.11.4)
Using padrino-helpers (0.11.4)
Using padrino-admin (0.11.4)
Using padrino-cache (0.11.4)
Using padrino-gen (0.11.4)
Using padrino-mailer (0.11.4)
Using padrino (0.11.4)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

んで、bundle exec で padrino を使う。


$ bundle exec padrino g project sample_blog -t shoulda -e haml -c sass -s jquery -d activerecord -b

      create
      create  .gitignore
      create  config.ru
      create  config/apps.rb
      create  config/boot.rb
      create  public/favicon.ico
      create  public/images
      create  public/javascripts
      create  public/stylesheets
      create  tmp
      create  .components
      create  app
      create  app/app.rb
      create  app/controllers
      create  app/helpers
      create  app/views
      create  app/views/layouts
      create  Gemfile
      create  Rakefile
    applying  activerecord (orm)...
       apply  orms/activerecord
      insert  Gemfile
      insert  Gemfile
      insert  app/app.rb
      create  config/database.rb
    applying  shoulda (test)...
       apply  tests/shoulda
      insert  Gemfile
      insert  Gemfile
      create  test/test_config.rb
      create  test/test.rake
    skipping  mock component...
    applying  jquery (script)...
       apply  scripts/jquery
      create  public/javascripts/jquery.js
      create  public/javascripts/jquery-ujs.js
      create  public/javascripts/application.js
    applying  haml (renderer)...
       apply  renderers/haml
      insert  Gemfile
    applying  sass (stylesheet)...
       apply  stylesheets/sass
      insert  Gemfile
      insert  app/app.rb
      create  lib/sass_initializer.rb
      create  app/stylesheets
   identical  .components
       force  .components
       force  .components
Bundling application dependencies using bundler...
         run  bundle install from "."
Could not find gem 'shoulda (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

=================================================================
sample_blog is ready for development!
=================================================================
$ cd ./sample_blog
=================================================================

ぬ。プロジェクトルートのつもりで作ったディレクトリの、さらに内側にプロジェクトができちゃった。
まぁいいや。

チュートリアルを進めてみる

チュートリアル通りに app/app.rb にコードを追加。
チュートリアルのコードと generate されたコードがちょびっと違う。バージョンアップで変わったのかな。

よく見たら shoulda とか一部の gem が無いと怒られている(普段使ってない)ので随時 Gemfile に追加、bundle install/update した。
あとでちゃんとプロジェクトを genarate するときには、自分が使いたいものを使うから適当に。

管理画面機能の追加も行って、いざサーバ起動。


$ bundle exec padrino start

別プロジェクトで port 3000 を使ってたので怒られた(当たり前である)。
起動時に port 番号を指定できる(--help で利用可能なオプションを確認できる)。


$ bundle exec padrino start -p 3001

=> Padrino/0.11.4 has taken the stage development at http://127.0.0.1:3001
[2014-01-31 11:21:41] INFO  WEBrick 1.3.1
[2014-01-31 11:21:41] INFO  ruby 1.9.3 (2013-06-27) [x86_64-darwin12.4.0]
[2014-01-31 11:21:41] INFO  WEBrick::HTTPServer#start: pid=48236 port=3001
  DEBUG -       GET (0.0159s) / - 200 OK
  DEBUG -       GET (0.0010s) / - 200 OK
  DEBUG -       GET (0.0032s) /about_us - 200 OK

うごいたー。

1
1
1

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
1
1