class Contracto::SystemAction

Public Class Methods

clone_repo() click to toggle source
# File lib/contracto/system_action.rb, line 34
def clone_repo
  FileUtils.rm_rf Contracto::Config.root_dir
  success = system "git clone -q  --depth 1 --single-branch --branch master #{Contracto::Config.repo_url} #{Contracto::Config.root_dir}"
  raise(Contracto::CouldNotDownloadContractError.new(Contracto::Config.repo_url)) unless success
end
create_sample_contract() click to toggle source
# File lib/contracto/system_action.rb, line 10
def create_sample_contract
  if Dir.exists?(Contracto::Config.root_dir)
    puts 'contract already exists, creating sample contract skipped'
  else
    FileUtils.cp_r sample_contract_dir, Contracto::Config.root_dir
  end
end
revert_clone_repo() click to toggle source
# File lib/contracto/system_action.rb, line 40
def revert_clone_repo
  remove_root_dir
end
revert_create_sample_contract() click to toggle source
# File lib/contracto/system_action.rb, line 18
def revert_create_sample_contract
  remove_root_dir
end
revert_start_server() click to toggle source
# File lib/contracto/system_action.rb, line 26
def revert_start_server
  stop_server
end
start_server() click to toggle source
# File lib/contracto/system_action.rb, line 22
def start_server
  Contracto::Server.start_contracto_server!
end
stop_server() click to toggle source
# File lib/contracto/system_action.rb, line 30
def stop_server
  Contracto::Server.stop_contracto_server!
end

Private Class Methods

remove_root_dir() click to toggle source
# File lib/contracto/system_action.rb, line 46
def remove_root_dir
  FileUtils.rm_rf Contracto::Config.root_dir
end