metanorma / isodoc

Generate HTML/Word from Metanorma XML
https://www.metanorma.org
BSD 2-Clause "Simplified" License
3 stars 3 forks source link

(URGENT) isodoc requiring `sassc` in normal execution, and `metanorma-*` gems should not be published without compiled CSS #367

Open ronaldtse opened 2 years ago

ronaldtse commented 2 years ago

This is a regression. When generating the https://github.com/metanorma/iso-19626-1 document:

https://github.com/metanorma/iso-19626-1/pull/8

$ bundle exec metanorma site generate
...
#<Thread:0x00000001316cde00 /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:7 run> terminated with exception (report_on_exception is true):
/Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:78:in `require': cannot load such file -- sassc (LoadError)
    from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:78:in `convert_scss'
    from /Users/me/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:100:in `generate_css'

This task is to:

ronaldtse commented 2 years ago

And this is also visible here (https://github.com/metanorma/packed-mn/pull/126, run: https://github.com/metanorma/packed-mn/runs/4750539224?check_suite_focus=true) .

Looks like this is metanorma-iso specific, e.g. metanorma-iso lost the compiled CSS file.

#<Thread:0x00007f53bc5924e8 /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:7 run> terminated with exception (report_on_exception is true):
177
/__tebako_memfs__/lib/ruby/gems/2.7.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:78:in `require': cannot load such file -- sassc (LoadError)
178
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:78:in `convert_scss'
179
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:100:in `generate_css'
180
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/isodoc-1.8.4/lib/isodoc/css.rb:28:in `populate_css'
181
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/isodoc-1.8.4/lib/isodoc/html_function/html.rb:12:in `block (2 levels) in convert1'
182
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/builder.rb:433:in `insert'
183
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/builder.rb:416:in `method_missing'
184
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/isodoc-1.8.4/lib/isodoc/html_function/html.rb:10:in `block in convert1'
185
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/builder.rb:334:in `initialize'
186
    from /__tebako_memfs__/lib/ruby/gems/2.7.0/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/builder.rb:292:in `new'
187
CAMOBAP commented 2 years ago

packed-mn@1.5.5 release failed because of this, for some reason it happens only for iso flavor

ronaldtse commented 2 years ago

This was merged here: https://github.com/metanorma/metanorma-docker/pull/124

opoudjis commented 2 years ago

metanorma-iso-1.10.6 does not appear to have the CSS compiled. metanorma-iso-2.0.0 does, but it will only be accessible once I've released metanorma-cli, since this is a major version update. Issue will go away then.

ronaldtse commented 2 years ago

metanorma-iso-1.10.6 does not appear to have the CSS compiled

This is a major bug. How did that happen? I think we need some guard task to prevent this from happening.

opoudjis commented 2 years ago

I do not know. And please delegate any such task to someone else. The isodoc gem does in fact contain such code:

rule ".css" => [proc { |tn| tn.sub(/\.css$/, ".scss") }] do |current_task|
        puts(current_task)
        compile_scss_task(current_task)
      rescue StandardError => e
        notify_borken_compilation(e, current_task)
      end

....

   def notify_borken_compilation(error, current_task)
      puts("Cannot compile #{current_task} because of #{error.message}")
      puts("continue anyway[y|n]?")
      answer = STDIN.gets.strip
      if %w[y yes].include?(answer.strip.downcase)
        puts("Cannot compile #{current_task} because of #{error.message}")
      else
        exit(0)
      end
    end

Execution should have aborted during the release. I do not know why release was successful.

opoudjis commented 2 years ago

Confirmed that this has gone away with new release.

I request that someone who knows ruby rails better than me (which is not at all) author the guard task, and I am unassigning myself.

ronaldtse commented 2 years ago

Got it. Shouldn't Let me re-tool this task to do so.

webdev778 commented 2 years ago

If this has been added recently:

https://github.com/metanorma/metanorma-build-scripts/blob/main/.github/workflows/rubygems-release.yml

Then maybe it doesn't have a build step for scss.