Class: Envify::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/envify/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/envify/cli.rb', line 5

def self.exit_on_failure?
  true
end

Instance Method Details

#generateObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/envify/cli.rb', line 14

def generate
  if destination = options[:destination]
    env_template_path = ".env.#{destination}.erb"
    env_path          = ".env.#{destination}"
  else
    env_template_path = '.env.erb'
    env_path          = '.env'
  end

  File.write(env_path, ERB.new(File.read(env_template_path)).result, perm: 0o600)
end