Class: Nodex::Deploy

Inherits:
Object
  • Object
show all
Includes:
DSL, Helper
Defined in:
lib/nodex/deploy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL

#bundle_install, #clear_cache, #create_tmp, #install_gems, #load_module, #log, #login_shell_wrap, #migrate_database, #rake_db_create, #rake_gems_install, #rake_task, #remote_run, #run, #update_code

Methods included from Helper

#app_checkout, #application_path, #bundle_cmd, #camelize, #checkout, #configuration_file, #copy_example_file, #git_clone, #git_pull, #install_bundler, #skip_step?, #skip_steps_cmd, #using_bundler?

Constructor Details

#initializeDeploy

Returns a new instance of Deploy.



8
9
10
11
# File 'lib/nodex/deploy.rb', line 8

def initialize
  self.server = :passenger
  configure
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def application
  @application
end

#branchObject

Returns the value of attribute branch.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def branch
  @branch
end

#cache_dirsObject

Returns the value of attribute cache_dirs.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def cache_dirs
  @cache_dirs
end

#db_example_nameObject

Returns the value of attribute db_example_name.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def db_example_name
  @db_example_name
end

#environmentObject

Returns the value of attribute environment.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def environment
  @environment
end

#hostObject

Returns the value of attribute host.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def host
  @host
end

#login_shellObject

Returns the value of attribute login_shell.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def 
  @login_shell
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def path
  @path
end

#repositoryObject

Returns the value of attribute repository.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def repository
  @repository
end

#skip_stepsObject

Returns the value of attribute skip_steps.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def skip_steps
  @skip_steps
end

#userObject

Returns the value of attribute user.



6
7
8
# File 'lib/nodex/deploy.rb', line 6

def user
  @user
end

Instance Method Details

#configureObject



17
18
19
# File 'lib/nodex/deploy.rb', line 17

def configure
  configure_from configuration_file if configuration_file
end

#configure_from(file) ⇒ Object



21
22
23
24
# File 'lib/nodex/deploy.rb', line 21

def configure_from(file)
  deploy = self
  eval file.read + ';local_variables.each { |variable| deploy.send "#{variable}=", eval(variable.to_s) rescue nil }'
end

#local_setupObject



31
32
33
# File 'lib/nodex/deploy.rb', line 31

def local_setup
  after_update_code
end

#local_updateObject



39
40
41
42
# File 'lib/nodex/deploy.rb', line 39

def local_update
  update_code
  after_update_code
end

#remote_setupObject



26
27
28
29
# File 'lib/nodex/deploy.rb', line 26

def remote_setup
  remote_run "cd #{path} && #{git_clone} && #{app_checkout} && #{copy_example_file} && #{install_bundler} && #{bundle_cmd} && #{rake_db_create}"
  local_setup
end

#remote_updateObject



35
36
37
# File 'lib/nodex/deploy.rb', line 35

def remote_update
  local_update
end

#server=(server) ⇒ Object



13
14
15
# File 'lib/nodex/deploy.rb', line 13

def server=(server)
  load_module "servers/#{server}"
end