Sha256: d44b3a3e352050454591a7026573ff7b3fe44856ea3b060563ec94c6d62c932d

Contents?: true

Size: 808 Bytes

Versions: 3

Compression:

Stored size: 808 Bytes

Contents

module CM
module Function
class GeneratePassword < Nucleon.plugin_class(:CM, :function)

  #-----------------------------------------------------------------------------
  # Plugin interface

  #-----------------------------------------------------------------------------
  # Checks

  #-----------------------------------------------------------------------------
  # Property accessors / modifiers

  #-----------------------------------------------------------------------------
  # Operations

  def execute(args)
    super do
      length = (args.length == 1 ? args[0] : 40)
      `openssl rand -base64 "$((#{length} * 2))" | perl -pe 's/[^a-zA-Z0-9]//g' - | cut -c1-#{length}`
    end
  end

  #-----------------------------------------------------------------------------
  # Utilities

end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cm-0.1.8 lib/CM/function/generate_password.rb
cm-0.1.6 lib/CM/function/generate_password.rb
cm-0.1.4 lib/CM/function/generate_password.rb