Class: Rigup::Cli

Inherits:
Thor
  • Object
show all
Includes:
Utils::Install, Utils::Run
Defined in:
lib/rigup/cli.rb

Instance Method Summary collapse

Methods included from Utils::Install

#apply_permissions, #ensure_link, #internal_permissions, #make_public_cache_dir, #override_folder, #permissions_for_web, #permissions_for_web_writable, #select_suffixed_file

Methods included from Utils::Run

#bash, #cd, #pwd, #run, #run_for_all

Instance Method Details

#deploy(aPath = nil) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/rigup/cli.rb', line 157

def deploy(aPath=nil)
  init(aPath)
  update_cache
  #gem 'debugger'; require 'debugger'; debugger
  release
  call_release_command(:install)     # call install_command if defined eg. defaults to "thor deploy:install" eg. make changes to files
  call_release_command(:block)
  link_live
  call_release_command(:restart)     # call restart_command, defaults to "thor deploy:restart" eg. restart passenger
  call_release_command(:unblock)
  cleanup
end

#new(aGitUrl, aPath = nil) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/rigup/cli.rb', line 139

def new(aGitUrl,aPath=nil)
  app_name = File.basename(aGitUrl,'.git')
  aPath ||= app_name
  init(
    aPath,
    git_url: aGitUrl,
    app_name: app_name,
    user: ENV['USER']
  )
  FileUtils.mkdir_p(site_dir)
  FileUtils.mkdir_p(File.join(site_dir,'releases'))
  FileUtils.mkdir_p(File.join(site_dir,'shared'))

  #+ create rigup.yml if doesn't exist, including option values
  context.config.to_hash.filter_exclude(:site_dir).to_yaml.to_file(File.join(site_dir,'rigup.yml'))
end

#restart(aPath = nil) ⇒ Object



171
172
173
174
175
176
177
# File 'lib/rigup/cli.rb', line 171

def restart(aPath=nil)
  init(aPath)
  return unless cmdline = config["restart_command".to_sym].to_s.strip.to_nil
  cd File.join(site_dir,'current') do
    run cmdline
  end
end