[v4] Cleaning up test environment for Rails 5.0+#366
[v4] Cleaning up test environment for Rails 5.0+#366mattbrictson merged 15 commits intobootstrap-ruby:masterfrom
Conversation
|
Thanks for working on this! I haven't had a chance to dig into the code yet but I have a couple quick notes:
|
| - 2.1 | ||
| - 2.2 | ||
| - 2.3.1 | ||
| - 2.2.7 |
There was a problem hiding this comment.
Can we drop 2.2 as well?
There was a problem hiding this comment.
Rails 5.0+ and 5.2+ is still 2.2.2+ We're targeting that: https://rubygems.org/gems/rails/
There was a problem hiding this comment.
Ruby 2.2 will officially be EOL at the end of March 2018, and so I saw this as an opportunity to prune. I would like to be in the habit of aggressively dropping support for EOL Rubies. Even if Rails supports it, I'd be fine dropping it now, a couple months ahead of schedule.
There was a problem hiding this comment.
If Rails still supports 2.2.2 I don't see why we should restrict it. Maybe some still choose to run 2.2 for some crazy reason. When Rails drops it, we can drop it too.
There was a problem hiding this comment.
I'm for supporting what Rails supports, back to Rails 5.0 as we've agreed.
| - 2.2.7 | ||
| - 2.3.5 | ||
| - 2.4.2 | ||
| - 2.5.0 |
There was a problem hiding this comment.
What do you think about adding ruby-head?
There was a problem hiding this comment.
Only if you're adding Rails.master. You're testing a dependency of a dependency at that point. Plus you need to allow failures of it too. Not much of a value.
There was a problem hiding this comment.
I don't like getting blindsided by bugs whenever a new version of Ruby is released (even a prominent project like spring is susceptible, it seems), and therefore would appreciate the advance notice that ruby-head would give us. And indeed, Rails 5-1-stable does in fact test against ruby-head. But it is an allowed failure. If we that means we have to make it an allowed failure as well, than I agree it is of little value. I'll leave it up to you. Thanks for the feedback!
There was a problem hiding this comment.
Easy enough to add ruby-head. Travis will run a bit slower. I'll add one bleeding-edge job.
|
@mattbrictson I'll put danger thing back into travis config. Dummy app is valuable for debugging html generated by the gem as you can see output in directly the browser. Way easier to work with. I got dummy working, so I'll add basic form there. |
I agree this is valuable, so long as you don't think the dummy app will be a maintenance burden. Knowing that maintainers of this project come and go, it is something to consider. If we keep it around, could you make sure instructions for making using of the dummy app as an aid to development is explained in |
|
@mattbrictson Neah, dummy app is generally not a big deal. Sometimes you need to tweak application config to work for all Rails versions. I have it running for 5.0, 5.1, 5.2 with very few tweaks. I left README in there explaining what files were changed. Contributing.md is edited to include bit about how to use dummy app for dev/debugging. I think this PR is ready to be reviewed. After this PR is merged, next step is to create a horizontal form inside dummy app, add some errors to the model and see what needs to be fixed. |
mattbrictson
left a comment
There was a problem hiding this comment.
I won't have time to go through the whole PR today but what I read looks great so far. Impressive cleanup! 👍
If any other contributors are lurking please speak up and add a review 😄
| - 2.3.1 | ||
| - 2.2.7 | ||
| - 2.3.5 | ||
| - 2.4.2 |
There was a problem hiding this comment.
The latest patch releases are 2.2.9, 2.3.6, and 2.4.3. Any reason not to use the latest?
There was a problem hiding this comment.
Supporting the latest patch release makes sense to me.
There was a problem hiding this comment.
didn't check the latest. will change.
| - test/gemfiles/5.2.gemfile | ||
| before_install: | ||
| - gem update --system | ||
| - gem update bundle |
There was a problem hiding this comment.
I'd prefer gem install bundler --no-document, which I think has the same outcome.
There was a problem hiding this comment.
It updates rubygems. Needed it to get ruby 2.5 running.
There was a problem hiding this comment.
Yep, I totally understand the need for gem update --system to get 2.5.0 working. I ran into that myself. I was referring to the bundle line. I'd prefer:
before_install:
- gem update --system
- gem install bundler --no-document| direction of `bootstrap_form`. Don't worry. We plan to move this gem forward to | ||
| Bootstrap 4 and to support Rails 5.1 and beyond. If you're thinking of | ||
| contributing to `bootstrap_form`, please read | ||
| [issue #361](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/361). |
There was a problem hiding this comment.
I'd like to keep the friendly and welcoming attitude (perhaps with some grammar edits):
Your comments are welcome.
Thanks so much for considering a contribution to bootstrap_form.
We love pull requests!
Any reason to remove it?
There was a problem hiding this comment.
I think we want to make the CONTRIBUTING document more complete, rather than less.
There was a problem hiding this comment.
Felt like it was kinda redundant. I'll add it back.
| # Git. Remember to move these dependencies to your gemspec before releasing | ||
| # your gem to rubygems.org. | ||
| group :development do | ||
| gem "htmlbeautifier" |
| gem "equivalent-xml" | ||
| gem "mocha" | ||
| gem "sqlite3" | ||
| gem "timecop", "~> 0.7.1" |
There was a problem hiding this comment.
Could you explain further why these dependencies belong in the Gemfile and not as dev dependencies in the gemspec? It means that we have to repeat these in each of the test gemfiles, and I don't see much benefit.
There was a problem hiding this comment.
This is mostly to keep gemspec clean. Unless you're directly working on the gem you don't need to install or even care about those dev dependencies. Gives you flexibility to cram whatever you want into your own Gemfile. See what Rails does: https://github.com/rails/rails/blob/master/rails.gemspec Million of gems used for development and testing are defined in Gemfile instead.
There was a problem hiding this comment.
Interesting, I had no idea that was a common practice! I am still confused because the definition of gemspec dev dependencies is that they "aren't installed by default and aren't activated when a gem is required". In other words, they are not considered at all unless you are working directly on the gem, which is exactly the behavior we want. Other popular Ruby projects like capybara, sprockets, and rack do it the gemspec way, so maybe it is just personal preference?
There was a problem hiding this comment.
BTW I don't mean to be argumentative or wish to hold up this PR in any way. I am honestly just really curious why the Ruby community seems to have two different ways of accomplishing the same thing. Maybe the Gemfile is preferable when you have to platform-specific dependencies, and in that case the Gemfile DSL is more expressive? Feel free to ignore my ramblings. 😀
There was a problem hiding this comment.
I don't remember where I picked it up. Maybe the biggest benefit when you're running tests on different environments that cannot use the same dependencies defined in the gemspec. So it's easier to keep that stuff in Gemfile.
sqlite3 and jruby immidiately come to mind.
lcreid
left a comment
There was a problem hiding this comment.
Great work. Thanks for doing all this. I'd like to see responses to some of @mattbrictson 's and my comments, please. Thanks in advance.
| - 2.1 | ||
| - 2.2 | ||
| - 2.3.1 | ||
| - 2.2.7 |
There was a problem hiding this comment.
I'm for supporting what Rails supports, back to Rails 5.0 as we've agreed.
| - 2.3.1 | ||
| - 2.2.7 | ||
| - 2.3.5 | ||
| - 2.4.2 |
There was a problem hiding this comment.
Supporting the latest patch release makes sense to me.
| @@ -1,8 +1,7 @@ | |||
| lib = File.expand_path("../lib", __FILE__) | |||
| $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |||
| $LOAD_PATH.unshift File.expand_path("../lib", __FILE__) | |||
There was a problem hiding this comment.
I could be wrong, but this and a few other lines in the file seem to be reverting some changes that @mattbrictson did a couple of days ago with PR #363. Is there a reason why one way is better than the other, or am I misreading this?
There was a problem hiding this comment.
Brand new freshly generated gem will have $:.push File.expand_path("lib", __dir__). Same thing really. I can't think of a reason why there needs to be a check for existence.
| direction of `bootstrap_form`. Don't worry. We plan to move this gem forward to | ||
| Bootstrap 4 and to support Rails 5.1 and beyond. If you're thinking of | ||
| contributing to `bootstrap_form`, please read | ||
| [issue #361](https://github.com/bootstrap-ruby/rails-bootstrap-forms/issues/361). |
There was a problem hiding this comment.
I think we want to make the CONTRIBUTING document more complete, rather than less.
…d_path thing in gemspec
mattbrictson
left a comment
There was a problem hiding this comment.
Thanks for responding to the feedback, and I appreciate the discussion. I couple more follow-ups:
| @@ -1,8 +1,7 @@ | |||
| lib = File.expand_path("../lib", __FILE__) | |||
| $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | |||
| $LOAD_PATH.push File.expand_path("lib", __dir__) | |||
There was a problem hiding this comment.
Dependency declarations aside (if you want to move them to the Gemfile, no problem), and with the exception of the addition of the required_ruby_version (nice catch, thanks), I would prefer the other gemspec changes be reverted unless you have a strong objection.
My overall reasoning is that the existing gemspec is based on the template provided by bundle gem, which presumably has many eyes on it has been well vetted by the community. It has also served me well on many gems I work on.
More specifically, according to the official docs:
platformshould be left as the default value "unless the code will only compile on a certain type of system"filesshould not include tests (not a strict requirement, but it is common practice to exclude them)bindir = "exe"is a good safety measure to ensure binstubs or other helper scripts that we may add tobin/in the future are not inadvertently packaged with the gem
There was a problem hiding this comment.
Ah neat. I just used whatever rails plugin new would produce with some tweaks. I reverted gemspec to more or less original state minus dev dependencies. I still don't undertand load_path checking is for, but it doesn't hurt I suppose.
There was a problem hiding this comment.
Gotcha on gem install bundler --no-document
| - test/gemfiles/5.2.gemfile | ||
| before_install: | ||
| - gem update --system | ||
| - gem update bundle |
There was a problem hiding this comment.
Yep, I totally understand the need for gem update --system to get 2.5.0 working. I ran into that myself. I was referring to the bundle line. I'd prefer:
before_install:
- gem update --system
- gem install bundler --no-document| @@ -0,0 +1 @@ | |||
| 2.4.1 No newline at end of file | |||
There was a problem hiding this comment.
Should we not just use 2.5.0 here?
Thanks for the contribution! This is great work!
There was a problem hiding this comment.
I think generator crammed it there. Removed it as you should be able to use whatever ruby you want.
|
This PR is ready to be merged, unless there are some other comments? |
lcreid
left a comment
There was a problem hiding this comment.
Nice work. I can use this for testing my pull request, so hopefully we can merge this soon.
|
Thanks for the PR and thanks for the reviews! It sounds like this is good to merge. Onward to 4.0! |
Removing SQLite dependency as we don't really need database for AR objects(has_many needs db)Remove Dangerfile? Seems kinda unneeded. Rcov and Rubocop have more value tbh.Not removing