malclocke / fulcrum https://github.com/malclocke/fulcrum
前提条件:homebrew
, rbenv
が既に入っている環境
コードをとってくる
$ git clone git://github.com/malclocke/fulcrum.git
Cloning into 'fulcrum'...
remote: Reusing existing pack: 5478, done.
remote: Total 5478 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (5478/5478), 2.27 MiB | 784.00 KiB/s, done.
Resolving deltas: 100% (2465/2465), done.
Checking connectivity... done.
$ cd fulcrum/
rubyのバージョン問題
$ bundle install
Your Ruby version is 2.1.1, but your Gemfile specified 2.0.0
$ rbenv versions
system
* 2.1.1 (set by /Users/foo9/.rbenv/version)
rubyの2.0.0をインストール
$ rbenv install 2.0.0-p451
Downloading ruby-2.0.0-p451.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/9227787a9636551f1749ee8394b5ffe5
Installing ruby-2.0.0-p451...
Installed ruby-2.0.0-p451 to /Users/foo9/.rbenv/versions/2.0.0-p451
$ rbenv local 2.0.0-p451
$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin13.1.0]
$ gem install bundler
Fetching: bundler-1.5.3.gem (100%)
Successfully installed bundler-1.5.3
Parsing documentation for bundler-1.5.3
Installing ri documentation for bundler-1.5.3
1 gem installed
もう一度
$ bundle install
:
省略
:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/foo9/.rbenv/versions/2.0.0-p451/bin/ruby extconf.rb
Command 'qmake -spec macx-g++' not available
Gem files will remain installed in /Users/foo9/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/capybara-webkit-1.0.0 for inspection.
Results logged to /Users/foo9/.rbenv/versions/2.0.0-p451/lib/ruby/gems/2.0.0/gems/capybara-webkit-1.0.0/./gem_make.out
An error occurred while installing capybara-webkit (1.0.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.0.0'` succeeds before bundling.
beer:fulcrum foo9$ gem install capybara-webkit -v '1.0.0'
Building native extensions. This could take a while...
ERROR: Error installing capybara-webkit:
ERROR: Failed to build gem native extension.
/Users/foo9/.rbenv/versions/2.0.0-p451/bin/ruby extconf.rb
Command 'qmake -spec macx-g++' not available
capybara-webkitで使うqtが無くてこける。qtをインストール
$ brew install qt
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/qt-4.8.5.mavericks.bottle.4.tar.gz
######################################################################## 100.0%
==> Pouring qt-4.8.5.mavericks.bottle.4.tar.gz
==> Caveats
We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
==> Summary
? /usr/local/Cellar/qt/4.8.5: 2780 files, 120M
もう一度
$ bundle install
:
省略
:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/foo9/.rbenv/versions/2.0.0-p451/bin/ruby extconf.rb
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
:
省略
:
mysqlが無くてこける。mysqlをインストール
$ brew install mysql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.16.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql-5.6.16.mavericks.bottle.tar.gz
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
==> /usr/local/Cellar/mysql/5.6.16/bin/mysql_install_db --verbose --user=foo9 --basedir=/usr/local/Cellar/mysql/5.6.16 --datadir=/usr/l
==> Summary
? /usr/local/Cellar/mysql/5.6.16: 9425 files, 349M
mysql初期設定とかしてない。。。
もう一度
$ bundle install
:
省略
:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/foo9/.rbenv/versions/2.0.0-p451/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
:
省略
:
postgresqlが無くてこける。postgresqlをインストール
$ brew install postgresql
==> Installing dependencies for postgresql: readline, ossp-uuid
==> Installing postgresql dependency: readline
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/readline-6.2.4.mavericks.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring readline-6.2.4.mavericks.bottle.2.tar.gz
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
? /usr/local/Cellar/readline/6.2.4: 31 files, 1.6M
==> Installing postgresql dependency: ossp-uuid
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/ossp-uuid-1.6.2.mavericks.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring ossp-uuid-1.6.2.mavericks.bottle.1.tar.gz
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.
OS X provides a uuid.h which conflicts with ossp-uuid's header.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/ossp-uuid/lib
CPPFLAGS: -I/usr/local/opt/ossp-uuid/include
==> Summary
? /usr/local/Cellar/ossp-uuid/1.6.2: 15 files, 228K
==> Installing postgresql
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/postgresql-9.3.4.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring postgresql-9.3.4.mavericks.bottle.tar.gz
==> Caveats
If builds of PostgreSQL 9 are failing and you have version 8.x installed,
you may need to remove the previous version first. See:
https://github.com/Homebrew/homebrew/issues/issue/2510
To migrate existing data from a previous major version (pre-9.3) of PostgreSQL, see:
http://www.postgresql.org/docs/9.3/static/upgrading.html
When installing the postgres gem, including ARCHFLAGS is recommended:
ARCHFLAGS="-arch x86_64" gem install pg
To install gems without sudo, see the Homebrew wiki.
To have launchd start postgresql at login:
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
Then to load postgresql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Or, if you don't want/need launchctl, you can just run:
postgres -D /usr/local/var/postgres
==> /usr/local/Cellar/postgresql/9.3.4/bin/initdb /usr/local/var/postgres
==> Summary
? /usr/local/Cellar/postgresql/9.3.4: 2928 files, 38M
もう一度
$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching additional metadata from http://rubygems.org/..
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.2)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.2)
Using bcrypt-ruby (3.1.2)
Using mini_portile (0.5.2)
Using nokogiri (1.6.0)
Using xpath (2.0.0)
Using capybara (2.1.0)
Using json (1.8.1)
Using capybara-webkit (1.0.0)
Using ffi (1.9.3)
Using childprocess (0.3.9)
Using chunky_png (1.2.9)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.2)
Using coffee-rails (4.0.1)
Using fssm (0.2.10)
Using sass (3.2.12)
Using compass (0.12.2)
Using compass-rails (1.1.3)
Using configuration (1.3.2)
Using database_cleaner (1.2.0)
Using orm_adapter (0.4.0)
Using warden (1.2.3)
Using devise (3.2.0)
Using diff-lcs (1.2.5)
Using ejs (1.1.1)
Using factory_girl (4.3.0)
Using factory_girl_rails (4.3.0)
Using hike (1.2.3)
Using jasmine-core (1.3.1)
Using rspec-core (2.14.7)
Using rspec-expectations (2.14.4)
Using rspec-mocks (2.14.4)
Using rspec (2.14.1)
Using rubyzip (1.0.0)
Using websocket (1.0.7)
Using selenium-webdriver (2.37.0)
Using jasmine (1.3.2)
Using jbuilder (1.5.2)
Using jquery-rails (3.0.4)
Using jquery-ui-rails (4.1.0)
Using mysql2 (0.3.14)
Installing pg (0.17.0)
Using bundler (1.5.3)
Installing tilt (1.4.1)
Installing sprockets (2.10.1)
Installing sprockets-rails (2.0.1)
Installing rails (4.0.2)
Installing rails-i18n (4.0.0)
Installing rails-observers (0.1.2)
Installing rails_serve_static_assets (0.0.2)
Installing rails_stdout_logging (0.0.3)
Installing rails_12factor (0.0.2)
Installing rspec-rails (2.14.0)
Installing sass-rails (4.0.1)
Installing sqlite3 (1.3.8)
Installing transitions (0.1.9)
Installing uglifier (2.3.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ bundle exec rake fulcrum:setup db:setup
cp /Users/foo9/Labo/fulcrum/config/database.yml.sqlite /Users/foo9/Labo/fulcrum/config/database.yml
-- create_table("changesets", {:force=>true})
-> 0.0074s
-- create_table("notes", {:force=>true})
-> 0.0014s
-- create_table("projects", {:force=>true})
-> 0.0028s
-- create_table("projects_users", {:id=>false, :force=>true})
-> 0.0010s
-- create_table("stories", {:force=>true})
-> 0.0014s
-- create_table("users", {:force=>true})
-> 0.0017s
-- add_index("users", ["confirmation_token"], {:name=>"index_users_on_confirmation_token", :unique=>true})
-> 0.0009s
-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
-> 0.0009s
-- add_index("users", ["reset_password_token"], {:name=>"index_users_on_reset_password_token", :unique=>true})
-> 0.0010s
-- initialize_schema_migrations_table()
-> 0.0029s
ローカルサーバー起動
$ bundle exec rails server
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-03-25 12:34:12] INFO WEBrick 1.3.1
[2014-03-25 12:34:12] INFO ruby 2.0.0 (2014-02-24) [x86_64-darwin13.1.0]
[2014-03-25 12:34:12] INFO WEBrick::HTTPServer#start: pid=51091 port=3000
username
test@example.com
password
testpass
ほんとは仮想環境とかでやるんだろうなぁ。。