Sha256: 359291d3a0982a8475f448cc17d5f94e27f7e1c2f3f7d7174883656573b60c29

Contents?: true

Size: 632 Bytes

Versions: 24

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

namespace :knapsack_pro do
  task :salt, [:size] do |_, args|
    default_size = 32
    size = (args[:size] || default_size).to_i

    if size >= default_size
      salt = SecureRandom.hex(size)
      puts 'Set environment variable on your CI server:'
      puts "KNAPSACK_PRO_SALT=#{salt}"
      puts
      puts "If you need longer salt you can provide the size:"
      puts "$ bundle exec rake knapsack_pro:salt[32]"
      puts "Default size 32 generates 64 chars."
    else
      puts "Salt must have at least 64 chars! You provided size #{size} which generates #{size*2} chars."
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
knapsack_pro-7.13.1 lib/tasks/salt.rake
knapsack_pro-7.13.0 lib/tasks/salt.rake
knapsack_pro-7.12.1 lib/tasks/salt.rake
knapsack_pro-7.12.0 lib/tasks/salt.rake
knapsack_pro-7.11.0 lib/tasks/salt.rake
knapsack_pro-7.10.0 lib/tasks/salt.rake
knapsack_pro-7.9.0 lib/tasks/salt.rake
knapsack_pro-7.8.2 lib/tasks/salt.rake
knapsack_pro-7.8.1 lib/tasks/salt.rake
knapsack_pro-7.8.0 lib/tasks/salt.rake
knapsack_pro-7.7.0 lib/tasks/salt.rake
knapsack_pro-7.6.2 lib/tasks/salt.rake
knapsack_pro-7.6.1 lib/tasks/salt.rake
knapsack_pro-7.6.0 lib/tasks/salt.rake
knapsack_pro-7.1.0 lib/tasks/salt.rake
knapsack_pro-7.0.1 lib/tasks/salt.rake
knapsack_pro-7.0.0 lib/tasks/salt.rake
knapsack_pro-6.0.4 lib/tasks/salt.rake
knapsack_pro-6.0.3 lib/tasks/salt.rake
knapsack_pro-6.0.2 lib/tasks/salt.rake