News for hackers. Stuff that matters.
Re:Shopify now on Rails 5.0. started 12 years ago on 0.5, th... by dankohn1 on Saturday January 21, 2017 @02:31AM (#13449270)
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/ [1] https://github.com/linuxfoundation/cii-best-practices-badge/... [2] 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 |
  +----------------------+--------+--------+---------+---------+-----+-------+
Re:Shopify now on Rails 5.0. started 12 years ago on 0.5, th... by dwheeler on Monday January 23, 2017 @11:25AM (#13463289)
Dan: 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 [1] https://github.com/linuxfoundation/cii-best-practices-badge/...

Re:Shopify now on Rails 5.0. started 12 years ago on 0.5, th... by technion on Saturday January 21, 2017 @06:14AM (#13449661)
If I can bother you with a dumb question, how do you produce these statistics?
Re:Shopify now on Rails 5.0. started 12 years ago on 0.5, th... by christophe971 on Saturday January 21, 2017 @06:46AM (#13449702)
bundle exec rake stats
Re:Shopify now on Rails 5.0. started 12 years ago on 0.5, th... by dasil003 on Saturday January 21, 2017 @12:08PM (#13450930)
Also, for discovery of a bunch more goodies:

bundle exec rake -T