lib/fanforce/cli/utils.rb in fanforce-cli-1.6.0 vs lib/fanforce/cli/utils.rb in fanforce-cli-1.7.0

- old
+ new

@@ -40,9 +40,28 @@ print "#{msg} [y/n]: " input = $stdin.gets.strip exit 0 if input.downcase == 'n' end + def env(environment) + return if environment.blank? + is_symbol = environment.is_a?(Symbol) + env = case environment.to_sym + when :development then :dev + when :staging then :stg + when :production then :prd + else raise 'unknown environment' + end + is_symbol ? env : env.to_s + end + + def get_heroku_app_name(app, environment) + raise 'unknown environment' if ![:production, :staging].include?(environment) + + heroku_app_name = "#{env(environment)}-#{app.dir_name}" + heroku_app_name.length > 30 ? heroku_app_name.gsub!(/(a|e|i|o|u)/, '') : heroku_app_name + end + end class String def format(*args) Fanforce::CLI::Utils.format(self, *args) \ No newline at end of file