Problem in master... documented #251

Closed
richtera opened this Issue Dec 10, 2013 · 6 comments

Comments

Projects
None yet
2 participants
Contributor

richtera commented Dec 10, 2013

Here is the stacktrace I am getting:

Compiling for environment: ''
/Users/andy/prototype/prototypes/prototype9/ruhoh.rb/lib/ruhoh.rb:140:in `exist?': no implicit conversion of nil into String (TypeError)
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/lib/ruhoh.rb:140:in `compile'
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/lib/ruhoh/programs/compile.rb:15:in `compile'
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/lib/ruhoh/client.rb:113:in `block in compile'
    from /Users/andy/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/lib/ruhoh/client.rb:112:in `compile'
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/lib/ruhoh/client.rb:45:in `initialize'
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/bin/ruhoh:34:in `new'
    from /Users/andy/prototype/prototypes/prototype9/ruhoh.rb/bin/ruhoh:34:in `<top (required)>'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247/bin/ruhoh:23:in `load'
    from /Users/andy/.rvm/gems/ruby-2.0.0-p247/bin/ruhoh:23:in `<main>'

Checking into it...

Contributor

richtera commented Dec 10, 2013

Seems to be something with the new way config is implemented.
It's not actually reading my config.yml and therefore config is an empty object.

config = Ruhoh::Parse.data_file(@base, "config") || {}

Is not being called anywhere and I don't think

@config.touch

causes it to be called anywhere either. Also the code is assuming touch actually returns the config but I guess that
could be done easily once the touch method actually loads the config. Unfortunately I didn't really search for when this broke. It's also very curious why the test scripts wouldn't pick this up. Maybe it's only during compile and not during watch.

Owner

plusjade commented Dec 13, 2013

The config is managed in its own class now since it merges itself down the cascade. There's some hacky logic needed since we don't know which folder is the "theme" before config is built, so to build the config we have to scan all directories to see if any define config.yml|config.json.

Anyway, here is the new library: https://github.com/ruhoh/ruhoh.rb/blob/master/lib/ruhoh/config.rb#L26
You can see that config.touch does indeed return itself which is essentially a hash.

I can't reproduce this error. If you can point me to your failing blog I can clone it and try to reproduce it. Lastly, all the tests are testing against the actual compiled result, so the tests would catch it if config.yml were not parsing correctly for any reason.

Contributor

richtera commented Dec 13, 2013

The directory scanning might be tye problem. I have to construct the config
from a template. So I have a _private folder which contains a file called
config.yml which is an incomplete file I append runtime values to. I'll
rename it to see whether that's causing the weirdness
Andy

Sent from my iPhone

On Dec 13, 2013, at 2:27 AM, Jade Dominguez notifications@github.com
wrote:

The config is managed in its own class now since it merges itself down the
cascade. There's some hacky logic needed since we don't know which folder
is the "theme" before config is built, so to build the config we have to
scan all directories to see if any define config.yml|config.json.

Anyway, here is the new library:
https://github.com/ruhoh/ruhoh.rb/blob/master/lib/ruhoh/config.rb#L26
You can see that config.touch does indeed return itself which is
essentially a hash.

I can't reproduce this error. If you can point me to your failing blog I
can clone it and try to reproduce it. Lastly, all the tests are testing
against the actual compiled result, so the tests would catch it if
config.yml were not parsing correctly for any reason.


Reply to this email directly or view it on
GitHubhttps://github.com/ruhoh/ruhoh.rb/issues/251#issuecomment-30491345
.

Contributor

richtera commented Dec 13, 2013

There is a config.ru file in my root folder which seems to be causing the problem. Removing that file allows compilation to work.
The file contains this ruby code:

require 'rack'
require 'ruhoh'
run Ruhoh::Program.preview

# To preview your blog in "production" mode:
# run Ruhoh::Program.preview(:env => 'production')

Somehow the config loader is picking up that file.
So it should be a fairly simple fix. Since I am not deploying to a rack I will just remove the file for now.
Thanks
Andy

Owner

plusjade commented Dec 13, 2013

Right, that file was from an older version. If you're in 2.5+ it's no
longer needed. You'd just do

bundle exec ruhoh s
On Dec 13, 2013 6:48 AM, "Andreas Richter" notifications@github.com wrote:

There is a config.ru file in my root folder which seems to be causing the
problem. Removing that file allows compilation to work.
The file contains this ruby code:

require 'rack'require 'ruhoh'run Ruhoh::Program.preview

To preview your blog in "production" mode:# run Ruhoh::Program.preview(:env => 'production')

Somehow the config loader is picking up that file.
So it should be a fairly simple fix. Since I am not deploying to a rack I
will just remove the file for now.
Thanks
Andy


Reply to this email directly or view it on GitHubhttps://github.com/ruhoh/ruhoh.rb/issues/251#issuecomment-30514141
.

Contributor

richtera commented Dec 16, 2013

Ok, thanks. So this is not an issue unless you want to add code to warn the user of the file since it will mess up the config file loader. This is because "ru" sorts before "yml" so it will attempt to read the "ru" file as a yaml file.

richtera closed this Dec 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment