20140925 rails pacific

Preview:

Citation preview

Crafting Rails Culture to Your Company

Hiroshi SHIBATA @hsbt

RailsPacific

Thank you!

SHIBATA Hiroshi @hsbt

TokyoMatze

RailsGirls in Japan

asakusa.rb

RubyKaigi 2014

RubyConf Taiwan 2014

RedDotRubyConf 2014

RailsPacific

OedoRubyKaigi04

Ruby Committer

ruby rubygems rake rdoc psych syck ruby-build

railsgirls railsgirls-jp kaminari tdiary hiki jenkins.rb fastladder

commit bit collector

My work of Ruby 2.2.0Update test-unit and minitest (removed from repository but bundled in tarball)

coordinate to Ruby committers negotiate to sponsors make development environment

A long time ago..

Pepabo

Hosting EC Media

Over 250 people

organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations

— M. Conway

PHPMySQL5

PHPMySQL4

Ruby and PHPRails

MySQL5

Pepabo

ミドルウェアのアップグレード

社内開発基盤の構築

統計基盤の構築JSOXの運用整備

github

セキュリティ監査コードレビューテスト基盤の構築

アクセス解析基盤の構築

開発プロセス

新人教育原稿執筆

カンファレンス発表

OSS開発 サーバー構成管理の刷新

リーンスタートアップ

Jenkins

Ruby/Rails

RDBMS

技術基盤チーム

Pepabo

技術基盤チーム

PHPMySQL5

PHPMySQL4

Ruby and PHPRails

MySQL5

RubyRails

MySQL5

RubyRails

MySQL5

Ruby and PHPRails

MySQL5

Pepabo

技術基盤チーム

Why Ruby?

3. references

Why Ruby?

2. environment1. testing

Testing

3. rspec

powerful testing framework

2. minitest1. test-unit

Capybara

1) Failure:TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]: assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } | | | | | | | | | Array | | | [1, 2, 3] | | #<Enumerator: 3:times> | 3 String

Power Assert

1) Failure:TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]: assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } | | | | | | | | | Array | | | [1, 2, 3] | | #<Enumerator: 3:times> | 3 String

class TestPowerAssert < Minitest::Test def test_power_assert_failed assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } end end

testcase

assertion

3. run test -> fail -> detect fail reason

Typical usecase

2. add inspection code

1. run test -> fail

5. run test -> success

4. fix code

3. run test -> fail -> detect fail reason

Typical usecase

2. add inspection code

1. run test -> fail

5. run test -> fail!!! -> turn to 2

4. fix code

Typical usecase1. run test -> fail

5. run test -> fail!!! -> turn to 4

4. fix code

1) Failure:TestPowerAssert#test_power_assert_failed [test/test_power_assert.rb:10]: assert { "0".class == "3".to_i.times.map {|i| i + 1 }.class } | | | | | | | | | Array | | | [1, 2, 3] | | #<Enumerator: 3:times> | 3 String

Development Environment

2. rbenv + ruby-build1. osx + homebrew

Many references

Rails Good Parts

Why Rails?

3. admin integration

Why Rails?

2. oss way1. modern architecture

enforce modern architecture

case.1 Ruby 1.8.6 to Ruby 2.1.2

Ruby 1.8.6Rails 2.0.2

Ruby 2.1.3Rails 4.1.6 new!

Ruby1.8.6 1.8.7 1.9.3 2.0.0 2.1

Rails

2.0/2.1

2.3

3.0

3.2

4.0/4.1

KyotoTycoon to

memcached

case.2 replace legacy middleware

app1

app2

begin require 'dalli' rescue LoadError => e $stderr.puts "You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install" raise e end

rails4 need to dalli

kyoto tycoon is slower than mysql…

dalli is not support to kyoto tycoon…

enforce oss way

RubyRails

MySQL5

RubyRails

MySQL5

Ruby and PHPRails

MySQL5

Pepabo

技術基盤チーム

class Bar def bar(foo = foo()) foo end

def buzz(foo = foo) foo end

def foo :buzz endend

p Bar.new.barp Bar.new.buzz

% ruby -v r45272.rbruby 2.2.0dev (2014-04-13 trunk 45580) [x86_64-darwin13]:buzznil

% ruby -v r45272.rbruby 2.1.2p80 (2014-03-01 revision 45231) [x86_64-darwin13.0]:buzz:buzz

admin integration

3. no console

What’s admin?

2. payment/refund1. customer support

organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations

— M. Conway

Developer DirectorCustomerSupport

Our Typical Team

unmaintained…

3. other app

better admin

2. Rails Engine1. app internal

app internalpros better testing better deploy

cons including difference application including effective code

Rails Enginepros splitting application code better deploy

cons difficulty testing can’t use production code directly

Other apppros definitely splitting app

cons separated develop cycle duplicated code

No silver bullet

Rails like a phpMySQL5

Railslike a javaMySQL5

Railslike a phpMySQL5

Optimize Your Company

技術基盤チーム

Lern to Rails

Internal step by

step

Lern to Active Record Internal

github workflow

ChatOps

github issue

costomer’s contact

nagios

DevOps

Go to the next

10 years