Module: Alphonse::Configs::Tasks

Included in:
Operator
Defined in:
lib/alphonse/configs/operation.rb

Instance Method Summary collapse

Instance Method Details

#branchObject



26
27
28
# File 'lib/alphonse/configs/operation.rb', line 26

def branch
  config[:branch] || 'master'
end

#bundleObject Also known as: install_gems



76
77
78
# File 'lib/alphonse/configs/operation.rb', line 76

def bundle
  bundle_install
end

#cd_to_parent_pathObject



60
61
62
# File 'lib/alphonse/configs/operation.rb', line 60

def cd_to_parent_path
  "cd #{config[:path]}"
end

#cd_to_pathObject Also known as: cd



55
56
57
# File 'lib/alphonse/configs/operation.rb', line 55

def cd_to_path
  "#{cd_to_parent_path}#{config[:app_name]}"
end

#db_migrateObject Also known as: update_database



86
87
88
# File 'lib/alphonse/configs/operation.rb', line 86

def db_migrate
  rake("db:migrate RAILS_ENV=#{config[:environment]}")
end

#db_setupObject Also known as: setup_database



81
82
83
# File 'lib/alphonse/configs/operation.rb', line 81

def db_setup
  rake("db:setup RAILS_ENV=#{config[:environment]}")
end

#git_cloneObject Also known as: gc, clone_repository



70
71
72
# File 'lib/alphonse/configs/operation.rb', line 70

def git_clone
  "git clone #{repository} #{config[:path]}#{config[:app_name]}"
end

#git_pullObject Also known as: gl, update_repository



64
65
66
# File 'lib/alphonse/configs/operation.rb', line 64

def git_pull
  ["git checkout #{branch} -q", "git pull origin #{branch} -q", "git gc --aggressive"]
end

#listObject Also known as: ls

For testing only



21
22
23
# File 'lib/alphonse/configs/operation.rb', line 21

def list
  "ls -a"
end

#mkdir_pathObject Also known as: setup_directory



50
51
52
# File 'lib/alphonse/configs/operation.rb', line 50

def mkdir_path
  "mkdir -p #{config[:path]}"
end

#repositoryObject



30
31
32
# File 'lib/alphonse/configs/operation.rb', line 30

def repository
  config[:git_repo]
end

#restart_appObject



46
47
48
# File 'lib/alphonse/configs/operation.rb', line 46

def restart_app
  (config[:restart_command] || 'touch tmp/restart.txt')
end

#set_path_variableObject



34
35
36
# File 'lib/alphonse/configs/operation.rb', line 34

def set_path_variable
  ["export PATH=#{config[:env_path]}"]
end

#source_shell_rcObject



38
39
40
# File 'lib/alphonse/configs/operation.rb', line 38

def source_shell_rc
  "source ~/.bashrc"
end

#start_appObject



42
43
44
# File 'lib/alphonse/configs/operation.rb', line 42

def start_app
  (config[:start_command] || 'touch tmp/restart.txt')
end