Class: Capricorn::Actors::BaseActor

Inherits:
Capricorn::Actor show all
Defined in:
lib/capricorn/actors/base_actor.rb

Defined Under Namespace

Modules: Config, Helper

Instance Attribute Summary

Attributes inherited from Capricorn::Actor

#satellite, #system

Instance Method Summary collapse

Methods inherited from Capricorn::Actor

#initialize

Methods included from Capricorn::Actor::Actions

included, #run_callbacks!, #run_callbacks_in_fase!

Constructor Details

This class inherits a constructor from Capricorn::Actor

Instance Method Details

#create_rails_appObject

create a new rails app for the current satellite



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/capricorn/actors/base_actor.rb', line 11

def create_rails_app
  system.as_user(system.web_user, system.web_group) do
    FileUtils.mkdir_p(File.dirname(system.satellite_root), :verbose => true)
    FileUtils.mkdir_p(system.shared_root, :verbose => true)
  end
  
  Dir.chdir(File.dirname(system.satellite_root)) do
    system.user_run system.web_user, "rails --force #{system.satellite_root}"
  end
  
  system.as_user(system.web_user, system.web_group) do
    Dir.chdir(File.dirname(system.satellite_root)) do
      link(File.join(system.shared_root,    'public'),
           File.join(system.satellite_root, 'public', 'system'))
      link(File.join(system.shared_root,    'private'),
           File.join(system.satellite_root, 'db', 'system'))
      link(File.join(system.shared_root,    'log'),
           File.join(system.satellite_root, 'log'))
      link(File.join(system.shared_root,    'settings'),
           File.join(system.satellite_root, 'config', 'settings'))
    end
    
  end
end

#destroy_rails_appObject

destroy the rails app for the current satellite



37
38
39
# File 'lib/capricorn/actors/base_actor.rb', line 37

def destroy_rails_app
  FileUtils.rm_rf system.satellite_root, :verbose => true
end

link the required engines for the current satellite



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/capricorn/actors/base_actor.rb', line 42

def link_engines
  Dir.chdir(system.satellite_root) do
    system.as_user(system.web_user, system.web_group) do
      
      write_environment
      clean_links
      @dependecies.reverse_each do |spec|
        link_engine(spec)
      end
      
    end
    run_migrations
  end
end