Class: ORS::Commands::Sync

Inherits:
Base
  • Object
show all
Defined in:
lib/ors/commands/sync.rb

Constant Summary

Constants included from ORS::Config

ORS::Config::CONFIG_FILENAME

Instance Method Summary collapse

Methods inherited from Base

#run

Methods included from Base::ClassMethods

#run

Methods included from Helpers

#build_command, #bundle_install, #execute_command, #execute_in_parallel, #fatal, #info, #prepare_environment, #restart_server, #run_migrations, #setup_repo, #setup_ruby, #start_server, #stop_server, #update_code

Methods included from ORS::Config

#all_servers, #deploy_directory, #revision, #ruby_servers

Methods included from ORS::Config::ModuleMethods

#git, #parse_config_file, #parse_options, #valid_environments, #valid_options?

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ors/commands/sync.rb', line 5

def execute
  if options.first == '--all'
    environments = ORS::Config.valid_environments
  else
    environments = [environment]
  end

  environments.each do |environment|
    unless ORS::Config.git.branches[environment].nil?
      info "Syncing environment/branch #{environment}..."
      execute_command :localhost, %(git checkout master),
                                  %(git checkout #{environment}),
                                  %(git pull),
                                  %(git rebase master),
                                  %(git push),
                                  %(git checkout master)
    end
  end
end