Sha256: 1b9fb2c595c15f52eddca47e5042fc7dc3f9aff54a23fda956244a4a7b40b8ca

Contents?: true

Size: 748 Bytes

Versions: 13

Compression:

Stored size: 748 Bytes

Contents

module AlephExecutables
  class Utils
    def self.fail(msg, banner = nil)
      msg += "\n#{banner}" if banner
      puts msg;
      exit(false)
    end

    def self.inform(msg, banner = nil)
      msg += "\n#{banner}" if banner
      puts msg;
      exit(true)
    end

    def self.get_env_file(rails_env)
      !rails_env || (rails_env == 'development') ? '.env' : ".env.#{rails_env}"
    end

    def self.bundle_exec_with_clean_env(cmd_suffix, envs = nil)
      cmd = 'bundle exec ' + cmd_suffix
      if envs
        env_str = envs.reject{ |k, v| !v }.map{ |k, v| "#{k.to_s.upcase}=#{v}" }.join(' ')
        cmd = env_str + ' ' + cmd
      end

      puts "Running #{cmd} ... "
      Bundler.with_clean_env { system cmd }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev bin/executables/lib/utils.rb
aleph_analytics-0.4.8 bin/executables/lib/utils.rb
aleph_analytics-0.4.7 bin/executables/lib/utils.rb
aleph_analytics-0.4.4 bin/executables/lib/utils.rb
aleph_analytics-0.4.2 bin/executables/lib/utils.rb
aleph_analytics-0.4.1 bin/executables/lib/utils.rb
aleph_analytics-0.3.0 bin/executables/lib/utils.rb
aleph_analytics-0.2.0 bin/executables/lib/utils.rb
aleph_analytics-0.1.0 bin/executables/lib/utils.rb
aleph_analytics-0.0.6 bin/executables/lib/utils.rb
aleph_analytics-0.0.5 bin/executables/lib/utils.rb
aleph_analytics-0.0.4 bin/executables/lib/utils.rb
aleph_analytics-0.0.3 bin/executables/lib/utils.rb