diff --git a/Rakefile b/Rakefile index c63a3fd0..0f729a6e 100644 --- a/Rakefile +++ b/Rakefile @@ -93,18 +93,10 @@ end desc 'Build for Puppet' task :build_module do - # Ready for module building - content = "require 'puppet/util/feature'\n\nPuppet.features.add(:ruby_pwsh, :libs => ['ruby-pwsh'])\n" - feature_path = 'lib/puppet/feature/ruby_pwsh.rb' - unless File.exist?(feature_path) ? File.read(feature_path) == content : false - FileUtils.mkdir_p(File.dirname(feature_path)) - File.open(feature_path, 'wb') { |file| file.write(content) } - end actual_readme_content = File.read('README.md') FileUtils.copy_file('pwshlib.md', 'README.md') # Build run_local_command('pdk build --force') # Cleanup File.open('README.md', 'wb') { |file| file.write(actual_readme_content) } - FileUtils.rm_r('lib/puppet') if File.exist?('lib/puppet') end diff --git a/pwshlib.md b/pwshlib.md index 5dc1ba8b..c1ce21fb 100644 --- a/pwshlib.md +++ b/pwshlib.md @@ -11,7 +11,11 @@ Include `puppetlabs-pwshlib` as a dependency in your module and you can leverage ```ruby require 'puppet/resource_api/simple_provider' -require 'ruby-pwsh' +begin + require 'ruby-pwsh' +rescue LoadError + raise 'Could not load the "ruby-pwsh" library; is the dependency module puppetlabs-pwshlib installed in this environment?' +end # Implementation for the foo type using the Resource API. class Puppet::Provider::Foo::Foo < Puppet::ResourceApi::SimpleProvider