Sha256: 054da3c55637203e2b3c2cff1075b4f6a1c936a2819eb1668348c6eebb08399d
Contents?: true
Size: 1.08 KB
Versions: 11
Compression:
Stored size: 1.08 KB
Contents
require 'pty' require 'fanforce/cli' module Fanforce::AppFactory::CLI::Utils extend self def self.included(base) base.extend(self) end include Fanforce::CLI::Utils @@config = nil def console_command(command, print_now=true) output = [] PTY.spawn(command) do |stdin, stdout, pid| stdin.each { |line| output << line; print line if print_now } end output.join("\n") end def config return @@config if @@config require 'yaml' if Fanforce::CLI::TYPE == :directory_of_apps config_path = "#{Fanforce::CLI::DIR}/.fanforce-app-factory" config_filename = '.fanforce-app-factory' elsif Fanforce::CLI::TYPE == :single_app config_path = "#{Fanforce::CLI::DIR}/../.fanforce-app-factory" config_filename = '../.fanforce-app-factory' end error "The required config file was not found: #{config_filename}" if !File.exists?(config_path) @@config = format_config(YAML.load_file(config_path)) end def format_config(hash) hash.values.select{|v| v.is_a? Hash}.each{|h| format_config(h)} hash.symbolize_keys! end end
Version data entries
11 entries across 11 versions & 1 rubygems