Semantic-Org / Semantic-UI-Rails-LESS

This is a gem for Rails with Semantic UI (http://semantic-ui.com) assets inside.
MIT License
123 stars 36 forks source link

bundle exec rake 'update:version[2.4.1]' fails #50

Open brendon opened 6 years ago

brendon commented 6 years ago

Here are the last few lines of output when trying to update to the latest version of SemanticUI:

...
patch file: /Users/brendon/Projects/Semantic-UI-Rails-LESS/assets/stylesheets/semantic_ui/themes/duo/views/item.variables
patch file: /Users/brendon/Projects/Semantic-UI-Rails-LESS/assets/stylesheets/semantic_ui/themes/duo/views/card.variables
patch file: /Users/brendon/Projects/Semantic-UI-Rails-LESS/lib/generators/semantic_ui/install/templates/theme.config
rake aborted!
Content must be changed
tasks/update.rake:258:in `must_be_changed'
tasks/update.rake:140:in `block in patch_theme_config'
tasks/update.rake:252:in `block (2 levels) in patch'
tasks/update.rake:252:in `open'
tasks/update.rake:252:in `block in patch'
tasks/update.rake:245:in `block in look_over'
tasks/update.rake:242:in `each'
tasks/update.rake:242:in `look_over'
tasks/update.rake:250:in `patch'
tasks/update.rake:136:in `patch_theme_config'
tasks/update.rake:115:in `apply_patches'
tasks/update.rake:47:in `transform_sources'
tasks/update.rake:15:in `block (2 levels) in <top (required)>'

@maxd, before I start digging deep, is there any quick tips you could give?

maxd commented 6 years ago

The error appear in line 140:

tasks/update.rake:140:in `block in patch_theme_config'

here we see the following code:

must_be_changed(content) { |c| c.gsub(%q{@import "theme.less";}, %q{@import "semantic_ui/theme.less";}) }

As you can see it just replace @import "theme.less"; to @import "semantic_ui/theme.less";.

Now let's try to find this line in theme.config. This file was created from theme.config.example here.

So, let's look at source theme.config.example here. As you can see this line was changed here and it contains (multiple) now. So, this code at line 140 can't find @import "theme.less"; and replace it.

How to fix it? If current version of less support multiple directive then just try to add it to search string. If it doesn't support this directive, so try to remove it like here (look at this comment too) or maybe you can find better solution for this problem.

brendon commented 6 years ago

Thanks for the thorough pointer @maxd :) I really appreciate the info. I was more asking if you'd encountered this in the past before I dug deep but you've saved me some time :)

I think I'll modify the gsub and try to enforce a minimum version of less going forward but will do a bit more investigation. less-rails now supports directives.