Continuous Integration
   For Rails Project
       IN-SRC Studio
        Louie Zhao
Continuous Integration

• A software development practice
  where members of a team integrate
  their work frequently
• Ea...
Firefox Tinderbox
http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox
Continuous Integration
• Maintain a code repository
• Automate the build
• Every commit should be built
• Make the build s...
CI Solutions for Rails


• CruiseControl.rb             http://cruisecontrolrb.thoughtworks.com/



• Cerberus    http://c...
Integrity


• light-weighted
• easy to configure
• good support for git
• works on our own install.
Integrity
                                           Production


developer   Git Push
                              git
 ...
Integrity - Installation

• Server Configuration
 • SUSE Linux
 • Apache
 • Passenger
 • MySQL 5.x
Integrity - Build

• The building environment is almost
  identical to your development
  environment

 • Standalone CI se...
Integrity - Installation
 http://www.in-src.com/continuous_integration_for_rails_project




• $ gem install --passenger i...
Integrity - Source


• local git repository
  •   /var/git/[project-name].git



• remote git repository
  •   ssh://[user...
Integrity - Git Hook Up


• git post-receive
• POST_RECEIVE_URL
• Daemons
Integrity - Email
  Notification
Integrity - Build
Integrity - Build
Integrity - Build
Integrity



• Trouble Shooting
   • http://www.in-src.com/
      continuous_integration_for_rails_project
Metric Fu

• a set of rake tasks
• Saikuro, Flog, Flay, Rcov, Reek, Roodi
• sudo gem install jscruggs-metric_fu
• rake met...
Metric Fu - Configuration
Metric Fu
Rcov
Rcov
Churn
Flay
Flog
       The higher
       the score, the
       harder it is to
       test
Flog
    Code                   Seen as flog                        flog report

class Test          class Test             ...
Reek

• detects common code smells
                              might be hard to read,
 •   Class Variable           main...
Reek
Duplication                       Feature Envy

def double_thing()                class Cart
  @other.thing + @other....
Reek
Roodi
Roodi
• warns you about design issues
 •   AssignmentInConditionalCheck

 •   CaseMissingElseCheck

 •   ClassLineCountChe...
Stats
Thank You!
louiezhao@in-src.com
Upcoming SlideShare
Loading in...5
×

Continuous Integration For Rails Project

4,844

Published on

introduce continuous integration into the development process. choose integrity since it’s light-weighted, easy to configure, good support for git and works for ourselves on our own install.

Published in: Technology
2 Comments
15 Likes
Statistics
Notes
No Downloads
Views
Total Views
4,844
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
90
Comments
2
Likes
15
Embeds 0
No embeds

No notes for slide
  • Continuous Integration For Rails Project

    1. 1. Continuous Integration For Rails Project IN-SRC Studio Louie Zhao
    2. 2. Continuous Integration • A software development practice where members of a team integrate their work frequently • Each integration is verified by an automated build (including test) • significantly reduced integration problems
    3. 3. Firefox Tinderbox http://tinderbox.mozilla.org/showbuilds.cgi?tree=Firefox
    4. 4. Continuous Integration • Maintain a code repository • Automate the build • Every commit should be built • Make the build self-testing • Keep the build fast • Everyone can see the results
    5. 5. CI Solutions for Rails • CruiseControl.rb http://cruisecontrolrb.thoughtworks.com/ • Cerberus http://cerberus.rubyforge.org/ • Run Code Run http://runcoderun.com/ • Integrity http://integrityapp.com/
    6. 6. Integrity • light-weighted • easy to configure • good support for git • works on our own install.
    7. 7. Integrity Production developer Git Push git Build Notification developer repository developer developer CI Server Email Notification
    8. 8. Integrity - Installation • Server Configuration • SUSE Linux • Apache • Passenger • MySQL 5.x
    9. 9. Integrity - Build • The building environment is almost identical to your development environment • Standalone CI server • DB Server • rake ci WITH_PACKAGE_TEST=1
    10. 10. Integrity - Installation http://www.in-src.com/continuous_integration_for_rails_project • $ gem install --passenger integrity • $ integrity install [integrity-diretory] • $ integrity migrate_db config.yml
    11. 11. Integrity - Source • local git repository • /var/git/[project-name].git • remote git repository • ssh://[user]@[hostname]/var/git/[project-name].git
    12. 12. Integrity - Git Hook Up • git post-receive • POST_RECEIVE_URL • Daemons
    13. 13. Integrity - Email Notification
    14. 14. Integrity - Build
    15. 15. Integrity - Build
    16. 16. Integrity - Build
    17. 17. Integrity • Trouble Shooting • http://www.in-src.com/ continuous_integration_for_rails_project
    18. 18. Metric Fu • a set of rake tasks • Saikuro, Flog, Flay, Rcov, Reek, Roodi • sudo gem install jscruggs-metric_fu • rake metrics:all • generate metrics reports
    19. 19. Metric Fu - Configuration
    20. 20. Metric Fu
    21. 21. Rcov
    22. 22. Rcov
    23. 23. Churn
    24. 24. Flay
    25. 25. Flog The higher the score, the harder it is to test
    26. 26. Flog Code Seen as flog flog report class Test class Test Test#blah: (11.2) def blah def blah # 11.2 = 6.0: eval a = eval "1+1" a = eval "1+1" # 1.2 + 6.0 + 1.2: branch if a == 2 then if a == 2 then # 1.2 + 1.2 + 0.4 + 1.2: == puts "yay" puts "yay" # 1.2 1.2: puts end end 1.2: assignment end end 0.4: lit_fixnum end end
    27. 27. Reek • detects common code smells might be hard to read, • Class Variable maintain or evolve, • Control Couple rather than things that are specifically • Data Clump wrong • Duplication • Feature Envy • Large Class • Long Method • Long Parameter List • Nested Iterators • Simulated Polymorphism • Uncommunicative Name • Utility Function
    28. 28. Reek Duplication Feature Envy def double_thing() class Cart @other.thing + @other.thing def price end @item.price + @item.tax end end def double_thing() class Cart thing = @other.thing def price thing + thing @item.price_with_tax end end end class Item def price_with_tax price + tax end end
    29. 29. Reek
    30. 30. Roodi
    31. 31. Roodi • warns you about design issues • AssignmentInConditionalCheck • CaseMissingElseCheck • ClassLineCountCheck • ClassNameCheck • CyclomaticComplexityBlockCheck • CyclomaticComplexityMethodCheck • EmptyRescueBodyCheck • ForLoopCheck • MethodLineCountCheck • MethodNameCheck • ModuleLineCountCheck • ModuleNameCheck • ParameterNumberCheck
    32. 32. Stats
    33. 33. Thank You! louiezhao@in-src.com
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×