electric-it / minimart

MiniMart RubyGem for Chef cookbook mirroring and storage.
Apache License 2.0
52 stars 20 forks source link

Encoding issues when generating Minimart HTML #44

Closed jvrplmlmn closed 8 years ago

jvrplmlmn commented 8 years ago

Hi there,

I'm testing minimart and facing the following issue:

Ruby version, gem version, installed gems (minimart 1.2.0) and nodejs version:

vagrant@default-ubuntu-1404:~$ /opt/rubies/2.2.4/bin/ruby --version
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
vagrant@default-ubuntu-1404:~$ /opt/rubies/2.2.4/bin/gem --version
2.4.5.1
vagrant@default-ubuntu-1404:~$ /opt/rubies/2.2.4/bin/gem list

*** LOCAL GEMS ***

addressable (2.3.8)
bigdecimal (1.2.6)
buff-config (1.0.1)
buff-extensions (1.0.0)
buff-ignore (1.1.1)
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
bundler (1.11.2)
celluloid (0.16.0)
celluloid-io (0.16.2)
chef-config (12.9.38)
concurrent-ruby (1.0.1)
diff-lcs (1.2.5)
domain_name (0.5.20160310)
erubis (2.7.0)
execjs (2.6.0)
faraday (0.9.2)
fuzzyurl (0.8.0)
git (1.3.0)
hashie (3.4.3)
hitimes (1.2.3)
http-cookie (1.0.2)
httpclient (2.8.0)
io-console (0.4.3)
json (1.8.1)
mime-types (2.99.1)
minimart (1.2.0)
minitar (0.5.4)
minitest (5.4.3)
mixlib-authentication (1.4.0)
mixlib-config (2.2.1)
mixlib-log (1.6.0)
mixlib-shellout (2.2.6)
molinillo (0.4.4)
multipart-post (2.0.0)
netrc (0.11.0)
nio4r (1.2.1)
octokit (3.8.0)
power_assert (0.2.2)
psych (2.0.8)
rack (1.6.4)
rake (10.4.2)
rdoc (4.2.0)
redcarpet (3.3.2)
rest-client (1.8.0)
retryable (2.0.3)
ridley (4.5.0)
rspec-core (3.4.4)
rspec-expectations (3.4.0)
rspec-mocks (3.4.1)
rspec-support (3.4.1)
sass (3.4.22)
sawyer (0.6.0)
semverse (1.2.1)
solve (2.0.3)
sprockets (3.6.0)
test-unit (3.0.8)
thor (0.19.1)
tilt (2.0.2)
timers (4.0.4)
uglifier (2.7.2)
unf (0.1.4)
unf_ext (0.0.7.2)
varia_model (0.4.1)
vagrant@default-ubuntu-1404:~$
vagrant@default-ubuntu-1404:~$ nodejs --version
v0.10.44
vagrant@default-ubuntu-1404:~$

Inventory file:

vagrant@default-ubuntu-1404:~$ cat inventory.yml
sources:
  - "https://supermarket.chef.io"
cookbooks:
  nodejs:
    versions:
      - "~> 2.4.4"
vagrant@default-ubuntu-1404:~$

Retrieving the cookbooks to generate the mirror:

vagrant@default-ubuntu-1404:~$ /opt/rubies/2.2.4/bin/minimart mirror --load-deps
Fetching the universe for https://supermarket.chef.io ...
-- Downloading nodejs 2.4.4
-- Downloading yum-epel 0.6.6
-- Downloading yum 3.10.0
-- Downloading build-essential 3.2.0
-- Downloading seven_zip 2.0.0
-- Downloading windows 1.39.2
-- Downloading chef_handler 1.3.0
-- Downloading ark 1.0.1
-- Downloading apt 3.0.0
-- Downloading homebrew 2.1.0
Minimart is done building your inventory!
The inventory can be found in ./inventory
vagrant@default-ubuntu-1404:~$

Trying to generate the endpoint:

vagrant@default-ubuntu-1404:~$ sudo /opt/rubies/2.2.4/bin/minimart web --host=minimart.example.com
Building the cookbook index.
Generating Minimart HTML.
/opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/tilt-2.0.2/lib/tilt/template.rb:85:in `initialize': /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/../web/templates/dashboard.erb is not valid US-ASCII (Encoding::InvalidByteSequenceError)
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/template_helper.rb:30:in `new'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/template_helper.rb:30:in `template'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/template_helper.rb:17:in `render_template'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/dashboard_generator.rb:33:in `block in generate_template_content'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/../web/templates/layout.erb:26:in `block in singleton class'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/../web/templates/layout.erb:-6:in `instance_eval'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/../web/templates/layout.erb:-6:in `singleton class'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/../web/templates/layout.erb:-8:in `__tilt_47167812802960'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/tilt-2.0.2/lib/tilt/template.rb:164:in `call'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/tilt-2.0.2/lib/tilt/template.rb:164:in `evaluate'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/tilt-2.0.2/lib/tilt/template.rb:99:in `render'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/template_helper.rb:23:in `render_in_base_layout'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/dashboard_generator.rb:33:in `generate_template_content'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/dashboard_generator.rb:26:in `generate'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/html_generator.rb:66:in `generate_index'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/web/html_generator.rb:29:in `generate'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/commands/web.rb:77:in `generate_html'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/commands/web.rb:41:in `execute!'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/lib/minimart/cli.rb:95:in `web'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /opt/rubies/2.2.4/lib/ruby/gems/2.2.0/gems/minimart-1.2.0/bin/minimart:4:in `<top (required)>'
    from /opt/rubies/2.2.4/bin/minimart:23:in `load'
    from /opt/rubies/2.2.4/bin/minimart:23:in `<main>'
vagrant@default-ubuntu-1404:~$
tapickell commented 8 years ago

Thank you for this fix for this. 😄

jvrplmlmn commented 8 years ago

Fixed by #45