Class: Capistrano::Configuration

Inherits:
Object
  • Object
show all
Defined in:
capistrano-support/lib/torquebox/capistrano/recipes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) create_deployment_descriptor(root)



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'capistrano-support/lib/torquebox/capistrano/recipes.rb', line 23

def create_deployment_descriptor( root )
    dd = {
      'application'=>{
        # Force the encoding to UTF-8 on 1.9 since the value may be ASCII-8BIT, which marshals as an encoded bytestream, not a String.
        'root'=>"#{root.respond_to?(:force_encoding) ? root.force_encoding('UTF-8') : root}",
      },
    }

    if ( exists?( :app_host ) )
      dd['web'] ||= {}
      dd['web']['host'] = app_host
    end

    if ( exists?( :app_context ) )
      dd['web'] ||= {}
      dd['web']['context'] = app_context
    end

    if ( exists?( :app_ruby_version ) )
      dd['ruby'] ||= {}
      dd['ruby']['version'] = app_ruby_version
    end

    if ( exists?( :app_environment ) && ! app_environment.empty? ) 
      dd['environment'] = app_environment
    end

    if ( exists?( :rails_env ) )
      dd['environment'] ||= {}
      dd['environment']['RAILS_ENV'] = rails_env
    end

    if (exists?( :stomp_host ) )
      dd['stomp'] ||= {}
      dd['stomp']['host'] = stomp_host
    end

    dd
end