Sha256: f31eb3d7d5e3e49475053425c1f0bde680cc9eda7ed1f3a208fbf4da58112db1
Contents?: true
Size: 1.8 KB
Versions: 8
Compression:
Stored size: 1.8 KB
Contents
module DesignShell class Core attr_reader :repo,:configured,:context def initialize(aDependencies=nil) @@instance = self unless (defined? @@instance) && @@instance if aDependencies @context = aDependencies[:context] @repo = aDependencies[:repo] @keyChain = aDependencies[:keyChain] || @context.key_chain end configure(@context) if @context end def self.instance (defined? @@instance) && @@instance end def configure(aContext) @configured = true end def ensure_repo_open if (!@repo && @context) if git_root = @context.find_git_root @repo = DesignShell::Repo.new @repo.open git_root end end raise "unable to open repository" unless @repo.open? @repo end def ensure_deploy_server @conn ||= Net::SSH.start(@context.credentials[:deploy_host],nil) end def deploy_plan(*args) return @deploy_plan if args.empty? plan = args.first if plan.is_a?(DesignShell::DeployPlan) @deploy_plan = plan elsif plan @deploy_plan = DesignShell::DeployPlan.new(:core => self,:plan => plan) end @deploy_plan end def build response = POpen4::shell('ls') # puts result[:stdout] end def deploy ensure_repo_open deploy_branch = 'master' deploy_plan(repo.get_file_content('.deploy_plan.xml',deploy_branch)) params = deploy_plan.deploy_items_values.clone params['site'] = deploy_plan.site params['repo_url'] = repo.origin.url call_server_command('DEPLOY',params) end def call_server_command(aCommand, aParams=nil) #ds_conn = ensure_deploy_server command = aCommand command += " " + JSON.generate(aParams) if aParams #result = ds_conn.exec!(command) result = nil Net::SSH.start(@context.credentials[:deploy_host],nil) do |ssh| result = ssh.exec!(command) end result end end end
Version data entries
8 entries across 8 versions & 1 rubygems