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

windows support #53

Closed satishrajum closed 8 years ago

satishrajum commented 8 years ago

Hooks provided in the gems are not working with the external repos on windows.

C:\Users\userid\modules\modulename>retrospec puppet
c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/puppet-retrospec-0.12.1/lib/retrospec/p
lugins/v1/plugin/template_helpers.rb:59:in ``': Exec format error - C:/Users/userid/.retrospec/repos/retrospec-puppet-te
mplates/clone-hook C:/Users/userid/.retrospec/repos/retrospec-puppet-templates https://github.com/nwops/retrospec-templa
tes  (Errno::ENOEXEC)
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/puppet-retrospec-0.12.1/li
b/retrospec/plugins/v1/plugin/template_helpers.rb:59:in `run_clone_hook'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/puppet-retrospec-0.12.1/li
b/retrospec/plugins/v1/plugin/template_helpers.rb:35:in `setup_user_template_dir'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/puppet-retrospec-0.12.1/li
b/retrospec/plugins/v1/plugin/puppet.rb:32:in `initialize'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/puppet-retrospec-0.12.1/li
b/retrospec/plugins/v1/plugin/puppet.rb:112:in `new'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/puppet-retrospec-0.12.1/li
b/retrospec/plugins/v1/plugin/puppet.rb:112:in `run_cli'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/retrospec-0.4.0/lib/retros
pec/cli.rb:39:in `run'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/gems/2.0.0/gems/retrospec-0.4.0/bin/retros
pec:5:in `<top (required)>'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/bin/retrospec:23:in `load'
        from c:/Program Files/Puppet Labs/Puppet Enterprise/sys/ruby/bin/retrospec:23:in `<main>'
logicminds commented 8 years ago

Yea, the hooks don't work on windows as they are somewhat OS specific. I have also never tested this on windows. I don't think it would be that difficult to change this to be windows friendly.

logicminds commented 8 years ago

As a work around you can do the following:

  1. fork the templates
  2. remove all offending code inside the clone and pre hook
  3. commit your changes to your repo
  4. clone your repo to your C:/Users/userid/.retrospec/repos/retrospec-puppet-templates dir
  5. retry

Or

  1. fork the templates
  2. remove all offending code inside the clone and pre hook
  3. commit your changes to your repo
  4. clone your repo to some other dir
  5. retrospec puppet --template-dir='new_template_dir'

More info about the templates can be found here: https://github.com/nwops/retrospec-templates

satishrajum commented 8 years ago

Thanks for the reply. I will check both the options and see which one will work.

On Wed, Feb 24, 2016 at 1:16 PM, Corey Osman notifications@github.com wrote:

As a work around you can do the following:

  1. fork the templates
  2. remove all offending code inside the clone and pre hook
  3. commit your changes to your repo
  4. clone your repo to your C:/Users/userid/.retrospec/repos/retrospec-puppet-templates dir
  5. retry

Or

  1. fork the templates
  2. remove all offending code inside the clone and pre hook
  3. commit your changes to your repo
  4. clone your repo to some other dir
  5. retrospec puppet --template-dir='new_template_dir'

More info about the templates can be found here: https://github.com/nwops/retrospec-templates

— Reply to this email directly or view it on GitHub https://github.com/nwops/puppet-retrospec/issues/53#issuecomment-188388670 .

logicminds commented 8 years ago

Actually, this is something we will need to change in the code. Because of how windows works with scripts and associating them with a executable we can't just call the clone hooks directory like in linux. So we will need to call these hooks with ruby hook_name instead.

https://github.com/nwops/puppet-retrospec/blob/master/lib/retrospec/plugins/v1/plugin/template_helpers.rb#L59