Sha256: 7e622ca9fef43cbfdc6d75e6e44bcdf3c716ba5a8c10c4c42253f8fa513ed3fd

Contents?: true

Size: 1.05 KB

Versions: 23

Compression:

Stored size: 1.05 KB

Contents

require 'puppet-debugger/input_responder_plugin'
module PuppetDebugger
  module InputResponders
    class Types < InputResponderPlugin
      COMMAND_WORDS = %w(types)
      SUMMARY = 'List all the types available in the environment.'
      COMMAND_GROUP = :environment

      # @return - returns a list of types available to the environment
      # if a error occurs we we run the types function again
      def run(args = [])
        types
      end

      def types
        loaded_types = []
        begin
          # this loads all the types, if already loaded the file is skipped
          Puppet::Type.loadall
          Puppet::Type.eachtype do |t|
            next if t.name == :component
            loaded_types << t.name.to_s
          end
          loaded_types.ai
        rescue Puppet::Error => e
          puts e.message.red
          Puppet.info(e.message)
          # prevent more than two calls and recursive loop
          return if caller_locations(1, 10).find_all { |f| f.label == 'types' }.count > 2
          types
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
puppet-debugger-0.19.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.18.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.17.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.16.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.15.2 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.15.1 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.15.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.14.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.13.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.12.3 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.12.2 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.12.1 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.12.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.11.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.10.3 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.10.2 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.10.1 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.10.0 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.9.1 lib/plugins/puppet-debugger/input_responders/types.rb
puppet-debugger-0.9.0 lib/plugins/puppet-debugger/input_responders/types.rb