class ENVied::Cli

Public Instance Methods

check() click to toggle source
# File lib/envied/cli.rb, line 72
def check
  ENVied.require(*options[:groups])
  unless options[:quiet]
    puts "All variables for group(s) #{options[:groups]} are present and valid"
  end
end
extract() click to toggle source
# File lib/envied/cli.rb, line 26
def extract
  globs = options[:globs]
  globs << "{test,spec}/*" if options[:tests]
  var_occurrences = ENVied::EnvVarExtractor.new(globs: globs).extract

  puts "Found %d occurrences of %d variables:" % [var_occurrences.values.flatten.size, var_occurrences.size]
  var_occurrences.sort.each do |var, occs|
    puts var
    occs.sort_by{|i| i[:path].size }.each do |occ|
      puts "* %s:%s" % occ.values_at(:path, :line)
    end
    puts
  end
end
init() click to toggle source
# File lib/envied/cli.rb, line 42
def init
  puts "Writing Envfile to #{File.expand_path('Envfile')}"
  template("Envfile.tt")

  puts "Add the following snippet (or similar) to your app's initialization:"
  puts "ENVied.require(*ENV['ENVIED_GROUPS'] || [:default, ENV['RACK_ENV']])"
end
version() click to toggle source
# File lib/envied/cli.rb, line 11
def version
  puts ENVied::VERSION
end