My talk at Ruby Meetup Hamburg, January 10, 2018 19:00
hosted by XING (www.xing.com) Dammtorstrasse 29-32, 20354 Hamburg by
Description:
When a monolithic Rails app reaches a certain complexity, it becomes hard to understand what each part of code does. In this talk, I explained how to build a large rails app modularized by engines to enforce an internal dependency structure.
9. "The secret to building large apps is never build large
apps.
10. "The secret to building large apps is never build large
apps.
Break your applications into small pieces. Then,
assemble those testable, bite-sized pieces into your
big application"
- Justin Meyer
15. #!/bin/bash
result=0
cd "$( dirname "${BASH_SOURCE[0]}" )"
for test_script in $(find . -name test.sh); do
pushd `dirname $test_script` > /dev/null
./test.sh
result+=$?
popd > /dev/null
done
if [ $result -eq 0 ]; then
echo "SUCCESS"
else
echo "FAILURE"
fi
exit $result
build.sh
16. Benefits
● Component based architecture is complementary to good object oriented
practices
● Engines use namespaces
● It enforces an internal dependency structure
● Clean Gemfile
● Clean routes.rb
● Fast tests
● Working in large team
25. initializer :append_migrations do |app|
unless app.root.to_s.match root.to_s+File::SEPARATOR
config.paths['db/migrate'].expanded.each do |expanded_path|
app.config.paths['db/migrate'] << expanded_path
end
end
end
Migrations