nwops / puppet-retrospec

The only tool you need to generate puppet code, tests, modules, facts, types, providers, data and everything else.
https://www.retrospec-puppet.com/
GNU Affero General Public License v3.0
137 stars 27 forks source link

ruby 1.9.3 not creating spec files #51

Closed JohnLyman closed 8 years ago

JohnLyman commented 8 years ago

With version 0.12, retrospec is not creating spec/classes. I downgraded to 0.11 and it generates spec/classes/retro_test_spec.rb as expected.

$ mkdir -p retro_test/manifests
$ cat > retro_test/manifests/init.pp << EOF
> class retro_test {
>
>   file { '/tmp/foo':
>     ensure  => present,
>     owner   => 'root',
>     group   => 'root',
>     mode    => '0644',
>   }
> }
> EOF
$ cd retro_test/
$ retrospec puppet
Successfully ran hook: /home/john.lyman/.retrospec/repos/retrospec-puppet-templates/clone-hook

Successfully ran hook: /home/john.lyman/.retrospec/repos/retrospec-puppet-templates/pre-hook

 + /tmp/retro_test/.bundle/
 + /tmp/retro_test/.bundle/config
 + /tmp/retro_test/.fixtures.yml
 + /tmp/retro_test/.git/
 + /tmp/retro_test/.git/hooks/
 + /tmp/retro_test/.git/hooks/pre-commit
 + /tmp/retro_test/.gitignore
 + /tmp/retro_test/.puppet-lint.rc
 + /tmp/retro_test/.travis.yml
 + /tmp/retro_test/Gemfile
 + /tmp/retro_test/README.markdown
 + /tmp/retro_test/Rakefile
 + /tmp/retro_test/Vagrantfile
 + /tmp/retro_test/files/
 + /tmp/retro_test/files/.gitkeep
 + /tmp/retro_test/spec/
 + /tmp/retro_test/spec/acceptance/
 + /tmp/retro_test/spec/shared_contexts.rb
 + /tmp/retro_test/spec/spec_helper.rb
 + /tmp/retro_test/templates/
 + /tmp/retro_test/templates/.gitkeep
 + /tmp/retro_test/tests/
 + /tmp/retro_test/tests/.gitkeep
$ gem list puppet-retrospec

*** LOCAL GEMS ***

puppet-retrospec (0.12.0)
logicminds commented 8 years ago

Thanks for reporting along with a test case. Are you using RVM or anything?

logicminds commented 8 years ago

What version of ruby are you using? I just tested this on ruby 2.0 with no issues.

JohnLyman commented 8 years ago

I'm using the ruby bundled with PE 3.3.2.

$ /opt/puppet/bin/ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

I'm not using RVM, but I do have $GEM_HOME set to ~/.gem/ruby/1.9.3

logicminds commented 8 years ago

This is a ruby 1.9.3 issue as I was able to reproduce the issue. As a work around please use ruby 2.0+

logicminds commented 8 years ago

So this is actually a problem in one of the newer templates where the template uses a to_h function that does not exist in ruby 1.9.3. 0.11.0 works because retrospec-puppet doesn't process the problem template.

Should be a easy fix to the offending template without a retrospec update.

logicminds commented 8 years ago

Fixed in latest templates.