octopress / deploy

Deployment for Octopress and Jekyll blogs.
MIT License
75 stars 23 forks source link

Crash if site_dir isn't defined in _deploy.yml when using git deployment #29

Closed SSheldon closed 10 years ago

SSheldon commented 10 years ago

site_dir in _deploy.yml is stated to be optional for method: git, defaulting to _site. https://github.com/octopress/deploy#git-deployment-configuration

However, if I do not have it defined and attempt to do octopress deploy or octopress deploy pull <dir> it will crash with: no implicit conversion of nil into String

This is a regression that popped up somewhere between rc5 and rc8.

Here's the full stack trace:

/usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy/git.rb:12:in `expand_path': no implicit conversion of nil into String (TypeError)
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy/git.rb:12:in `initialize'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy.rb:68:in `new'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy.rb:68:in `deployer'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy.rb:32:in `push'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-deploy-1.0.0.rc.8/lib/octopress-deploy/commands.rb:12:in `block (2 levels) in init_with_program'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `call'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `block in execute'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `each'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `execute'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary/program.rb:35:in `go'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.3/lib/mercenary.rb:22:in `program'
    from /usr/local/Cellar/ruby/2.1.1/lib/ruby/gems/2.1.0/gems/octopress-3.0.0.rc.10/bin/octopress:23:in `<top (required)>'
    from /usr/local/opt/ruby/bin/octopress:23:in `load'
    from /usr/local/opt/ruby/bin/octopress:23:in `<main>'

Looks like @options[:site_dir] is nil now and File.expand_path doesn't like that https://github.com/octopress/deploy/blob/v1.0.0.rc.8/lib/octopress-deploy/git.rb#L12

Perhaps a solution would just be to pull the || 'site' into the File.expand_path call like is done with deploy_dir?