Class: ENVied::Cli
- Inherits:
-
Thor
- Object
- Thor
- ENVied::Cli
- Includes:
- Thor::Actions
- Defined in:
- lib/envied/cli.rb
Instance Method Summary collapse
Instance Method Details
#check ⇒ Object
72 73 74 75 76 77 |
# File 'lib/envied/cli.rb', line 72 def check ENVied.require(*[:groups]) unless [:quiet] puts "All variables for group(s) #{[:groups]} are present and valid" end end |
#extract ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/envied/cli.rb', line 26 def extract globs = [:globs] globs << "{test,spec}/*" if [: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 ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/envied/cli.rb', line 42 def init puts "Writing Envfile to #{File.('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 |