effkay / blazing

painless git push deployments for everyone
MIT License
80 stars 12 forks source link

'blazing init' fails to read / create config file #71

Closed rogerbraun closed 12 years ago

rogerbraun commented 12 years ago

I did a gem install blazing, followed by blazing init. This ist the result:

1 (=194fc Gemfile Gemfile.lock) roger@X200 ~/repos/WadokuWeb> blazing init
/home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/lib/blazing/config.rb:18:in `read': No such file or directory - config/blazing.rb (Errno::ENOENT)
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/lib/blazing/config.rb:18:in `parse'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/lib/blazing/commands.rb:18:in `initialize'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/lib/blazing/commands.rb:8:in `new'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/lib/blazing/commands.rb:8:in `run'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/lib/blazing/cli.rb:15:in `init'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/task.rb:27:in `run'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/gems/blazing-0.2.12/bin/blazing:6:in `<top (required)>'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/bin/blazing:23:in `load'
    from /home/roger/.rvm/gems/ruby-1.9.3-p194/bin/blazing:23:in `<main>'

I tried using the current version by adding gem 'blazing', :git => 'git://github.com/effkay/blazing.git' to my Gemfile, but the results of bundle exec blazing init are the same.

My Ruby version is "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]".

effkay commented 12 years ago

Hi @rogerbraun

At a first glance it looks like blazing is reading it's config file before it is even created. I'll have a closer look at it ASAP, thanks for the feedback!

rogerbraun commented 12 years ago

I changed config.rb to say this:

      config.instance_eval(File.read(config.file)) if File.exists?(config.file)

I also had to add require 'erb' to commands.rb, else I would get an error about ERB not being defined.

With these changes, the command runs and gives the expected result.

rogerbraun commented 12 years ago

Oh, and thank you for your quick reaction!

effkay commented 12 years ago

You're welcome!

I think this could be fixed by not requiring the whole config object in the init command (I think it's kind of ok if config loading fails when no file is around... blazing itself should know better than to load it before it even created the file). But I have no workstation with git etc. available tonight, so it'll have to wait until tomorrow. Hope you can live with your own workaround for now.

effkay commented 12 years ago

Just released 0.2.13, hope the fix works for you.

Cheers