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
73 74 75 76 77 78 |
# File 'lib/envied/cli.rb', line 73 def check ENVied.require(*[:groups]) unless [:quiet] puts "All variables for group(s) #{[:groups]} are present and valid" end end |
#extract ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/envied/cli.rb', line 25 def extract globs = [:globs] globs << "{test,spec}/*" if [:tests] var_occurences = ENVied::EnvVarExtractor.new(globs: globs).extract puts "Found %d occurrences of %d variables:" % [var_occurences.values.flatten.size, var_occurences.size] var_occurences.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
41 42 43 44 45 46 47 48 49 |
# File 'lib/envied/cli.rb', line 41 def init puts "Writing Envfile to #{File.('Envfile')}" template("Envfile.tt") puts <<-INIT Add the following snippet (or similar) to your app's initialization: ENVied.require(*ENV['ENVIED_GROUPS'] || [:default, ENV['RACK_ENV']]) INIT end |