StanAngeloff / compass-magick

Dynamic image generation for Compass using ChunkyPNG/PhantomJS.
http://StanAngeloff.github.com/compass-magick/
Other
157 stars 4 forks source link

magick causes chunky_png to throw error #5

Closed curvedmark closed 13 years ago

curvedmark commented 13 years ago

The following code throws

TypeError on line ["93"] of /usr/local/rvm/gems/ruby-1.9.2-p180/gems/chunky_png-1.1.0/lib/chunky_png/color.rb: can't convert Float into Integer

button {
    background: magick-canvas(340px, 44px,
        magick-border(maroon)
    ) no-repeat;
}

I'm using:

chunky_png (1.1.0) compass (0.11.beta.7, 0.10.6) compass-magick (0.1.2) oily_png (1.0.0) sass (3.1.0.alpha.254)

StanAngeloff commented 13 years ago

I've pasted the above code and it compiles OK with the following gems:

chunky_png (1.1.0)
compass (0.11.beta.7)
compass-magick (0.1.2)
oily_png (1.0.0)
sass (3.1.0.alpha.252)

I've also downloaded the latest version of these gems:

compass (0.11.1)
haml (3.1.1)
sass (3.1.1)

and I can confirm the code still compiles.

  1. What version of Ruby are you using?
  2. Make sure there are no other .scss files in the same directory (only leave the file that is failing)
  3. Could you try removing the 0.10.6 version of the compass gem?
  4. If the above doesn't help, can you run compass with the --trace option and paste the entire output here?
curvedmark commented 13 years ago

Forget to mension ruby version, it's 1.9.2 (as you can see from the command line). I also tried updating compass to 0.11.1 and sass to 3.1.1, and removed older versions, still the same.

To be absolutely sure, I created a clean standalone compass project, and created an empty scss file, put that code in it, added require "magick" to config.rb and then compiled the project. Boom, error. I guess there might be something wrong with my environment?

Here is the backtrace I got before updating compass & sass:

TypeError on line ["93"] of /usr/local/rvm/gems/ruby-1.9.2-p180/gems/chunky_png-1.1.0/lib/chunky_png/color.rb: can't convert Float into Integer
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/chunky_png-1.1.0/lib/chunky_png/color.rb:93:in `rgba'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/shapes.rb:48:in `block (2 levels) in circle'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/shapes.rb:41:in `each'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/shapes.rb:41:in `block in circle'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/shapes.rb:39:in `each'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/shapes.rb:39:in `circle'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/functions/drawing.rb:136:in `block in magick_border'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/canvas.rb:60:in `call'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/canvas.rb:60:in `block in initialize'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/canvas.rb:59:in `each'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/canvas.rb:59:in `initialize'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/functions/canvas.rb:37:in `new'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-magick-0.1.2/lib/magick/functions/canvas.rb:37:in `magick_canvas'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/script/funcall.rb:80:in `_perform'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/script/node.rb:40:in `perform'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/script/list.rb:61:in `block in _perform'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/script/list.rb:61:in `map'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/script/list.rb:61:in `_perform'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/script/node.rb:40:in `perform'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:215:in `visit_prop'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:37:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:18:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:53:in `map'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:53:in `visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:27:in `block in visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:39:in `with_environment'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:26:in `visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:37:in `block in visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:230:in `visit_rule'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:37:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:18:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:53:in `map'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:53:in `visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:27:in `block in visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:39:in `with_environment'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:26:in `visit_children'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:37:in `block in visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:47:in `visit_root'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/base.rb:37:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:18:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/visitors/perform.rb:7:in `visit'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/tree/root_node.rb:20:in `render'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/engine.rb:291:in `_render'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/sass-3.1.0.alpha.254/lib/sass/engine.rb:238:in `render'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:131:in `block (2 levels) in compile'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:117:in `timed'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:130:in `block in compile'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/logger.rb:45:in `red'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:129:in `compile'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:109:in `compile_if_required'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:96:in `block (2 levels) in run'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:94:in `each'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:94:in `block in run'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:117:in `timed'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/compiler.rb:93:in `run'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/commands/update_project.rb:36:in `perform'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/commands/base.rb:18:in `execute'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/commands/project_base.rb:19:in `execute'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/lib/compass/exec/sub_command_ui.rb:15:in `run!'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/bin/compass:25:in `block in <top (required)>'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/bin/compass:39:in `call'
  /usr/local/rvm/gems/ruby-1.9.2-p180/gems/compass-0.11.beta.7/bin/compass:39:in `<top (required)>'
  /usr/local/rvm/gems/ruby-1.9.2-p180/bin/compass:19:in `load'
  /usr/local/rvm/gems/ruby-1.9.2-p180/bin/compass:19:in `<main>'
StanAngeloff commented 13 years ago

I've installed 1.9.2 on my machine and I can confirm the error. Looking into it.

StanAngeloff commented 13 years ago

0.1.3 is out which should be compatible with Ruby 1.9.2. The demo file compiles without errors and so does your snippet. Let me know if any further issues arise & thanks for reporting this one.