New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand slim version support to latest (v3.0.1 at present). #602
Conversation
Please review @ramaboo, @presidentbeef. |
I see one of the things I missed. The removal of Ruby 1.8.7 support from slim 3.0.0. |
Updated to consider our |
Should probably be |
Also I'm not sure it needs to be quite so cautious on the Slim version, or else this will need to change again at the next Slim release. |
I agree. I also think the ternary operator doesn't convey the reason for the check, so I've made it a little more clear. |
I kept it cautious based on #353 (comment). If you're cool with being more forgiving so am I. Update forthcoming. 馃槃 |
e12cba2
to
eabeaeb
Compare
Sadly, I don't think this will work because the |
Heh. That'd be a problem indeed. :-) |
That's true. The best you could do is in to add a post_install message to the gemspec like if File.exist?('UPGRADING.md')
gem.post_install_message = File.read('UPGRADING.md')
end and in the lib/brakeman.rb do something like: # Slim 3.0.0 dropped support for Ruby
if RUBY_VERSION < "1.9.0"
gem "slim", ">=1.3.6", "<3.0"
else
gem "slim", ">=1.3.6"
end
require 'slim' Why is the dependency so open-ended? |
So we have an issue here and @bf4 is right. I wanted to change the versions during install time but that seems to be a thing rubygems doesn't provide. I'm going to give his suggestion a whirl. |
0533dfd
to
fbe87cd
Compare
Tempting to just leave slim out of dependencies and let bundler or users handle it themselves. |
@presidentbeef I hear you. The difficulty is that we want to support 1.8.7 but they don't. I think I have a way to do that, but bundler doesn't honor it during tests. We could also go with the optional dependency and the |
I got install working but broke Travis. Will think on it more. |
Right. As you probably saw, Brakeman already runs fine with optional dependencies (changes were made a while ago to support brakeman-min). |
I'll go in that direction after all. And after my commute home. (If you beat me to it with your own PR I won't be hurt. Promise.) 馃槃 |
Did you try tilt? |
I haven't. |
7b4af67
to
efa24aa
Compare
And we're back. I think I like this solution. The project Tested this on a Rails 4.2 app (Ruby 2.2.0) using slim 3.0.1 after installing it and upgrading my |
Essentially this is the same as removing Slim from from the gem dependencies, which is fine I suppose. |
Right, but keeps it available for testing and development (within bundler contexts). |
This is very much how tilt deals with things, as @bf4 was trying to point out, I think. 馃槃 BTW, my apologies for exposing you to some of the more exotic attempts I made. It was pretty rough there for a bit. |
Let me know if there's anything I missed on this PR? I'd be nice for Slim and Rails 4.2 users to have the latest Brakeman. 馃槃 |
|
||
$ gem install slim --version '~> 2.0.0' | ||
|
||
If you're on a more recent Ruby this step is _not_ required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little misleading...you need to install slim manually if you want to process slim templates, either way.
At the time of this commit that's slim v3.0.1. That is, except for Ruby 1.8.7 installations. Slim dropped support[^0] for Ruby 1.8.7 in their 3.0.0 release. This commit allows Brakeman to move forward with slim support on all supported later Ruby versions. To do this accurately we must install an appropriate version of Slim by inspecting `RUBY_VERSION` at install time. We do that by using the native extensions hooks available as part of gem installs. Ours is modeled after an example on GitHub[^1]. [^0]: https://github.com/slim-template/slim/blob/master/CHANGES#L12 [^1]: https://github.com/mmzyk/gem_dependency_example/tree/master/gem_dep_example
Docs update to look like this: For Slim UsersSlim v3.0.0 dropped support for Ruby 1.8.7. Install a version of
|
Expand slim version support to latest (v3.0.1 at present).
Thanks for your patience! |
@presidentbeef++ 馃槃 |
@presidentbeef When can we expect a new release on rubygems for this? |
@Lordnibbler I don't like to be too specific about release dates, but I do expect another release relatively soon. |
Tests passed locally. Run against a Rails 4.2 and Rails 4.1 projects; Got expected results.
I'm not claiming a perfect understanding but things seem to be in good working order. Please let me know what I missed. 馃槃
Fixes #601.