4 ms·
My holiday project was to upgrade a Rails project I helped create to Rails 5. The BadgeApp [0] is used to certify open source projects as satisfying the Core In
by dankohn1 10y ago
My holiday project was to upgrade a Rails project I helped create to Rails 5. The BadgeApp [0] is used to certify open source projects as satisfying the Core Infrastructure Initiative's Best Practices Badge. It is open source, so you can see the diff [1] if you're interested. The upgrade took me several hours, and was greatly assisted by our 99% test coverage. Biggest line count change was from needing to explicitly specify params in tests. The biggest annoyance was that Fastly's gem still doesn't support Rails 5, so I needed to fork it [2].
I too am hugely appreciative of the Rails ecosystem.
[0] https://github.com/linuxfoundation/cii-best-practices-badge/ https://github.com/linuxfoundation/cii-best-practices-badge/
[1] https://github.com/linuxfoundation/cii-best-practices-badge/commit/405e012f433814e049f0198b12841d008740b84b https://github.com/linuxfoundation/cii-best-practices-badge/...
[2] https://github.com/fastly/fastly-rails/pull/67 https://github.com/fastly/fastly-rails/pull/67
Here are the app statistics:
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 687 | 476 | 8 | 59 | 7 | 6 |
| Helpers | 184 | 134 | 0 | 21 | 0 | 4 |
| Models | 711 | 470 | 5 | 55 | 11 | 6 |
| Mailers | 160 | 115 | 3 | 12 | 4 | 7 |
| Javascripts | 405 | 308 | 0 | 35 | 0 | 6 |
| Libraries | 369 | 281 | 0 | 0 | 0 | 0 |
| Tasks | 369 | 281 | 0 | 0 | 0 | 0 |
| Controller tests | 605 | 513 | 6 | 53 | 8 | 7 |
| Helper tests | 56 | 45 | 2 | 7 | 3 | 4 |
| Model tests | 398 | 309 | 9 | 37 | 4 | 6 |
| Mailer tests | 71 | 54 | 4 | 5 | 1 | 8 |
| Integration tests | 614 | 446 | 10 | 25 | 2 | 15 |
+----------------------+--------+--------+---------+---------+-----+-------+
| Total | 4629 | 3432 | 47 | 309 | 6 | 9 |
+----------------------+--------+--------+---------+---------+-----+-------+
- technion 10y agoIf I can bother you with a dumb question, how do you produce these statistics?
- christophe971 10y agobundle exec rake stats
- dasil003 10y agoAlso, for discovery of a bunch more goodies: bundle exec rake -T
- dwheeler 10y agoDan: Thanks again for your work (I also work on BadgeApp)! One other important change due to the Rails 5 upgrade was that because jquery-turbolinks doesn't support Rails 5 [0], we eventually had to drop both jquery-turbolinks and turbolinks. If you're using jquery-turbolinks, you may also need to drop both jquery-turbolinks and turbolinks. Turbolinks doesn't work correctly with many JavaScript libraries (causing no end of subtle bugs), and in our case the performance boost turbolinks is supposed to provide, so turbolinks just wasn't worth the trouble anyway. Good riddance. Rails 5 has some nice additions. I particularly appreciate that Rails 5 has two new security hardening mechanisms to reduce the risk of CSRF security vulnerabilities: per-form CSRF tokens and origin-checking CSRF mitigation. We use a number of mechanisms to make our application secure [1]. The application doesn't have many LOC, but we do work to keep it that way. We try to reuse code where it makes sense, and always try to keep it simple. Still, it doesn't take many lines to create a useful app, and that's a good thing. [0] https://github.com/kossnocorp/jquery.turbolinks/issues/56 https://github.com/kossnocorp/jquery.turbolinks/issues/56 [1] https://github.com/linuxfoundation/cii-best-practices-badge/blob/master/doc/security.md https://github.com/linuxfoundation/cii-best-practices-badge/...